Mojo.DebugRenderer.RenderLine C# (CSharp) Method

RenderLine() public method

public RenderLine ( DeviceContext deviceContext, System.Vector3 p1, System.Vector3 p2, System.Vector3 color, Camera camera ) : void
deviceContext DeviceContext
p1 System.Vector3
p2 System.Vector3
color System.Vector3
camera Camera
return void
        public void RenderLine( DeviceContext deviceContext, Vector3 p1, Vector3 p2, Vector3 color, Camera camera )
        {
            var databox = deviceContext.MapSubresource( mPositionVertexBuffer,
                                                        0,
                                                        LINE_NUM_VERTICES *
                                                        POSITION_NUM_COMPONENTS_PER_VERTEX *
                                                        POSITION_NUM_BYTES_PER_COMPONENT,
                                                        MapMode.WriteDiscard,
                                                        SlimDX.Direct3D11.MapFlags.None );

            databox.Data.Write( p1 );
            databox.Data.Write( p2 );

            deviceContext.UnmapSubresource( mPositionVertexBuffer, 0 );

            deviceContext.InputAssembler.InputLayout = mRenderWireframeInputLayout;
            deviceContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.LineStrip;
            deviceContext.InputAssembler.SetVertexBuffers( POSITION_SLOT,
                                                           new VertexBufferBinding( mPositionVertexBuffer,
                                                                                    POSITION_NUM_COMPONENTS_PER_VERTEX *
                                                                                    POSITION_NUM_BYTES_PER_COMPONENT,
                                                                                    0 ) );

            mEffect.GetVariableByName( "gColor" ).AsVector().Set( color );
            mEffect.GetVariableByName( "gTransform" ).AsMatrix().SetMatrix( camera.GetLookAtMatrix() * camera.GetProjectionMatrix() );
            mRenderWireframePass.Apply( deviceContext );

            deviceContext.Draw( LINE_NUM_VERTICES, 0 );
        }