Porting Laser to TGEA - Done
by James Laker (BurNinG) · in Torque Game Engine Advanced · 01/24/2007 (3:57 am) · 28 replies
Hey there.
Me again. I'm trying to port the Continious Laser resource over to TGEA. Now I know I should debug it... but thats a looong story (Only have Visual Studio 2005 at work atm).
I've managed to get it to compile without errors, and it does fire the laser. I can even see the laser for like a fraction of a second, and then it crashes. I
Im thinking its in the rendering code, and would like you to just glance through this and tell me if you see any errors ive made in the porting process:
Me again. I'm trying to port the Continious Laser resource over to TGEA. Now I know I should debug it... but thats a looong story (Only have Visual Studio 2005 at work atm).
I've managed to get it to compile without errors, and it does fire the laser. I can even see the laser for like a fraction of a second, and then it crashes. I
Im thinking its in the rendering code, and would like you to just glance through this and tell me if you see any errors ive made in the porting process:
void Laser::renderObject(SceneState* state, RenderInst *ri)
{
//AssertFatal(dglIsInCanonicalState(), "Error, GL not in canonical state on entry");
//RectI viewport;
//glMatrixMode(GL_PROJECTION);
//glPushMatrix();
//dglGetViewport(&viewport);
RectI viewport = GFX->getViewport();
MatrixF projection = GFX->getProjectionMatrix();
MatrixF world = GFX->getWorldMatrix();
MatrixF view = GFX->getViewMatrix();
//GFX->disableShaders();
state->setupBaseProjection();
// Uncomment this if this is a "simple" (non-zone managing) object
state->setupObjectProjection(this);
GFX->setProjectionMatrix(projection);
//prepModelView( state );
//glScalef( mDataBlock->scale.x, mDataBlock->scale.y, mDataBlock->scale.z );
if(mProjectileShape)
{
AssertFatal(mProjectileShape != NULL,
"Laser::renderObject: Error, projectile shape should always be present in renderObject");
mProjectileShape->selectCurrentDetail();
mProjectileShape->animate();
Point3F cameraOffset;
mObjToWorld.getColumn(3,&cameraOffset);
cameraOffset -= state->getCameraPosition();
F32 fogAmount = state->getHazeAndFog(cameraOffset.len(),cameraOffset.z);
if (mFadeValue == 1.0) {
mProjectileShape->setupFog(fogAmount, state->getFogColor());
} else {
mProjectileShape->setupFog(0.0, state->getFogColor());
mProjectileShape->setAlphaAlways(mFadeValue * (1.0 - fogAmount));
}
mProjectileShape->render();
}<---------------- GLUE --------------- >
#23
I am also curious about the last comment of added interpolation, I'd like to see how that was done as well.
02/09/2009 (5:43 pm)
Thank you for the file, I haven't got to look at it closely yet. I am also curious about the last comment of added interpolation, I'd like to see how that was done as well.
#24
02/09/2009 (11:38 pm)
Just so you guys know. I did find it. Will stick it up here when I get home - need some cleaning up though.
#26
03/15/2009 (4:20 am)
bump - did you manage to clean up the file James?
#27
03/16/2009 (12:37 am)
Sometime during the week. Hang in there :)
Torque 3D Owner Bruce Wallace
Thanks.