Example #1
0
        public ViewControl()
        {
            // this control will be painted using some 3d API
            // no need for double buffering
            // also no need for the OS to paint it.
            this.ResizeRedraw   = false;
            this.DoubleBuffered = false;
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.Opaque, true);
            AllowDrop = true;
            m_camera  = new Camera();


            m_camera.SetPerspective((float)(Math.PI / 4), 1.0f, 0.1f, 2048);
            m_cameraController        = new MayaStyleCameraController();
            m_cameraController.Camera = m_camera;

            Sphere3F sphere = new Sphere3F(new Vec3F(0, 0, 0), 25.0f);
            float    nearZ  = m_camera.PerspectiveNearZ;

            m_camera.ZoomOnSphere(sphere);
            m_camera.PerspectiveNearZ = nearZ;
            m_camera.CameraChanged   += new EventHandler(CameraChanged);
        }
Example #2
0
        public ViewControl()
        {           
            // this control will be painted using some 3d API
            // no need for double buffering
            // also no need for the OS to paint it.
            this.ResizeRedraw = false;
            this.DoubleBuffered = false;
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.Opaque, true);
            AllowDrop = true;
            m_camera = new Camera();


            m_camera.SetPerspective((float)(Math.PI / 4), 1.0f, 0.1f, 2048);
            m_cameraController = new MayaStyleCameraController();
            m_cameraController.Camera = m_camera;

            Sphere3F sphere = new Sphere3F(new Vec3F(0, 0, 0), 25.0f);
            float nearZ = m_camera.PerspectiveNearZ;
            m_camera.ZoomOnSphere(sphere);
            m_camera.PerspectiveNearZ = nearZ;
            m_camera.CameraChanged += new EventHandler(CameraChanged);

        }