void drawLefthand( WiiMote &wm ) { static arOBJRenderer obj; static bool init = false; if( !init ) { obj.readOBJ( "LeftHand.obj" ); init = true; } glPushMatrix(); glMultMatrixf( wm.getMatrix().v ); obj.draw(); glPopMatrix(); }
// start callback // Purposes: // - Register shared memory by adding transfer fields. This is to syncronize cluster-based // systems, hence we don't need to do this. But there's a few examples anyway. // - Set up navigation through the framework by specifying translation conditions, rotation // conditions, translation speed, and rotation speed. We provide a couple examples here. // - Initialize any global variables specific to your application. // Notes: // DO NOT initialize OpenGL here. The start callback is called before window creation. // Instead initialize OpenGL in the windowStartGL callback. bool start(arMasterSlaveFramework& framework, arSZGClient& client ) { theMrCreepyBook7.setMatrix(ar_translationMatrix(-3,4,-7)); objects.push_back(&theMrCreepyBook7); theMrBookshelf6.setMatrix(ar_translationMatrix(-3,3,-7)); objects.push_back(&theMrBookshelf6); theMrDungeonRoom5.setMatrix(ar_translationMatrix(0,4,-5)); objects.push_back(&theMrDungeonRoom5); // Register shared memory. Not needed for non-cluster-based systems. // framework.addTransferField(char* name, void* address, arDataType type, int numElements); vector<arInteractable*>::iterator i; for(i=objects.begin(); i != objects.end(); ++i) { Object* obj = ((Object*)(*i)); obj->loadedOBJ.normalizeModelSize(); ostringstream ostr; ostr << "objMatrix" << &i; arMatrix4 obM = obj->matrix; framework.addTransferField(ostr.str(), &obM, AR_FLOAT, 16); } // Set up navigation. // A traditional pointing technique using the joystick with left and right rotating the scene. // Translate along Z-axis (forwards/backwards) if joystick is pressed more than 20% along axis 1. framework.setNavTransCondition('z', AR_EVENT_AXIS, 1, 0.2); // Rotate around Y-axis (vertical) if joystick is pressed more than 20% along axis 0. //framework.setNavRotCondition('y', AR_EVENT_AXIS, 0, 0.2); //FOR ROTATE framework.setNavTransCondition('x', AR_EVENT_AXIS, 0, 0.2); //FOR STRAFING // Set translation speed to 5 feet/second. framework.setNavTransSpeed(5.0); // Set rotation speed to 30 degrees/second. framework.setNavRotSpeed(30.0); // Initialize application variables here. // Move object's to initial positions. // Create sound transform. soundTransformID = dsTransform("world", framework.getNavNodeName(), ar_scaleMatrix(1.0)); // Parameters are: // name - string name for sound // transformName - string name for dsTransform // loopType - 1 for continuous, -1 for one-time, 0 to stop // loudness - float from 0.0 (quiet) to 1.0 (max) // positionVector - vector position of sound origin // Create loop for click sound. clickSound = dsLoop("click", "world", "click.mp3", 0, 1.0, arVector3(0, 0, 0)); musicNotey.readOBJ("MusicNote.obj","data/obj"); // Return true if everything is initialized correctly. return true; }