|
From: <tia...@sa...> - 2006-02-16 17:19:39
|
Thanks for the replies.
I'm continuing the work and i've already used the f-16 HUD as a texture
target with sucess, but i have some questions regarding the correctness
of the methods i'm using:
1)
right now it's usage is like this:
<animation>
<type>rttflat</type>
<object>sphere</object>
<target>hud.rgb</target>
</animation>
sphere is the object to be rendered and hud.rgb is the texture that will
be replaced by the generated one
to find the target, i'm going using:
ssgEntity * root = _branch;
while(root->getNumParents()!=0) root = root->getParent(0);
and then searching the branchs for the target texture.
This is because i think it would be nicer for the aircraft makers to
have the target anywhere, and not necessarily in the branch.
2)
the rendering is done "by hand" like this:
void RTTFlatAnim::drawBranch(ssgEntity *node)
{
if(node->isAKindOf(ssgTypeLeaf()))
{
((ssgLeaf*)node)->draw();
glLoadIdentity();
return;
}
if(node->isAKindOf(ssgTypeTransform()))
{
sgMat4 mat;
((ssgTransform*)node)->getTransform(mat);
glMultMatrixf((float*)mat);
}
int nKids = node->getNumKids();
for (int i = 0; i < nKids; i++)
{
((ssgLeaf*)((ssgBranch*)node)->getKid(i))->draw();
drawBranch(((ssgBranch*)node)->getKid(i));
}
}
i'm afraid this could be a problem because i want all other animations
to be respected for rendering to texture.
I thought about using callbacks, but i'm a little confused.
Any help/ideas are welcome :)
Cheers,
Tiago
|