• entries
    316
  • comments
    485
  • views
    321355

Generalized Geometry Handling

Sign in to follow this  
Jason Z

1324 views

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!
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now