WorldTransformation in hierarchy
Posted: Mon Oct 03, 2011 12:18 pm
Hello, I'm currently working on a more or less complex object hierarchy that manages rendering, physics and more. Now I run into a little problem and I'm sure there is a simple solution and I'm just unable to see it. We all know that we need a WorldTransformation matrix to draw 3D objects. So in my hierarchy I need an object that has something to render ( a model for example) and that is bound to a bepu object for it's physical behaviour. My first intention was to use the Entity class which seems to work fine if I have an Sphere ord Box for example. But what if I have a StaticMesh or and InstancedMesh. Well they do have a Worldtransformation too, but they are not inherited from the Entity class.
So my question is: what class or interface should I use for my object for it's physical behaviour. See the pseudo code above for a better illustration:
I want to replace the "Entity" class with an appropriate class or interface so that I can assign a Box, a Sphere, a StaticMesh or an InstancedMesh. Or is there an entity to replace the StaticMesh and/or the InstancedMesh?
So my question is: what class or interface should I use for my object for it's physical behaviour. See the pseudo code above for a better illustration:
Code: Select all
class BoundModelRenderer
{
Model Model{get;set;}
Entity BoundObject{get;set;}
void Draw()
{
Model.Draw(BoundObject.WorldTransformation)
}
}