Graphics Reference
In-Depth Information
/* Vertex Position Vertex Color */
new Vector4(-1f,0f,0f,1f),(Vector4)Color.Red, // - x-axis
new Vector4(1f,0f,0f,1f), (Vector4)Color.Red, // + x-axis
new Vector4(0.9f,-0.05f,0f,1f),(Vector4)Color.Red,//head start
new Vector4(1f,0f,0f,1f), (Vector4)Color.Red,
new Vector4(0.9f,0.05f,0f,1f), (Vector4)Color.Red,
new Vector4(1f,0f,0f,1f), (Vector4)Color.Red, // head end
new Vector4(0f,-1f,0f,1f), (Vector4)Color.Lime, // - y-axis
new Vector4(0f,1f,0f,1f), (Vector4)Color.Lime, // + y-axis
new Vector4(-0.05f,0.9f,0f,1f),(Vector4)Color.Lime,//head start
new Vector4(0f,1f,0f,1f), (Vector4)Color.Lime,
new Vector4(0.05f,0.9f,0f,1f), (Vector4)Color.Lime,
new Vector4(0f,1f,0f,1f), (Vector4)Color.Lime, // head end
new Vector4(0f,0f,-1f,1f), (Vector4)Color.Blue, // - z-axis
new Vector4(0f,0f,1f,1f), (Vector4)Color.Blue, // + z-axis
new Vector4(0f,-0.05f,0.9f,1f),(Vector4)Color.Blue,//head start
new Vector4(0f,0f,1f,1f), (Vector4)Color.Blue,
new Vector4(0f,0.05f,0.9f,1f), (Vector4)Color.Blue,
new Vector4(0f,0f,1f,1f), (Vector4)Color.Blue, // head end
}));
axisLinesBinding = new VertexBufferBinding(axisLinesVertices,
Utilities.SizeOf<Vector4>() * 2 , 0);
22. The axis lines drawing logic is made up of the following code which belongs to
DoRender . This sets the topology to be used, passes the vertex buffer to the IA
stage, and requests the pipeline to draw the 18 vertices we just defined.
// Get the context reference
var context = this.DeviceManager.Direct3DContext;
// Render the Axis lines
// Tell the IA we are using lines
context.InputAssembler.PrimitiveTopology = SharpDX.Direct3D.
PrimitiveTopology.LineList;
// Pass in the line vertices
context.InputAssembler.SetVertexBuffers(0, axisLinesBinding);
// Draw the 18 vertices or our xyz-axis arrows
context.Draw(18, 0);
 
Search WWH ::




Custom Search