Snatching path rendering from Editor
by Nathan Bowhay - ESAL · in Torque Game Engine · 09/01/2006 (8:24 am) · 2 replies
I need help snatching the path rendering from the editor and adding it to the play mode. Could anyone tell me where this is done. I need both the nodes and the path (Spline? The green arrows) rendering code.
The nodes are objects that always exist so, I should be able to take that code and move it into a spot were it will be rendered in game play or call on the render functions.
Note: I am using the RTS kit that is updated to v1.4.
I found this:
void RTSPathDebug::renderObject(SceneState *state, SceneRenderImage *image)
{
glBegin(GL_LINE);
// DRAW US A PATH OMG!!!!!!!!
for(S32 i=0; i
{
glColor3fv(mNodes[i].mColor);
glVertex3fv(mNodes[i].mPos);
}
glEnd();
}
in rtsPathDebug
The code above it says that it is render all the time so I am confused. Hopefully someone knows how this is done.
I also was wondering how I might go about changing both the node and path images.
I see from:
if (state->isObjectRendered(this)) {
SceneRenderImage* image = new SceneRenderImage;
image->obj = this;
state->insertRenderImage(image);
}
how it is done, but I don't completely understand torque inheritance. Oh and the last part is from simPath.cc
Thank you for any help that anyone can give
Nathan
The nodes are objects that always exist so, I should be able to take that code and move it into a spot were it will be rendered in game play or call on the render functions.
Note: I am using the RTS kit that is updated to v1.4.
I found this:
void RTSPathDebug::renderObject(SceneState *state, SceneRenderImage *image)
{
glBegin(GL_LINE);
// DRAW US A PATH OMG!!!!!!!!
for(S32 i=0; i
glColor3fv(mNodes[i].mColor);
glVertex3fv(mNodes[i].mPos);
}
glEnd();
}
in rtsPathDebug
The code above it says that it is render all the time so I am confused. Hopefully someone knows how this is done.
I also was wondering how I might go about changing both the node and path images.
I see from:
if (state->isObjectRendered(this)) {
SceneRenderImage* image = new SceneRenderImage;
image->obj = this;
state->insertRenderImage(image);
}
how it is done, but I don't completely understand torque inheritance. Oh and the last part is from simPath.cc
Thank you for any help that anyone can give
Nathan
Torque 3D Owner Randy Condon
Default Studio Name
WorldEditor::renderSplinePath(Path *path)
You'll need to dig around a little to really see how it all works.
It's using the cameraSpline functions value() and advanceDist();
It also uses a Catmull-Rom Spline for the generation of the curve. (I'll let you google that one up for the details + look at function mCatmullrom())