Generalized Geometry Handling

Published September 22, 2012
Advertisement
Over the past few commits to the Hieroglyph 3 repository, I have been building up some generalized geometry classes in an effort to make working with customized pipeline input forms easier. This has resulting in a few classes that specialize the PipelineExecutorDX11 class, which is responsible for configuring the Input Assembler and then performing an appropriate draw call that will use that IA setup. These subclasses include ImmediateGeometryDX11, IndexedImmediateGeometryDX11, and InstancedQuadGeometryDX11.

The basic usage paradigm is to add a 'vertex' to the class, which then gets automatically loaded into a vertex buffer later on. In reality, the vertices are added to a system memory buffer first, and then the contents of the buffer are uploaded later on. Overall, this makes it pretty easy to draw any number of shapes via algorithmic drawing. ImmediateGeometryDX11 uses simple vertex buffers, and executes the pipeline with an ID3D11DeviceContext::Draw call. IndexedImmediateGeometryDX11 adds the same ability, but also includes the use of indices (and of course an indexed draw call). Finally the Instanced variant uses two vertex buffers (one for per-vertex data, one for per-instance data) and an index buffer.

The advantage to these types of methods are that you don't have to plan ahead as much - you don't need to worry about how big of an array you need, or anything like that. It is much simpler to just throw down some code and get the geometry up on the screen.

These various classes let me build up a few routines for drawing different basic shapes, as seen in the following images:

ImmediateRenderer100002.png
ImmediateRenderer100001.png

After building some methods for drawing these basic shapes (cylinders, cones, and spheres), I could build higher level constructs like arrows, axis markes, or even larger structures such as these images from a work project:

VSI Test Bed100001.png
VSI Test Bed100002.png
VSI Test Bed100003.png

Overall I am quite happy with the results so far, and I will be adding more shapes in the coming few commits. The trend toward simplified usage geometry will continue for certain!
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement