Hello all,
I am struggling with a rotation of a geometry in a scene based on the MeshViewer class given from the SDK (Sample 6). I added a member TransformObj m_transform and initialize it after initializing the whole scene, to make sure that the acceleration structure and the geometrygroup + geometry is set properly. Like follows:
void MeshViewer::initTransform()
{
m_transform = m_context->createTransform();
m_transform->setChild(m_geometry_group);
const float alpha = 0.785398163f;
// Rotation around (world) x-axis
float m[16] = { sinf(alpha),cosf(alpha),0,0,
-cosf(alpha),sinf(alpha),0,0,
0,0,1,0,
0,0,0,1 };
m_transform->setMatrix( false, m, NULL );
m_transform->validate();
}
This scene hierarchy should be valid right?
And everytime I press the key ‘x’, the geometry should rotate around the x-axis a bit by doing so:
bool MeshViewer::keyPressed(unsigned char key, int x, int y)
{
static float t = 0.0f;
float m[16];
switch (key)
{
case 'e': // ....
case 'E': // ....
case 'x':
t += 0.1;
m_transform->getMatrix(false,m,NULL);
float m[16] = { sinf(t),cosf(t),0,0,
-cosf(t),sinf(t),0,0,
0,0,1,0,
0,0,0,1 };
m_transform->setMatrix( false, m, NULL );
// mark dirty so that the acceleration structure gets refit
m_geometry_group->getAcceleration()->markDirty();
return true;
}
return false;
}
But somehow, i don’t notice any changes. Of course, the matrix of the transform node changes, but that’s it, the acceleration structure is marked dirty in order to refit but doesn’t do anything.
Did I miss something considering the scene hierarchy?
I could do it the dirty way and read out the vertice and normal buffer and transform all vectors by myself, but this would probably kill the perfomance, wouldn’t it?
Here are some debug prints just in case if they are useful
child of geometry group: 1
accelaration datasize: 1671
accelaration builder: Sbvh
transform child type: 514 == RT_OBJECTTYPE_GEOMETRY_GROUP;
Thanks in advance!
Regards,
Daniel