|
From: Mike D. <o3d...@us...> - 2004-08-15 21:07:45
|
Update of /cvsroot/grappelmann/spaceplane In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25139 Modified Files: gravity.cpp mesh.cpp model_loader.cpp object3d.h transform.cpp transform.h Log Message: - added scale operation - debugging for transform Index: transform.cpp =================================================================== RCS file: /cvsroot/grappelmann/spaceplane/transform.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** transform.cpp 25 Jul 2004 10:37:12 -0000 1.1 --- transform.cpp 15 Aug 2004 21:07:35 -0000 1.2 *************** *** 15,18 **** --- 15,19 ---- m_rotation = rhs.m_rotation; m_rotationSize = rhs.m_rotationSize; + m_scale = rhs.m_scale; } *************** *** 23,26 **** --- 24,28 ---- m_translation = translation; + cout << "<Transform::_draw>\ttranslation x [" << m_translation.m_x << "] y [" << m_translation.m_y << "] z [" << m_translation.m_z << "]" << endl; return true; } *************** *** 33,42 **** } bool Transform::_draw() { cout << "<Transform::_draw>\trotation size [" << m_rotationSize << "] x [" << m_rotation.m_x << "] y [" << m_rotation.m_y << "] z [" << m_rotation.m_z << "]" << endl; cout << "<Transform::_draw>\ttranslation x [" << m_translation.m_x << "] y [" << m_translation.m_y << "] z [" << m_translation.m_z << "]" << endl; glRotatef(m_rotationSize, m_rotation.m_x, m_rotation.m_y, m_rotation.m_z); ! glTranslatef(m_translation.m_x, m_translation.m_y, m_translation.m_z); drawChildren(); --- 35,54 ---- } + bool Transform::setScale(Coord3D& scale) { + m_scale = scale; + + return true; + } + bool Transform::_draw() { + glMatrixMode(GL_MODELVIEW); + cout << "<Transform::_draw>\trotation size [" << m_rotationSize << "] x [" << m_rotation.m_x << "] y [" << m_rotation.m_y << "] z [" << m_rotation.m_z << "]" << endl; cout << "<Transform::_draw>\ttranslation x [" << m_translation.m_x << "] y [" << m_translation.m_y << "] z [" << m_translation.m_z << "]" << endl; + cout << "<Transform::_draw>\tscale x [" << m_scale.m_x << "] y [" << m_scale.m_y << "] z [" << m_scale.m_z << "]" << endl; glRotatef(m_rotationSize, m_rotation.m_x, m_rotation.m_y, m_rotation.m_z); ! //glTranslatef(m_translation.m_x, m_translation.m_y, m_translation.m_z); ! //glScalef(m_scale.m_x, m_scale.m_y, m_scale.m_z); drawChildren(); *************** *** 47,50 **** --- 59,66 ---- /* $Log$ + Revision 1.2 2004/08/15 21:07:35 o3dozone + - added scale operation + - debugging for transform + Revision 1.1 2004/07/25 10:37:12 o3dozone - added material and transform nodes Index: object3d.h =================================================================== RCS file: /cvsroot/grappelmann/spaceplane/object3d.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** object3d.h 23 Jul 2004 05:43:48 -0000 1.2 --- object3d.h 15 Aug 2004 21:07:35 -0000 1.3 *************** *** 13,18 **** class Object3D { public: ! Object3D(ModelDrawer* modelDrawer) ! : m_modelDrawer(modelDrawer) {}; --- 13,18 ---- class Object3D { public: ! Object3D(SceneObject* sceneObject) ! : m_sceneObject(sceneObject) {}; *************** *** 58,62 **** Coord3D m_velocity; Coord3D m_rotation; ! ModelDrawer* m_modelDrawer; double m_mass; }; --- 58,62 ---- Coord3D m_velocity; Coord3D m_rotation; ! SceneObject* m_sceneObject; double m_mass; }; Index: transform.h =================================================================== RCS file: /cvsroot/grappelmann/spaceplane/transform.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** transform.h 25 Jul 2004 10:37:12 -0000 1.1 --- transform.h 15 Aug 2004 21:07:35 -0000 1.2 *************** *** 20,23 **** --- 20,24 ---- bool setTranslation(Coord3D& translation); bool setRotation(Coord3D& rotation, double rotationSize); + bool setScale(Coord3D& scale); protected: virtual bool _draw(); *************** *** 25,28 **** --- 26,30 ---- Coord3D m_translation; Coord3D m_rotation; + Coord3D m_scale; double m_rotationSize; }; *************** *** 30,33 **** --- 32,39 ---- /* $Log$ + Revision 1.2 2004/08/15 21:07:35 o3dozone + - added scale operation + - debugging for transform + Revision 1.1 2004/07/25 10:37:12 o3dozone - added material and transform nodes Index: mesh.cpp =================================================================== RCS file: /cvsroot/grappelmann/spaceplane/mesh.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mesh.cpp 25 Jul 2004 10:35:59 -0000 1.4 --- mesh.cpp 15 Aug 2004 21:07:35 -0000 1.5 *************** *** 40,49 **** // then draw the children for(vector<Polygon>::iterator i = m_polygons.begin(); i != m_polygons.end(); i++) { (*i).draw(); } // draw any sub nodes ! drawChildren(); return true; --- 40,53 ---- // then draw the children + /* for(vector<Polygon>::iterator i = m_polygons.begin(); i != m_polygons.end(); i++) { (*i).draw(); } + */ + + glutSolidSphere(0.5, 10, 10); // draw any sub nodes ! //drawChildren(); return true; *************** *** 52,55 **** --- 56,63 ---- /* $Log$ + Revision 1.5 2004/08/15 21:07:35 o3dozone + - added scale operation + - debugging for transform + Revision 1.4 2004/07/25 10:35:59 o3dozone - added material and transform nodes Index: model_loader.cpp =================================================================== RCS file: /cvsroot/grappelmann/spaceplane/model_loader.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** model_loader.cpp 8 Aug 2004 13:26:13 -0000 1.5 --- model_loader.cpp 15 Aug 2004 21:07:35 -0000 1.6 *************** *** 264,269 **** --- 264,271 ---- double rotationSize = 0; Coord3D translation; + Coord3D scale; vector<double> rotationElements; vector<double> translationElements; + vector<double> scaleElements; // get the attributes (containing the coord/normal indexes) *************** *** 284,289 **** --- 286,299 ---- } + // get the scale + DOMNode* scaleNode = attributes->getNamedItem(XMLString::transcode("scale")); + if(scaleNode->getNodeValue() != NULL) { + cout << "scale [" << XMLString::transcode(scaleNode->getNodeValue()) << "]" << endl; + _convertCharToVector(scaleElements, XMLString::transcode(scaleNode->getNodeValue())); + } + assert(rotationElements.size() == 4); assert(translationElements.size() == 3); + assert(scaleElements.size() == 3); rotation.m_x = rotationElements[0]; *************** *** 299,302 **** --- 309,318 ---- cout << "translation x [" << translation.m_x << "] y [" << translation.m_y << "] z [" << translation.m_z << "]" << endl; + + scale.m_x = scaleElements[0]; + scale.m_y = scaleElements[1]; + scale.m_z = scaleElements[2]; + + cout << "scale x [" << scale.m_x << "] y [" << scale.m_y << "] z [" << scale.m_z << "]" << endl; } *************** *** 305,308 **** --- 321,325 ---- transform->setTranslation(translation); transform->setRotation(rotation, rotationSize); + transform->setScale(scale); return transform; *************** *** 502,506 **** piece = intString.substr(startPos, pieceLength); ! doubleVector.push_back(atoi(piece.c_str())); cout << "<X3DLoader::_convertCharToVector(double)>\tvector size [" << doubleVector.size() << "]" << endl; --- 519,523 ---- piece = intString.substr(startPos, pieceLength); ! doubleVector.push_back(atof(piece.c_str())); cout << "<X3DLoader::_convertCharToVector(double)>\tvector size [" << doubleVector.size() << "]" << endl; *************** *** 511,514 **** --- 528,535 ---- /* $Log$ + Revision 1.6 2004/08/15 21:07:35 o3dozone + - added scale operation + - debugging for transform + Revision 1.5 2004/08/08 13:26:13 o3dozone - now loads x3d files Index: gravity.cpp =================================================================== RCS file: /cvsroot/grappelmann/spaceplane/gravity.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** gravity.cpp 25 Jul 2004 10:35:59 -0000 1.5 --- gravity.cpp 15 Aug 2004 21:07:34 -0000 1.6 *************** *** 346,356 **** //long objectCount = 0; - /* for(; objectCount < MAX_OBJECTARRAY_SIZE; objectCount++) { ! objectArray.push_back(&monkeyDrawer); } - */ ! /* // randomise the object's initial position if(!randomiseObjects(objectArray, objectCount)) { --- 346,354 ---- //long objectCount = 0; for(; objectCount < MAX_OBJECTARRAY_SIZE; objectCount++) { ! objectArray.push_back(slugMobile); } ! // randomise the object's initial position if(!randomiseObjects(objectArray, objectCount)) { *************** *** 358,363 **** exit(-1); } ! */ ! /* // disable mouse display --- 356,360 ---- exit(-1); } ! /* // disable mouse display *************** *** 391,400 **** } - /* if(!updateObjects(objectArray, objectCount, SystemStateSingleton::instance().tickDiff)) { printf("Couldn't update objects\n"); exit(-1); } - */ reshape_screen(0, 0, renderState.screenWidth(), renderState.screenHeight()); --- 388,395 ---- *************** *** 421,426 **** glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient_light); glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_FALSE); ! glMatrixMode( GL_MODELVIEW ); ! glLoadIdentity( ); glColor3f(0.2, 0.2, 0.2); --- 416,421 ---- glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient_light); glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_FALSE); ! glMatrixMode( GL_MODELVIEW ); ! glLoadIdentity( ); glColor3f(0.2, 0.2, 0.2); *************** *** 486,489 **** --- 481,488 ---- /* $Log$ + Revision 1.6 2004/08/15 21:07:34 o3dozone + - added scale operation + - debugging for transform + Revision 1.5 2004/07/25 10:35:59 o3dozone - added material and transform nodes |