Esempio n. 1
0
 public ModelInfoOverlay(Models.WMO.WMOHitInformation info)
 {
     mModelName = info.Model.FileName;
     initOverlay();
 }
Esempio n. 2
0
 public void UpdateModel(Models.WMO.WMOHitInformation hit)
 {
     mModelName              = hit.Model.FileName;
     mTextElements[0].Text   = "Selected model: " + mModelName;
     mBorderElements[1].Size = new SlimDX.Vector2(mTextElements[0].DrawFont.MeasureString(new SlimDX.Vector2(45, 47), mTextElements[0].Text, mTextElements[0].FontSize).X + 10, 23);
 }
Esempio n. 3
0
        static void _MouseClick(int x, int y, System.Windows.Forms.MouseButtons pressedButton)
        {
            // at startup when we are awaiting the loading the selection manager is not yet created
            // so if the user clicks the window SelectionManager is still null
            if (Game.GameManager.SelectionManager == null)
            {
                return;
            }

            if (Game.GameManager.SelectionManager.HadModelMovement)
            {
                Game.GameManager.SelectionManager.HadModelMovement = false;
                return;
            }

            if (pressedButton == System.Windows.Forms.MouseButtons.Left)
            {
                bool shift = Video.Input.InputManager.Input[System.Windows.Forms.Keys.ShiftKey];
                bool ctrl  = Video.Input.InputManager.Input[System.Windows.Forms.Keys.ControlKey];

                if (shift || ctrl)
                {
                    return;
                }

                Models.WMO.WMOHitInformation hit = null;
                Vector3 hitPos;
                var     ray = CalcRayForTransform(Matrix.Identity);
                Models.MDX.MdxIntersectionResult result;
                Game.GameManager.M2ModelManager.HitModels(ray, out result);

                var terrainPos  = Game.GameManager.GraphicsThread.GraphicsManager.MousePosition;
                var camPos      = Game.GameManager.GraphicsThread.GraphicsManager.Camera.Position;
                var terrainDist = (terrainPos - camPos).Length();
                var mdxDistance = (result.HitPoint - camPos).Length();

                if (Models.WMO.WMOManager.IsWmoHit(out hit, out hitPos))
                {
                    var wmoDist = (hitPos - camPos).Length();

                    if (wmoDist < terrainDist)
                    {
                        if (mdxDistance >= 0 && mdxDistance < wmoDist)
                        {
                            Game.GameManager.SelectionManager.SelectMdxModel(result);
                            return;
                        }
                        //Game.GameManager.GameWindow.WMOEditor.SetWMO(hit.Name);
                        Game.GameManager.SelectionManager.SelectWMOModel(hit);
                        return;
                    }
                    else if (result.HasHit && mdxDistance >= 0 && mdxDistance < terrainDist)
                    {
                        Game.GameManager.SelectionManager.SelectMdxModel(result);
                        return;
                    }
                }
                else if (result.HasHit && mdxDistance >= 0 && mdxDistance < terrainDist)
                {
                    Game.GameManager.SelectionManager.SelectMdxModel(result);
                    return;
                }

                Game.GameManager.SelectionManager.ClearSelection();
            }
        }