[Opal-commits] opal/samples/src CapsuleObject.cpp,NONE,1.1 CapsuleObject.h,NONE,1.1 Base3DObject.h,1
Status: Inactive
Brought to you by:
tylerstreeter
Update of /cvsroot/opal/opal/samples/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21242/samples/src Modified Files: Base3DObject.h BoxObject.cpp BoxObject.h CarObject.cpp CarObject.h SphereObject.cpp SphereObject.h Added Files: CapsuleObject.cpp CapsuleObject.h Log Message: fixed bugs in xml blueprint loading; added ragdoll xml file to sample app --- NEW FILE: CapsuleObject.h --- #ifndef OPAL_SAMPLES_CAPSULE_OBJECT_H #define OPAL_SAMPLES_CAPSULE_OBJECT_H #include "Base3DObject.h" class CapsuleObject : public Base3DObject { public: CapsuleObject(opal::Simulator* sim, opal::Solid* s, opal::real radius, opal::real length); ~CapsuleObject(); virtual void Draw(); virtual opal::Solid* getSolid(); private: opal::real mRadius; opal::real mLength; opal::Solid* mSolid; opal::Simulator* mSim; }; #endif Index: Base3DObject.h =================================================================== RCS file: /cvsroot/opal/opal/samples/src/Base3DObject.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Base3DObject.h 9 Feb 2005 07:12:45 -0000 1.7 --- Base3DObject.h 1 Mar 2005 05:04:20 -0000 1.8 *************** *** 1,4 **** ! #ifndef __BASE_3D_OBJECT_H__ ! #define __BASE_3D_OBJECT_H__ #include <math.h> --- 1,4 ---- ! #ifndef OPAL_SAMPLES_BASE_3D_OBJECT_H ! #define OPAL_SAMPLES_BASE_3D_OBJECT_H #include <math.h> Index: BoxObject.h =================================================================== RCS file: /cvsroot/opal/opal/samples/src/BoxObject.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BoxObject.h 9 Feb 2005 07:12:45 -0000 1.3 --- BoxObject.h 1 Mar 2005 05:04:20 -0000 1.4 *************** *** 1,4 **** ! #ifndef __BOXOBJECT_H__ ! #define __BOXOBJECT_H__ #include "Base3DObject.h" --- 1,4 ---- ! #ifndef OPAL_SAMPLES_BOX_OBJECT_H ! #define OPAL_SAMPLES_BOX_OBJECT_H #include "Base3DObject.h" *************** *** 7,13 **** { public: ! BoxObject(opal::Simulator* sim, bool isStatic, opal::Vec3r size, ! opal::Material material=opal::defaults::material, ! opal::Matrix44r transform=opal::Matrix44r()); ~BoxObject(); --- 7,11 ---- { public: ! BoxObject(opal::Simulator* sim, opal::Solid* s, opal::Vec3r size); ~BoxObject(); *************** *** 15,20 **** virtual void Draw(); - virtual void setSleeping(bool sleeping); - virtual opal::Solid* getSolid(); --- 13,16 ---- Index: CarObject.cpp =================================================================== RCS file: /cvsroot/opal/opal/samples/src/CarObject.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** CarObject.cpp 26 Feb 2005 10:22:23 -0000 1.22 --- CarObject.cpp 1 Mar 2005 05:04:20 -0000 1.23 *************** *** 8,17 **** mSim = sim; - //opal::Space* space = sim->createSpace(); // Create a Solid for the car body. mBody = sim->createSolid(); mBody->setTransform(transform); - //mBody->internal_updateEngineTransform(); // Calculate body dimensions. --- 8,15 ---- Index: SphereObject.h =================================================================== RCS file: /cvsroot/opal/opal/samples/src/SphereObject.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SphereObject.h 9 Feb 2005 07:12:45 -0000 1.3 --- SphereObject.h 1 Mar 2005 05:04:21 -0000 1.4 *************** *** 1,4 **** ! #ifndef __SPHEREOBJECT_H__ ! #define __SPHEREOBJECT_H__ #include "Base3DObject.h" --- 1,4 ---- ! #ifndef OPAL_SAMPLES_SPHERE_OBJECT_H ! #define OPAL_SAMPLES_SPHERE_OBJECT_H #include "Base3DObject.h" *************** *** 7,13 **** { public: ! SphereObject(opal::Simulator* sim, bool isStatic, opal::real radius, ! opal::Material material=opal::defaults::material, ! opal::Matrix44r transform=opal::Matrix44r()); ~SphereObject(); --- 7,11 ---- { public: ! SphereObject(opal::Simulator* sim, opal::Solid* s, opal::real radius); ~SphereObject(); Index: SphereObject.cpp =================================================================== RCS file: /cvsroot/opal/opal/samples/src/SphereObject.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SphereObject.cpp 22 Feb 2005 19:46:29 -0000 1.6 --- SphereObject.cpp 1 Mar 2005 05:04:21 -0000 1.7 *************** *** 1,21 **** #include "SphereObject.h" ! SphereObject::SphereObject(opal::Simulator* sim, bool isStatic, ! opal::real radius, opal::Material material, opal::Matrix44r transform) : Base3DObject() { ! 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); } --- 1,22 ---- #include "SphereObject.h" ! SphereObject::SphereObject(opal::Simulator* sim, opal::Solid* s, ! opal::real radius) : Base3DObject() { ! mSolid = s; mRadius = radius; + mSim = sim; ! //// 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); } --- NEW FILE: CapsuleObject.cpp --- #include "CapsuleObject.h" CapsuleObject::CapsuleObject(opal::Simulator* sim, opal::Solid* s, opal::real radius, opal::real length) : Base3DObject() { mSolid = s; mRadius = radius; mLength = length; mSim = sim; } CapsuleObject::~CapsuleObject() { mSim->destroySolid(mSolid); } void CapsuleObject::Draw() { float matAmbientAndDiffuse[4] = {(float).6, (float).1, (float).1, (float)1}; if (mSolid->isSleeping()) { matAmbientAndDiffuse[0] = (float)0.3; matAmbientAndDiffuse[1] = (float)0.3; matAmbientAndDiffuse[2] = (float)0.9; matAmbientAndDiffuse[3] = (float)1.0; } glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, matAmbientAndDiffuse); glPushMatrix(); glMultMatrixf(mSolid->getTransform().getData()); glPushMatrix(); glTranslatef(0.0, 0.0, -mLength * (opal::real)0.5); gluCylinder(mQuadric, mRadius, mRadius, mLength, 20, 20); glPopMatrix(); glPushMatrix(); glTranslatef(0.0, 0.0, mLength * (opal::real)0.5); gluSphere(mQuadric, mRadius, 20, 20); glPopMatrix(); glPushMatrix(); glTranslatef(0.0, 0.0, -mLength * (opal::real)0.5); gluSphere(mQuadric, mRadius, 20, 20); glPopMatrix(); glPopMatrix(); } opal::Solid* CapsuleObject::getSolid() { return mSolid; } Index: CarObject.h =================================================================== RCS file: /cvsroot/opal/opal/samples/src/CarObject.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** CarObject.h 16 Feb 2005 21:22:36 -0000 1.12 --- CarObject.h 1 Mar 2005 05:04:21 -0000 1.13 *************** *** 1,4 **** ! #ifndef __CAROBJECT_H__ ! #define __CAROBJECT_H__ #include "Base3DObject.h" --- 1,4 ---- ! #ifndef OPAL_SAMPLES_CAR_OBJECT_H ! #define OPAL_SAMPLES_CAR_OBJECT_H #include "Base3DObject.h" Index: BoxObject.cpp =================================================================== RCS file: /cvsroot/opal/opal/samples/src/BoxObject.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** BoxObject.cpp 22 Feb 2005 19:46:23 -0000 1.7 --- BoxObject.cpp 1 Mar 2005 05:04:20 -0000 1.8 *************** *** 1,21 **** #include "BoxObject.h" ! BoxObject::BoxObject(opal::Simulator* sim, bool isStatic, opal::Vec3r size, ! opal::Material material, opal::Matrix44r transform) : Base3DObject() { 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); } --- 1,11 ---- #include "BoxObject.h" ! BoxObject::BoxObject(opal::Simulator* sim, opal::Solid* s, ! opal::Vec3r dimensions) : Base3DObject() { + mSolid = s; + mDimensions = dimensions; mSim = sim; } *************** *** 45,53 **** } - void BoxObject::setSleeping(bool sleeping) - { - mSolid->setSleeping(sleeping); - } - opal::Solid* BoxObject::getSolid() { --- 35,38 ---- |