public override void Render(RenderContext context)
        {
            if (!this.IsRendering)
            {
                return;
            }

            /// --- set context
            this.Device.ImmediateContext.InputAssembler.InputLayout       = this.vertexLayout;
            this.Device.ImmediateContext.InputAssembler.PrimitiveTopology = Direct3D.PrimitiveTopology.TriangleList;
            this.Device.ImmediateContext.InputAssembler.SetIndexBuffer(this.indexBuffer, Format.R32_UInt, 0);
            this.Device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(this.vertexBuffer, CubeVertex.SizeInBytes, 0));

            this.Device.ImmediateContext.Rasterizer.State = rasterState;
            this.Device.ImmediateContext.OutputMerger.DepthStencilState = depthStencilState;

            /// --- set constant paramerers
            var worldMatrix = Matrix.Translation(((PerspectiveCamera)context.Camera).Position.ToVector3());

            this.effectTransforms.mWorld.SetMatrix(ref worldMatrix);

            /// --- render the geometry
            this.effectTechnique.GetPassByIndex(0).Apply(Device.ImmediateContext);
            this.Device.ImmediateContext.DrawIndexed(this.geometry.Indices.Count, 0, 0);
        }
Example #2
0
 public static global::SharpDX.Matrix Inverted(this global::SharpDX.Matrix m)
 {
     m.Invert();
     return(m);
 }