我使用的是NVIDIA的OptiX光线跟踪引擎。
我想知道如何在渲染过程中转换GeometryGroup (或其实例)的位置。
从示例中,我可以看到如何平移整个场景(使用中键)。但我想转换单个模型/几何图形组。
发布于 2012-12-03 03:10:28
我最终完成了这段代码,它翻译了第一个几何模型:
void updateObjectPos(float dX, float dY, float dZ)
{
// we have only one group - the main group whose childs are instances of Transform
// mainGroup is an instance of Group
Transform t = mainGroup->getChild<Transform>(0);
float m[16];
t->getMatrix(false, m, NULL);
m[3] += dX;
m[7] += dY;
m[11]+= dZ;
t->setMatrix(false, m, NULL);
// mark dirty so that the acceleration structure gets rebuilt
mainGroup->getAcceleration()->markDirty();
}https://stackoverflow.com/questions/13670489
复制相似问题