Fixed some minor issues relative to the previous version on my blog:
- Removed BoundingBox and BoundingSphere from SimpleMath. These added minimal value
compared to the originals in DirectXMath, and caused issues due to having multiple
types with the same name in different namespaces.
- One of the Quaternion constructors had a typo.
- std::less for Matrix and Ray weren't defining a properly strict ordering.
- Ray::Intersects(Plane) was returning negative collision distance if the plane is
behind the ray origin. Changed this to report no collision, which is consistent
with the behavior of the other Ray intersection tests.
Also now set debug object names for all D3D resources (for PIX and debug layer leak reporting)
PrimitiveBatch is a helper for easily and efficiently drawing dynamically generated
geometry such as lines or trianges. It fills the same role as the legacy D3D9
APIs DrawPrimitiveUP and DrawIndexedPrimitiveUP. Dynamic submission is a highly
effective pattern for drawing procedural geometry, and convenient for debug
rendering, but is not nearly as efficient as static vertex buffers. Excessive
dynamic submission is a common source of performance problems in apps.
PrimitiveBatch manages the vertex and index buffers for you, using DISCARD and
NO_OVERWRITE hints to avoid stalling the GPU pipeline. It automatically merges
adjacent draw requests, so if you call DrawLine 100 times in a row, only a
single GPU draw call will be generated.
PrimitiveBatch is responsible for setting the vertex buffer, index buffer, and
primitive topology, then issuing the final draw call. Unlike the higher level
SpriteBatch helper, it does not provide shaders, set the input layout, or set
any state objects. PrimitiveBatch is often used in conjunction with BasicEffect
and the structures from VertexTypes.h, but it can work with any other shader or
vertex formats of your own.