Esempio n. 1
0
		public void OnUpdateInput(Axiom.Input.InputReader inputReader)
		{
            if (mposx != inputReader.AbsoluteMouseX || mposy != inputReader.AbsoluteMouseY)
            {
                mposx = inputReader.AbsoluteMouseX;
                mposy = inputReader.AbsoluteMouseY;

                Core.BrowserManager[_browserId].MouseMove(mposx, mposy);
            }
            
            
            string status = "off";

            if (inputReader.IsMousePressed(MouseButtons.Left))
            {
                status = "on";
                IsPressed = true;

                Core.BrowserManager[_browserId].MouseDown(MouseButton.Left);

            }
            if (!inputReader.IsMousePressed(MouseButtons.Left) && IsPressed)
            {
                Core.BrowserManager[_browserId].MouseUp(MouseButton.Left);

                //var _camera = Game.Context.Camera;
                //var _renderWindow = Game.Context.RenderWindow;
                //var _ray = _camera.GetCameraToViewportRay(
                //        inputReader.AbsoluteMouseX / (float)_renderWindow.Width,
                //        inputReader.AbsoluteMouseY / (float)_renderWindow.Height);
                //RaySceneQuery _sceneQuery = _root.SceneManager.CreateRayQuery(
                //    _ray, (uint)SceneQueryTypeMask.WorldGeometry);
                //_sceneQuery.AddWorldFragmentType(WorldFragmentType.SingleIntersection);
                //_sceneQuery.AddWorldFragmentType(WorldFragmentType.CustomGeometry);
                //var results = _sceneQuery.Execute();


                //foreach (RaySceneQueryResultEntry result in results)
                //{

                //    if (result.SceneObject != null)
                //    {
                        

                       // result.SceneObject.ShowBoundingBox = true;
                        //var woot = _ray.GetPoint(result.Distance);
                        //Vector3[] corners = result.SceneObject.GetWorldBoundingBox().Corners;

                        //var res = (from v in corners
                        //           orderby v.Distance(woot)
                        //           select v).Take(4);
                        ////var i = 1;
                        ////i++;

                        //foreach (var v in res)
                        //{
                        //    var e = _root.SceneManager.CreateEntity("1BasicCube" + r.Next().ToString(), PrefabEntity.Cube);
                        //    e.MaterialName = "CBDynamicMaterial";

                        //    var s = Root.Instance.SceneManager.RootSceneNode.CreateChildSceneNode();
                        //    s.Position = v;
                        //    s.Scale = new Vector3(0.5f, 0.5f, 0.5f);
                        //    s.AttachObject(e);
                        //    s.Yaw(45);
                        //}

                //    }
                //}



                IsPressed = false;

            }


            //_element.Text = String.Format("X: {0} Y: {1} Status: {2}", 
            //    inputReader.AbsoluteMouseX,
            //    inputReader.AbsoluteMouseY, 
            //    status);


		}