Ejemplo n.º 1
0
        public void Initialize(int viewWidth, int viewHeight, IntPtr handle, Form form, DXConfigClass DXConfig)
        {
            DestroyAllResources();

            _D3D = new D3DClass();
            _D3D.Initialize(viewWidth, viewHeight, handle, form, DXConfig);
            Camera = new DXPerspectiveCamera(_config.FOV, (float)viewWidth, (float)viewHeight, _config.ScreenNear, _config.ScreenDepth);
            CameraControler = new DXOrbitControler(Camera, (form as ArbaroMainForm).renderCtrl);
            //CameraControler = new DXArcballControler(Camera, (form as ArbaroMainForm).renderCtrl);
        }
        //
        // ctrl is the windows control hooked for events (mouse & keyboard)
        //
        public DXBaseCameraControler(DXCamera camera, Control ctrl)
        {
            _Ctrl = ctrl;
            ctrl.MouseDown += ctrl_MouseDown;
            ctrl.MouseMove += ctrl_MouseMove;
            ctrl.MouseUp += ctrl_MouseUp;
            ctrl.MouseWheel += ctrl_MouseWheel;
            ctrl.KeyDown += ctrl_KeyDown;

            _MouseX = 0; _MouseY = 0;

            _camera = camera;
        }
Ejemplo n.º 3
0
        protected override void _Render(DXCamera camera)
        {
            EffectTechnique technique = _shader.DXEffect.GetTechniqueByIndex(0);
            EffectPass usePass = technique.GetPassByIndex(0);

            for (int i = 0; i < 5; i++)
            {
                if (_vertexBuffer2[i] != null && Program.DXSceneOptions.LevelVisibility[i])
                {
                    DXContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(_vertexBuffer2[i], Marshal.SizeOf(typeof(DXSKV)), 0));
                    DXContext.InputAssembler.SetIndexBuffer(_indexBuffer2[i], Format.R32_UInt, 0);
                    DXContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.LineList;
                    DXContext.InputAssembler.InputLayout = _inputLayout;

                    _shader.SetParameter("worldMatrix", Matrix.Identity);
                    _shader.SetParameter("viewMatrix", camera.ViewMatrix);
                    _shader.SetParameter("projectionMatrix", camera.ProjMatrix);
                    _shader.SetParameter("vp", camera.ViewMatrix * camera.ProjMatrix);

                    usePass.Apply(DXContext);

                    DXContext.DrawIndexed(IndexCount2[i], 0, 0);
                }
            }

            technique.Dispose();
            usePass.Dispose();
        }
Ejemplo n.º 4
0
 // ctrl is the control hooked for events (mouse & keyboard)
 public DXOrbitControler(DXCamera camera, Control ctrl)
     : base(camera, ctrl)
 {
 }
Ejemplo n.º 5
0
 // ctrl is the control hooked for events (mouse & keyboard)
 public DXArcballControler(DXCamera camera, Control ctrl)
     : base(camera, ctrl)
 {
 }
Ejemplo n.º 6
0
 // ctrl is the control hooked for events (mouse & keyboard)
 public DXArcballControler(DXCamera camera, Control ctrl)
     : base(camera, ctrl)
 {
 }
Ejemplo n.º 7
0
 protected abstract void _Render(DXCamera camera);
Ejemplo n.º 8
0
 public void Render(DXCamera camera)
 {
     if(Visible) _Render(camera);
 }