Game Development Community

mSceneManager

by Anthony McCrary · in Torque Game Engine · 01/22/2003 (6:26 pm) · 4 replies

Hi, I am implementing some functionality and I need to use the Decal Manager to make it work properly. Below is how Player.cc does this:

mSceneManager->getCurrentDecalManager()->addDecal(rInfo.point, rot, Point3F(rInfo.normal),decal);

But, my class is a derivitave of the areaEditor class and I cannot for the life of me get access to the mSceneManager variable... or even find where it's defined.

Any suggestions?

#1
01/22/2003 (7:04 pm)
Defined in sim/sceneObject.h If you use Visual C++ you ought to learn to use the class view window and/or find in files. They work wonders for locating where something is defined in a large project like torque, took me all of 5 seconds to find it.
#2
01/22/2003 (7:29 pm)
Yes, I've found that already but that doesn't do me any good because it's protected.

I'm just looking for an explaination on how the player class uses it.

Thanks though! :)
#3
01/22/2003 (7:58 pm)
Here's my code:

Point2F pos = screenToWorld(Point2F(event.mousePoint.x, event.mousePoint.y));

   F32 height = 0.0f;

   TerrainBlock * terrain = dynamic_cast<TerrainBlock*>(Sim::findObject("Terrain"));
   if(terrain)
      if(terrain->isServerObject())
      {
         Point3F offset;
         terrain->getTransform().getColumn(3, &offset);
         pos -= Point2F(offset.x, offset.y);
         terrain->getHeight(pos, &height);
      }

   RayInfo rInfo;

   bool hit = gClientContainer.castRay(Point3F(pos.x, pos.y, height + 0.01f), Point3F(pos.x, pos.y, height - 2.0f ), TerrainObjectType | InteriorObjectType, &rInfo);

   DecalData *decal = new DecalData();

   StringTableEntry decalFileName = StringTable->insert("~/data/roads/testRoad");

   decal->textureName = decalFileName;
   decal->sizeX = 0.125;
   decal->sizeY = 0.25;
   
   SceneGraph* mSceneManager = terrain->getSceneManager();

   mSceneManager->getCurrentDecalManager()->addDecal(rInfo.point, Point3F(pos.x, pos.y, height), Point3F(rInfo.normal),decal);

	Con::printf("Trying..");

I added this function to SceneObject:

SceneGraph* SceneObject::getSceneManager()
{

	return mSceneManager;

}

But it crashes without an error every time I click on the map.

Thanks!
#4
01/22/2003 (8:32 pm)
I think I have an idea of what my problem is.. what is the proper way to create a datablock instance from C++?