public static GraphicsDeviceService AddRef(IntPtr wndHandle, int width, int height)
        {
            if(refCnt == 0)
            {
                singleton = new GraphicsDeviceService(wndHandle, width, height );
            }

            refCnt++;

            return singleton;
        }
Exemple #2
0
        protected override void Dispose(bool disposing)
        {
            if (device != null)
            {
                device.Release(disposing);
                device = null;
            }

            base.Dispose(disposing);
        }
Exemple #3
0
        protected override void OnCreateControl()
        {
            base.OnCreateControl();

            Application.Idle += delegate { Invalidate(); };

            if (!DesignMode)
            {
                device = GraphicsDeviceService.AddRef(Handle, ClientSize.Width, ClientSize.Height);
                services.AddService<IGraphicsDeviceService>(device);
                m_camera = new Camera(device);
                m_gridFloor = new RenderQuad(
                    services,
                    new Vector3(0.0f, 0.0f, 0.0f),
                    new Vector3(0.0f, 1.0f, 0.0f),
                    new Vector3(0.0f, 1.0f, 0.0f),
                    //10, 10,
                    100,100,
                    RenderQuad.ETextureMapMode.eWorldScale,
                    "grid_floor");
            }

            CameraController controller = new CameraController();
            controller.Init(m_camera);
            m_inputControllers.Add("camera_controller", controller);

            AddInputListener(controller, false);
        }
Exemple #4
0
 public Camera(GraphicsDeviceService device)
 {
     m_device = device;
     m_lookAtRotation.Order = RotationEuler.EOrder.eOrder_XZY;
     RecalculateXfms();
 }