How I do get the bounds of a geometric priminitive?
WindowsNT opened this issue · comments
MICHAEL CHOURDAKIS commented
The model
class has a list of meshes which have the bounding sphere and bounding box.
Would it be possible to do the same for the geometric priminitives?
Or, should I calculate them myself depending on the parameters passed to the constructors of the e.g. cube?
Chuck Walbourn commented
The assumption for most geo-prims is that you can just create a matching bounding volume from the same parameters.
If you need tighter bounds (like an oriented bounding box), you could use the custom geometry instructions in the wiki to create a bounding volume at runtime:
std::vector<VertexPositionNormalTexture> vertices;
std::vector<uint16_t> indices;
GeometricPrimitive::CreateBox( vertices, indices,
XMFLOAT3(1.f/2.f, 2.f/2.f, 3.f/2.f) );
// Create bounding volume from vertices data
boxWithBounds = GeometricPrimitive::CreateCustom( deviceContext, vertices, indices ) );