[Opal-commits] opal/samples/src BoxObject.cpp,1.6,1.7 CarObject.cpp,1.19,1.20 SphereObject.cpp,1.5,1
Status: Inactive
Brought to you by:
tylerstreeter
|
From: tylerstreeter <tyl...@us...> - 2005-02-22 19:47:45
|
Update of /cvsroot/opal/opal/samples/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30562/samples/src Modified Files: BoxObject.cpp CarObject.cpp SphereObject.cpp Log Message: made Data object types a private member; updated samples with new changes Index: CarObject.cpp =================================================================== RCS file: /cvsroot/opal/opal/samples/src/CarObject.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** CarObject.cpp 19 Feb 2005 20:54:35 -0000 1.19 --- CarObject.cpp 22 Feb 2005 19:46:26 -0000 1.20 *************** *** 10,22 **** //opal::Space* space = sim->createSpace(); mBody = sim->createSolid(); mBody->setTransform(transform); //mBody->internal_updateEngineTransform(); ! //calculate body dimensions ! mBodyDimensions.set((opal::real)(2.5 * size), (opal::real)(0.3 * size), (opal::real)(4.0 * size)); ! mBody->addBox(mBodyDimensions, opal::Matrix44r(), ! opal::globals::metalMaterial); //calculate wheel radius --- 10,27 ---- //opal::Space* space = sim->createSpace(); + // Create a Solid for the car body. mBody = sim->createSolid(); mBody->setTransform(transform); //mBody->internal_updateEngineTransform(); ! // Calculate body dimensions. ! mBodyDimensions.set((opal::real)(2.5 * size), (opal::real)(0.4 * size), (opal::real)(4.0 * size)); ! ! // Add a box Shape to the car body Solid. ! opal::BoxShapeData boxData; ! boxData.material = opal::globals::metalMaterial; ! boxData.dimensions = mBodyDimensions; ! mBody->addShape(boxData); //calculate wheel radius *************** *** 53,56 **** --- 58,66 ---- jd.axis[1] = wheelAxis; + // Setup a SphereData object to reuse for the wheels. + opal::SphereShapeData wheelData; + wheelData.material = opal::globals::rubberMaterial; + wheelData.radius = mWheelRadius; + // Add front left wheel Solid. opal::Matrix44r M = transform; *************** *** 58,63 **** mFLWheel = sim->createSolid(); mFLWheel->setTransform(M); ! mFLWheel->addSphere(mWheelRadius, opal::Matrix44r(), ! opal::globals::rubberMaterial); // Add front left Joint. --- 68,72 ---- mFLWheel = sim->createSolid(); mFLWheel->setTransform(M); ! mFLWheel->addShape(wheelData); // Add front left Joint. *************** *** 73,78 **** mFRWheel = sim->createSolid(); mFRWheel->setTransform(M); ! mFRWheel->addSphere(mWheelRadius, opal::Matrix44r(), ! opal::globals::rubberMaterial); // Add front right Joint. --- 82,86 ---- mFRWheel = sim->createSolid(); mFRWheel->setTransform(M); ! mFRWheel->addShape(wheelData); // Add front right Joint. *************** *** 88,93 **** mRLWheel = sim->createSolid(); mRLWheel->setTransform(M); ! mRLWheel->addSphere(mWheelRadius, opal::Matrix44r(), ! opal::globals::rubberMaterial); // Add rear left Joint. --- 96,100 ---- mRLWheel = sim->createSolid(); mRLWheel->setTransform(M); ! mRLWheel->addShape(wheelData); // Add rear left Joint. *************** *** 104,109 **** mRRWheel = sim->createSolid(); mRRWheel->setTransform(M); ! mRRWheel->addSphere(mWheelRadius, opal::Matrix44r(), ! opal::globals::rubberMaterial); // Add rear right Joint. --- 111,115 ---- mRRWheel = sim->createSolid(); mRRWheel->setTransform(M); ! mRRWheel->addShape(wheelData); // Add rear right Joint. *************** *** 130,138 **** mFLMotor->init(mFLJoint, 1); mFLMotor->setMaxTorque(15); ! mFLMotor->setMaxVelocity(4000); mFRMotor = sim->createGearedMotor(); mFRMotor->init(mFRJoint, 1); mFRMotor->setMaxTorque(15); ! mFRMotor->setMaxVelocity(4000); //mBody->setTransform(transform); --- 136,144 ---- mFLMotor->init(mFLJoint, 1); mFLMotor->setMaxTorque(15); ! mFLMotor->setMaxVelocity(5000); mFRMotor = sim->createGearedMotor(); mFRMotor->init(mFRJoint, 1); mFRMotor->setMaxTorque(15); ! mFRMotor->setMaxVelocity(5000); //mBody->setTransform(transform); Index: BoxObject.cpp =================================================================== RCS file: /cvsroot/opal/opal/samples/src/BoxObject.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BoxObject.cpp 19 Feb 2005 20:54:35 -0000 1.6 --- BoxObject.cpp 22 Feb 2005 19:46:23 -0000 1.7 *************** *** 7,14 **** mSim = sim; mDimensions = size; mSolid = sim->createSolid(); mSolid->setStatic(isStatic); mSolid->setTransform(transform); ! mSolid->addBox(size, opal::Matrix44r(), material); } --- 7,21 ---- mSim = sim; mDimensions = size; + + // Create and setup the Solid. mSolid = sim->createSolid(); mSolid->setStatic(isStatic); mSolid->setTransform(transform); ! ! // Add a sphere Shape to the Solid. ! opal::BoxShapeData boxData; ! boxData.material = material; ! boxData.dimensions = size; ! mSolid->addShape(boxData); } Index: SphereObject.cpp =================================================================== RCS file: /cvsroot/opal/opal/samples/src/SphereObject.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SphereObject.cpp 19 Feb 2005 20:54:35 -0000 1.5 --- SphereObject.cpp 22 Feb 2005 19:46:29 -0000 1.6 *************** *** 7,14 **** mSim = sim; mRadius = radius; mSolid = sim->createSolid(); mSolid->setStatic(isStatic); mSolid->setTransform(transform); ! mSolid->addSphere(radius, opal::Matrix44r(), material); } --- 7,21 ---- mSim = sim; mRadius = radius; + + // Create and setup the Solid. mSolid = sim->createSolid(); mSolid->setStatic(isStatic); mSolid->setTransform(transform); ! ! // Add a sphere Shape to the Solid. ! opal::SphereShapeData sphereData; ! sphereData.material = material; ! sphereData.radius = radius; ! mSolid->addShape(sphereData); } |