Game Development Community

Why does this work - it shouldn't!

by Dave Calabrese · in Torque Game Engine · 02/03/2005 (10:54 am) · 4 replies

I keep looking through the Torque source and finding undeclared variables and functions being used... here's an example:

void Item::renderImage(SceneState* state, SceneRenderImage* image)
{
   // Client side rotation
   if (mRotate) {
      F32 t = Sim::getCurrentTime() * F32(1)/1000;
      F32 r = (t / sRotationSpeed) * M_2PI;
      Point3F pos;
      mRenderObjToWorld.getColumn(3,&pos);
      MatrixF mat = mRenderObjToWorld;
      mat.set(Point3F(0,0,r));
      mat.setColumn(3,pos);
      Parent::setRenderTransform(mat);
   }
   Parent::renderImage(state, image);

   if (mShadow)
   {
      mShadow->setMoving(!mAtRest);
      mShadow->setAnimating(!mAtRest && !mRotate);
   }
}

Looking around, I cannot find anywhere - even with a full project search - that mRenderObjToWorld is declared... same with pos. When I try doing this in my own program, it just complains that neither of those 2 are declared.

So they are not being declared, they aren't in any header files, and they are only being used - but whenever I put them in my program, it causes errors.

What am I missing here? Is Eclipse not finding where they are declared when I do a full project search for mRenderObjToWorld?

#1
02/03/2005 (11:00 am)
Dave,

I am by no means an expert, but when I did a search, I found:

C:\TORQUE\ENGINE\sim\sceneObject.h(669): MatrixF mRenderObjToWorld; ///< Render matrix to transform object space to world space

HIH.

Edit: I'm using VC++
#2
02/03/2005 (11:01 am)
They are member variables of the SceneObject Class.

sim\sceneObject.h(347): const MatrixF& getRenderTransform() const { return mRenderObjToWorld; }
sim\sceneObject.h(662): MatrixF mRenderObjToWorld; ///< Render matrix to transform object space to world space

Sascha
#3
02/03/2005 (11:03 am)
I found mRenderObjToWorld in SceneObject.h, and setup in SceneObject.cc. Whats the trouble with pos? It's declared right there...
#4
02/03/2005 (11:08 am)
Wow... my apologies... you guys are right.

This is definitly proof I need to get away from my computer more than once a month! ;)


Thanks anyway.