// FILE NAME: Demo_Load_Application.cxx // AUTHOR: Benjamin Goldstein // TIME: 10:10:00 // DATE: 11/09/99 // MODULE TYPE: Body // COPYRIGHT (C) 1999 by Benjamin Goldstein // CLASS DEFINITIONS: Class Demo_Load_Application //Always include TdGfxPfObject first because of a conflict between STL and //Performer #include #include #include #include #include Demo_Load_Application::Demo_Load_Application(int argc, char *argv[]) : TcApplication(argc, argv) { //All applications must call this before using anything created by a //factory (create) method config(); //Retrieve the navigation node from the TcGfxManager TcGfxComponent * comp = sceneManager->getGfxCompByName("NAVGRP"); //Set up an intersection mask for collision detection. 0x8 is used //by the default travel scheme. TdGfxPfTravAttributes travAtts(PFTRAV_ISECT, 0x8, PFTRAV_SELF | PFTRAV_IS_CACHE, PF_SET); //Set up a SCS node to scale the tandem cube //Note the three vectors are Scale, Rotation and Translation //Rotation is specified in terms of x,y,z not head pitch roll TdGfxPfSCSAdapter *pfAdapter = new TdGfxPfSCSAdapter(TcUtVector3f(3,3,3), TcUtVector3f(0,0,0), TcUtVector3f(0,0,0)); //Set the mask pfAdapter->setTravAttributes(travAtts); //Create a group to hold the SCS adapter //All TdGfxPfGroup's can maintain a recursive list of child TcGfxComponent nodes //Note the node is unloaded so we can aynchronously load the group. //See the loadGeometry call below. TdGfxPfGroup *objectGrp = new TdGfxPfGroup("Tandem_GRP", TcGfxComponent::UNLOADED, pfAdapter); //Create an object to hold the terrain //Note that it is given the unloaded property, and is async. //The mask is also given to each object. TdGfxPfObject *object1 = new TdGfxPfObject("terrain", TcGfxComponent::UNLOADED, TcGfxComponent::ASYNC, "terrain.iv" , travAtts); //Create an object to hold the cube TdGfxPfObject *object2 = new TdGfxPfObject("cube", TcGfxComponent::UNLOADED, TcGfxComponent::ASYNC, "tandemCube.iv" , travAtts); //Add each object to the group objectGrp->addChild(object1); objectGrp->addChild(object2); //Load the group asynchronously objectGrp->loadGeometry(TcGfxComponent::ASYNC); //Finally add the group the navigation node in the scene. comp->addChild(objectGrp); } Demo_Load_Application::~Demo_Load_Application() { }