コード例 #1
0
        public void SelectWMOModel(WMO.WMOHitInformation wmoHit)
        {
            mMdxResult = null;
            mWmoResult = wmoHit;
            mSelectionBox.UpdateSelectionBox(wmoHit.Model.BoundingBox, wmoHit.ModelMatrix);
            if (mModelMover != null)
            {
                mModelMover.ModelChanged -= mSelectionBox.UpdateMatrix;
            }

            mModelMover = new WMO.WMOModelMover(wmoHit);
            mModelMover.ModelChanged += (matrix) =>
            {
                mSelectionBox.UpdateMatrix(matrix);
                if (mCurrentSelection != null)
                {
                    mCurrentSelection.ModelPosition = new SlimDX.Vector3(matrix.M41, matrix.M42, matrix.M43);
                }
            };

            var modelOverlay = Game.GameManager.GraphicsThread.GetOverlay <UI.Overlays.ModelInfoOverlay>();

            if (modelOverlay != null)
            {
                modelOverlay.UpdateModel(wmoHit);
            }
            else
            {
                modelOverlay = new UI.Overlays.ModelInfoOverlay(wmoHit);
                Game.GameManager.GraphicsThread.PushOverlay(modelOverlay);
            }

            ModelSelectionInfo info = new ModelSelectionInfo()
            {
                ModelName     = wmoHit.Model.FileName,
                ModelMover    = mModelMover,
                ModelPosition = new SlimDX.Vector3(wmoHit.ModelMatrix.M41, wmoHit.ModelMatrix.M42, wmoHit.ModelMatrix.M43)
            };

            mCurrentSelection = info;

            if (ModelSelected != null)
            {
                ModelSelected(info);
            }
        }
コード例 #2
0
        public void SelectMdxModel(MDX.MdxIntersectionResult result)
        {
            mMdxResult = result;
            mWmoResult = null;
            mSelectionBox.UpdateSelectionBox(result.Model.BoundingBox, result.InstanceData.ModelMatrix);
            if (mModelMover != null)
            {
                mModelMover.ModelChanged -= mSelectionBox.UpdateMatrix;
            }
            mModelMover = new MDX.M2ModelMover(result);
            mModelMover.ModelChanged += (matrix) =>
            {
                mSelectionBox.UpdateMatrix(matrix);
                if (mCurrentSelection != null)
                {
                    mCurrentSelection.ModelPosition = new SlimDX.Vector3(matrix.M41, matrix.M42, matrix.M43);
                }
            };
            var modelOverlay = Game.GameManager.GraphicsThread.GetOverlay <UI.Overlays.ModelInfoOverlay>();

            if (modelOverlay != null)
            {
                modelOverlay.UpdateModel(result);
            }
            else
            {
                modelOverlay = new UI.Overlays.ModelInfoOverlay(result);
                Game.GameManager.GraphicsThread.PushOverlay(modelOverlay);
            }

            ModelSelectionInfo info = new ModelSelectionInfo()
            {
                ModelName     = result.Model.ModelPath,
                ModelMover    = mModelMover,
                ModelPosition = new SlimDX.Vector3(result.InstanceData.ModelMatrix.M41, result.InstanceData.ModelMatrix.M42, result.InstanceData.ModelMatrix.M43)
            };

            mCurrentSelection = info;

            if (ModelSelected != null)
            {
                ModelSelected(info);
            }
        }
コード例 #3
0
ファイル: SelectionManager.cs プロジェクト: remixod/sharpwow
        public void SelectMdxModel(MDX.MdxIntersectionResult result)
        {
            mMdxResult = result;
            mWmoResult = null;
            mSelectionBox.UpdateSelectionBox(result.Model.BoundingBox, result.InstanceData.ModelMatrix);
            if (mModelMover != null)
                mModelMover.ModelChanged -= mSelectionBox.UpdateMatrix;
            mModelMover = new MDX.M2ModelMover(result);
            mModelMover.ModelChanged += (matrix) =>
                {
                    mSelectionBox.UpdateMatrix(matrix);
                    if (mCurrentSelection != null)
                        mCurrentSelection.ModelPosition = new SlimDX.Vector3(matrix.M41, matrix.M42, matrix.M43);
                };
            var modelOverlay = Game.GameManager.GraphicsThread.GetOverlay<UI.Overlays.ModelInfoOverlay>();
            if (modelOverlay != null)
                modelOverlay.UpdateModel(result);
            else
            {
                modelOverlay = new UI.Overlays.ModelInfoOverlay(result);
                Game.GameManager.GraphicsThread.PushOverlay(modelOverlay);
            }

            ModelSelectionInfo info = new ModelSelectionInfo()
            {
                ModelName = result.Model.ModelPath,
                ModelMover = mModelMover,
                ModelPosition = new SlimDX.Vector3(result.InstanceData.ModelMatrix.M41, result.InstanceData.ModelMatrix.M42, result.InstanceData.ModelMatrix.M43)
            };

            mCurrentSelection = info;

            if (ModelSelected != null)
                ModelSelected(info);
        }
コード例 #4
0
ファイル: SelectionManager.cs プロジェクト: remixod/sharpwow
        public void SelectWMOModel(WMO.WMOHitInformation wmoHit)
        {
            mMdxResult = null;
            mWmoResult = wmoHit;
            mSelectionBox.UpdateSelectionBox(wmoHit.Model.BoundingBox, wmoHit.ModelMatrix);
            if (mModelMover != null)
                mModelMover.ModelChanged -= mSelectionBox.UpdateMatrix;

            mModelMover = new WMO.WMOModelMover(wmoHit);
            mModelMover.ModelChanged += (matrix) =>
            {
                mSelectionBox.UpdateMatrix(matrix);
                if (mCurrentSelection != null)
                    mCurrentSelection.ModelPosition = new SlimDX.Vector3(matrix.M41, matrix.M42, matrix.M43);
            };

            var modelOverlay = Game.GameManager.GraphicsThread.GetOverlay<UI.Overlays.ModelInfoOverlay>();
            if (modelOverlay != null)
                modelOverlay.UpdateModel(wmoHit);
            else
            {
                modelOverlay = new UI.Overlays.ModelInfoOverlay(wmoHit);
                Game.GameManager.GraphicsThread.PushOverlay(modelOverlay);
            }

            ModelSelectionInfo info = new ModelSelectionInfo()
            {
                ModelName = wmoHit.Model.FileName,
                ModelMover = mModelMover,
                ModelPosition = new SlimDX.Vector3(wmoHit.ModelMatrix.M41, wmoHit.ModelMatrix.M42, wmoHit.ModelMatrix.M43)
            };

            mCurrentSelection = info;

            if (ModelSelected != null)
                ModelSelected(info);
        }