///<summary>更新D3D相机, isAni是否以动画方式更新相机,duraion动画时长毫秒, isImmediateRefreshEarth是否立即刷目标位置地图</summary> public void updateD3DCamera(bool isAni = false, int duration = 500, bool isImmediateRefreshEarth = true) { STRUCT_Camera para = new STRUCT_Camera() { far = Far, near = Near, fieldofview = FieldOfView }; para.lookat = new VECTOR3D(cameraLookat.X, cameraLookat.Y, cameraLookat.Z); para.pos = new VECTOR3D(cameraPosition.X, cameraPosition.Y, cameraPosition.Z); para.up = new VECTOR3D(cameraUp.X, cameraUp.Y, cameraUp.Z); para.direction = new VECTOR3D(cameraDirection.X, cameraDirection.Y, cameraDirection.Z); IntPtr ipPara = Marshal.AllocCoTaskMem(Marshal.SizeOf(para)); Marshal.StructureToPtr(para, ipPara, false); D3DManager.ChangeCameraPara(earth.earthkey, ipPara, isAni, duration); Marshal.FreeCoTaskMem(ipPara); if (duration > 0 && _isAutoUpdateMapModel && operateMode == EOperateMode.地图模式) { if (isImmediateRefreshEarth) { earth.earthManager.refreshEarth(); } tmr.Interval = TimeSpan.FromMilliseconds(duration); tmr.Start(); } }
///<summary>更新D3D相机, isAni是否以动画方式更新相机,duraion动画时长毫秒</summary> public void updateD3DCamera(bool isAni = false, int duration = 500) { STRUCT_Camera para = new STRUCT_Camera() { far = Far, near = Near, fieldofview = FieldOfView }; para.lookat = new VECTOR3D(cameraLookat.X, cameraLookat.Y, cameraLookat.Z); para.pos = new VECTOR3D(cameraPosition.X, cameraPosition.Y, cameraPosition.Z); para.up = new VECTOR3D(cameraUp.X, cameraUp.Y, cameraUp.Z); para.direction = new VECTOR3D(cameraDirection.X, cameraDirection.Y, cameraDirection.Z); IntPtr ipPara = Marshal.AllocCoTaskMem(Marshal.SizeOf(para)); Marshal.StructureToPtr(para, ipPara, false); D3DManager.ChangeCameraPara(earth.earthkey, ipPara, isAni, duration); Marshal.FreeCoTaskMem(ipPara); }