Update of /cvsroot/playerstage/code/gazebo/server/bodies
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11506/bodies
Modified Files:
Tag: ogre
BaseGeom.cc BaseGeom.hh Body.cc Body.hh BoxGeom.cc
CylinderGeom.cc Geom.cc Geom.hh LightGeom.cc PlaneGeom.cc
SphereGeom.cc WheelGeom.cc
Log Message:
Updates to ogre integration
Index: SphereGeom.cc
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/bodies/SphereGeom.cc,v
retrieving revision 1.15.2.2
retrieving revision 1.15.2.3
diff -C2 -d -r1.15.2.2 -r1.15.2.3
*** SphereGeom.cc 15 Mar 2006 22:45:38 -0000 1.15.2.2
--- SphereGeom.cc 11 Aug 2006 00:29:46 -0000 1.15.2.3
***************
*** 25,29 ****
*/
- #include <GL/glu.h>
#include <Ogre.h>
--- 25,28 ----
***************
*** 47,56 ****
this->radius = radius;
! Ogre::Entity *ent =
this->ogreSceneNode->getCreator()->createEntity("Sphere", "sphere.mesh");
this->ogreSceneNode->attachObject(ent);
this->ogreSceneNode->setScale(radius,radius,radius);
this->ogreSceneNode->setPosition(0, radius, 0.0);
!
ent->setCastShadows(true);
--- 46,62 ----
this->radius = radius;
! // Get the sphere mesh
! Ogre::Entity *ent =
this->ogreSceneNode->getCreator()->createEntity(this->entityName,
"sphere.mesh");
+ // Attach the sphere to the scene node
this->ogreSceneNode->attachObject(ent);
+
+ // Set the size of the sphere
this->ogreSceneNode->setScale(radius,radius,radius);
+
+ // Set the position of the sphere
this->ogreSceneNode->setPosition(0, radius, 0.0);
!
! // Allow the sphere to cast shadows
ent->setCastShadows(true);
***************
*** 72,153 ****
void SphereGeom::Render(RenderOptions *opt)
{
- /* GLUquadricObj *quad;
- GLuint listId;
- RenderOptions listOpt;
-
- // Recover stored display list for this camera
- this->GetList(opt->cameraIndex, &listId, &listOpt);
-
- // See if the current display list is dirty
- this->dirty |= (listId == 0);
- this->dirty |= (opt->displayMaterials != listOpt.displayMaterials);
- this->dirty |= (opt->displayTextures != listOpt.displayTextures);
-
- // Generate the display list
- if (dirty)
- {
- if (listId == 0)
- listId = glGenLists(1);
- glNewList(listId, GL_COMPILE);
-
- // Set material properties
- if (opt->displayMaterials)
- {
- glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, this->colorAmbient);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, this->colorDiffuse);
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, this->colorSpecular);
- glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, this->shininess);
- }
-
- if (opt->displayTextures && this->textureImage)
- {
- // Set up textures
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
- // Build the mipmaps
- // Assume image data is *not* aligned
- glPixelStorei( GL_UNPACK_ALIGNMENT, 1);
- gluBuild2DMipmaps(GL_TEXTURE_2D, this->textureImage->components,
- this->textureImage->width, this->textureImage->height,
- this->textureImage->format, this->textureImage->type,
- this->textureImage->data);
-
- glEnable(GL_TEXTURE_2D);
-
- // Flip so textures get draw the right way up
- glMatrixMode(GL_TEXTURE);
- glPushMatrix();
- glScalef(1, -1, 0);
- }
-
- // Create the sphere
- quad = gluNewQuadric();
- gluQuadricTexture(quad, GL_TRUE);
- gluQuadricOrientation(quad, GLU_OUTSIDE);
- gluSphere(quad, this->radius, 32, 32);
- gluDeleteQuadric(quad);
-
- if (opt->displayTextures && this->textureImage)
- {
- // Restore texture matrix
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glDisable(GL_TEXTURE_2D);
- }
-
- // Store list options
- this->SetList(opt->cameraIndex, listId, *opt);
- glEndList();
- }
-
- // Call the display list
- if (listId)
- glCallList(listId);
-
- */
return;
}
--- 78,81 ----
Index: BoxGeom.cc
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/bodies/BoxGeom.cc,v
retrieving revision 1.20.2.2
retrieving revision 1.20.2.3
diff -C2 -d -r1.20.2.2 -r1.20.2.3
*** BoxGeom.cc 15 Mar 2006 22:45:38 -0000 1.20.2.2
--- BoxGeom.cc 11 Aug 2006 00:29:46 -0000 1.20.2.3
***************
*** 39,42 ****
--- 39,43 ----
: Geom( body, spaceId )
{
+ Ogre::Entity *ent;
dMass mass;
***************
*** 51,67 ****
this->SetGeom(dCreateBox( 0, xDim, yDim, zDim ), &mass, true );
! Ogre::Entity *ent = this->ogreSceneNode->getCreator()->createEntity("Box",
"unit_box.mesh");
this->ogreSceneNode->attachObject(ent);
this->ogreSceneNode->scale(xDim,yDim,zDim);
this->ogreSceneNode->translate(0,yDim,0);
ent->setCastShadows(true);
! Ogre::MaterialPtr mat= Ogre::MaterialManager::getSingleton().create("red",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
mat->setAmbient(1.0, 0.0, 0.0);
mat->setDiffuse(1.0, 0.0, 0.0, 1.0);
mat->setSpecular(0.5, 0.5, 0.5, 1.0);
-
ent->setMaterialName("red");
return;
--- 52,78 ----
this->SetGeom(dCreateBox( 0, xDim, yDim, zDim ), &mass, true );
! // Get the box mesh
! ent = this->ogreSceneNode->getCreator()->createEntity(this->entityName,
"cube.mesh");
!
! // Attach the box to the scene node
this->ogreSceneNode->attachObject(ent);
+
+ // Set the size of the box
this->ogreSceneNode->scale(xDim,yDim,zDim);
+
+ // Set the size of the box
+ // Set the position of the box
this->ogreSceneNode->translate(0,yDim,0);
+
+ // Allow the box to cast shadows
ent->setCastShadows(true);
! /* TESTING Ogre::MaterialPtr mat=
Ogre::MaterialManager::getSingleton().create("red",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
mat->setAmbient(1.0, 0.0, 0.0);
mat->setDiffuse(1.0, 0.0, 0.0, 1.0);
mat->setSpecular(0.5, 0.5, 0.5, 1.0);
ent->setMaterialName("red");
+ */
return;
***************
*** 76,199 ****
}
-
//////////////////////////////////////////////////////////////////////////////
// Default render routine
void BoxGeom::Render(RenderOptions *opt)
{
- int i;
-
- // Normals
- GLfloat n[6][3] =
- {
- {0, 0, -1}, {0, 0, +1},
- {0, -1, 0}, {0, +1, 0},
- {-1, 0, 0}, {+1, 0, 0}
- };
-
-
- // Vertices
- GLint faces[6][4] =
- {
- {3, 2, 1, 0}, {4, 5, 6, 7},
- {0, 1, 5, 4}, {2, 3, 7, 6},
- {3, 0, 4, 7}, {1, 2, 6, 5}
- };
-
-
- // Vertex values
- GLfloat v[8][3] =
- {
- {-1, -1, -1}, {+1, -1, -1}, {+1, +1, -1}, {-1, +1, -1},
- {-1, -1, +1}, {+1, -1, +1}, {+1, +1, +1}, {-1, +1, +1}
- };
-
- GLuint listId;
- RenderOptions listOpt;
-
- // Recover stored display list for this camera
- this->GetList(opt->cameraIndex, &listId, &listOpt);
-
- // See if the current display list is dirty
- this->dirty |= (listId == 0);
- this->dirty |= (opt->displayMaterials != listOpt.displayMaterials);
- this->dirty |= (opt->displayTextures != listOpt.displayTextures);
-
- // Generate the display list
- if (this->dirty)
- {
- if (listId == 0)
- listId = glGenLists(1);
- glNewList(listId, GL_COMPILE);
-
- // Set material properties
- if (opt->displayMaterials)
- {
- glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, this->colorAmbient);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, this->colorDiffuse);
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, this->colorSpecular);
- glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, this->shininess);
- }
-
- if (opt->displayTextures && this->textureImage)
- {
- // Set up textures
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
- // Build the mipmaps
- // Assume image data is *not* aligned
- glPixelStorei( GL_UNPACK_ALIGNMENT, 1);
- gluBuild2DMipmaps(GL_TEXTURE_2D, this->textureImage->components,
- this->textureImage->width, this->textureImage->height,
- this->textureImage->format, this->textureImage->type,
- this->textureImage->data);
-
- glEnable(GL_TEXTURE_2D);
- }
-
- // Compute the vertices
- for (i = 0; i < 8; i++)
- {
- v[i][0] *= this->sides[0] / 2;
- v[i][1] *= this->sides[1] / 2;
- v[i][2] *= this->sides[2] / 2;
- }
-
- // Draw the box
- for (i = 0; i < 6; i++)
- {
- glBegin(GL_QUADS);
- glNormal3fv(n[i]);
-
- glTexCoord2f(0, +1);
- glVertex3fv(&v[faces[i][0]][0]);
-
- glTexCoord2f(+1, +1);
- glVertex3fv(&v[faces[i][1]][0]);
-
- glTexCoord2f(+1, 0);
- glVertex3fv(&v[faces[i][2]][0]);
-
- glTexCoord2f(0, 0);
- glVertex3fv(&v[faces[i][3]][0]);
-
- glEnd();
- }
-
- if (opt->displayTextures && this->textureImage)
- glDisable(GL_TEXTURE_2D);
-
- // Store list options
- this->SetList(opt->cameraIndex, listId, *opt);
- glEndList();
- }
-
- // Call the display list
- if (listId)
- glCallList(listId);
-
return;
}
--- 87,94 ----
Index: Body.hh
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/bodies/Body.hh,v
retrieving revision 1.29.2.4
retrieving revision 1.29.2.5
diff -C2 -d -r1.29.2.4 -r1.29.2.5
*** Body.hh 7 Aug 2006 20:52:26 -0000 1.29.2.4
--- Body.hh 11 Aug 2006 00:29:46 -0000 1.29.2.5
***************
*** 54,57 ****
--- 54,59 ----
/// @brief Destructor
public: virtual ~Body();
+
+ public: void Update();
// Attach a geometry to this body
Index: BaseGeom.cc
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/bodies/BaseGeom.cc,v
retrieving revision 1.15.2.1
retrieving revision 1.15.2.2
diff -C2 -d -r1.15.2.1 -r1.15.2.2
*** BaseGeom.cc 15 Mar 2006 22:45:38 -0000 1.15.2.1
--- BaseGeom.cc 11 Aug 2006 00:29:46 -0000 1.15.2.2
***************
*** 26,29 ****
--- 26,30 ----
#include <assert.h>
+ #include <Ogre.h>
#include "Body.hh"
***************
*** 58,62 ****
// Create the contact parameters
this->contact = new ContactParams();
!
return;
}
--- 59,64 ----
// Create the contact parameters
this->contact = new ContactParams();
!
! this->entityName = new char[256];
return;
}
***************
*** 83,86 ****
--- 85,89 ----
assert(!this->geomId);
+
this->geomId = geomId;
this->transId = NULL;
***************
*** 113,116 ****
--- 116,120 ----
this->body->AttachGeom( (Geom*) this );
+ sprintf(this->entityName,"Entity[%d]",this->geomId);
return;
}
***************
*** 266,269 ****
--- 270,275 ----
this->body->UpdateCoM();
+ this->ogreSceneNode->setPosition(pose.pos.x, pose.pos.y, pose.pos.z);
+ this->ogreSceneNode->setOrientation(pose.rot.u,pose.rot.x, pose.rot.y,
pose.rot.z);
return;
}
Index: Body.cc
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/bodies/Body.cc,v
retrieving revision 1.35.2.2
retrieving revision 1.35.2.3
diff -C2 -d -r1.35.2.2 -r1.35.2.3
*** Body.cc 23 Feb 2006 23:21:20 -0000 1.35.2.2
--- Body.cc 11 Aug 2006 00:29:46 -0000 1.35.2.3
***************
*** 84,87 ****
--- 84,97 ----
}
+ void Body::Update()
+ {
+ GzPose pose = this->GetPose();
+
+ // Update the scene node
+ //this->ogreSceneNode->setPosition(pose.pos.x, pose.pos.y, pose.pos.z);
+ //
this->ogreSceneNode->setOrientation(pose.rot.u,pose.rot.x,pose.rot.y,pose.rot.z);
+
+ }
+
//////////////////////////////////////////////////////////////////////////////
// Attach a geometry to this body
***************
*** 284,288 ****
q[3] = pose.rot.z;
dBodySetQuaternion( this->bodyId, q);
!
return;
}
--- 294,302 ----
q[3] = pose.rot.z;
dBodySetQuaternion( this->bodyId, q);
!
! // Update the scene node
! this->ogreSceneNode->setPosition(pose.pos.x, pose.pos.y, pose.pos.z);
! this->ogreSceneNode->setOrientation(pose.rot.u,pose.rot.x, pose.rot.y,
pose.rot.z);
!
return;
}
Index: Geom.cc
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/bodies/Geom.cc,v
retrieving revision 1.45.2.1
retrieving revision 1.45.2.2
diff -C2 -d -r1.45.2.1 -r1.45.2.2
*** Geom.cc 15 Mar 2006 22:45:38 -0000 1.45.2.1
--- Geom.cc 11 Aug 2006 00:29:46 -0000 1.45.2.2
***************
*** 434,438 ****
void Geom::PreRender(RenderOptions *opt)
{
! GzPose pose;
GzVector pos;
GzQuatern rot;
--- 434,438 ----
void Geom::PreRender(RenderOptions *opt)
{
! /*GzPose pose;
GzVector pos;
GzQuatern rot;
***************
*** 456,459 ****
--- 456,460 ----
glRotatef(rot.u * 180 / M_PI, rot.x, rot.y, rot.z);
+ */
return;
}
***************
*** 472,479 ****
void Geom::PostRender(RenderOptions *opt)
{
!
this->dirty = false;
glPopName();
glPopMatrix();
return;
}
--- 473,481 ----
void Geom::PostRender(RenderOptions *opt)
{
! /*
this->dirty = false;
glPopName();
glPopMatrix();
+ */
return;
}
Index: BaseGeom.hh
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/bodies/BaseGeom.hh,v
retrieving revision 1.13.2.1
retrieving revision 1.13.2.2
diff -C2 -d -r1.13.2.1 -r1.13.2.2
*** BaseGeom.hh 15 Mar 2006 22:45:38 -0000 1.13.2.1
--- BaseGeom.hh 11 Aug 2006 00:29:46 -0000 1.13.2.2
***************
*** 34,37 ****
--- 34,41 ----
class ContactParams;
+ namespace Ogre
+ {
+ class SceneNode;
+ }
/// @brief Base class for GL-renderable geoms
***************
*** 130,133 ****
--- 134,142 ----
protected: ContactParams *contact;
+ protected: char *entityName;
+
+ /// Scene node for this geometry
+ protected: Ogre::SceneNode *ogreSceneNode;
+
// Wart
friend class World;
Index: PlaneGeom.cc
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/bodies/PlaneGeom.cc,v
retrieving revision 1.26.2.3
retrieving revision 1.26.2.4
diff -C2 -d -r1.26.2.3 -r1.26.2.4
*** PlaneGeom.cc 15 Mar 2006 22:45:38 -0000 1.26.2.3
--- PlaneGeom.cc 11 Aug 2006 00:29:46 -0000 1.26.2.4
***************
*** 61,74 ****
// Create an ODE plane geom
// This geom is not placable
! this->SetGeom(dCreatePlane(spaceId, normal.x, normal.y, normal.z,
altitude), NULL, false);
! Ogre::Plane plane(Ogre::Vector3(this->planeNy.x, this->planeNy.y,
this->planeNy.z), this->planeAltitude);
Ogre::MeshManager::getSingleton().createPlane("plane",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
! 100,100,2,2,true,1,5,5,
Ogre::Vector3(this->planeNz.x,this->planeNz.y,this->planeNz.z));
Ogre::Entity *ent = this->ogreSceneNode->getCreator()->createEntity(
"PlaneEntity", "plane");
! ent->setCastShadows(true);
this->ogreSceneNode->attachObject(ent);
--- 61,75 ----
// Create an ODE plane geom
// This geom is not placable
! this->SetGeom(dCreatePlane(spaceId, 0, 1, 0, 0), NULL, false);
! Ogre::Plane plane(Ogre::Vector3(0, 1, 0), 0);
Ogre::MeshManager::getSingleton().createPlane("plane",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
! 1500,1500,20,20,true,1,5,5, Ogre::Vector3(0,0,1));
Ogre::Entity *ent = this->ogreSceneNode->getCreator()->createEntity(
"PlaneEntity", "plane");
! ent->setCastShadows(false);
! ent->setMaterialName("Examples/Rockwall");
this->ogreSceneNode->attachObject(ent);
***************
*** 90,208 ****
void PlaneGeom::Render(RenderOptions *opt)
{
- /* int i, j, k;
- int ni, nj;
- double sx, sy;
- GzVector p, q, offset;
- GLuint listId;
- RenderOptions listOpt;
-
- // Recover stored display list for this camera
- this->GetList(opt->cameraIndex, &listId, &listOpt);
-
- // See if the current display list is dirty
- this->dirty |= (listId == 0);
- this->dirty |= (opt->displayMaterials != listOpt.displayMaterials);
- this->dirty |= (opt->displayTextures != listOpt.displayTextures);
-
- // Generate the display list
- if (this->dirty)
- {
- if (listId == 0)
- listId = glGenLists(1);
-
- glNewList(listId, GL_COMPILE);
-
- // Set material properties
- if (opt->displayMaterials)
- {
- glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, this->colorAmbient);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, this->colorDiffuse);
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, this->colorSpecular);
- glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, this->shininess);
- PRINT_GL_ERR();
- }
-
- if (opt->displayTextures && this->textureImage)
- {
- // Set up textures
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- PRINT_GL_ERR();
-
- // Build the mipmaps
- // Assume image data is *not* aligned
- glPixelStorei( GL_UNPACK_ALIGNMENT, 1);
- gluBuild2DMipmaps(GL_TEXTURE_2D, this->textureImage->components,
- this->textureImage->width, this->textureImage->height,
- this->textureImage->format, this->textureImage->type,
- this->textureImage->data);
- PRINT_GL_ERR();
- }
-
-
- if (opt->displayTextures && this->textureImage)
- glEnable(GL_TEXTURE_2D);
-
- glNormal3f(this->planeNz.x, this->planeNz.y, this->planeNz.z);
-
- // Compute number of patches
- ni = (int) (ceil(opt->farClip / this->patchSize));
- nj = (int) (ceil(opt->farClip / this->patchSize));
-
- // Render strips
- for (j = -nj; j < nj; j += 1)
- {
- glBegin(GL_TRIANGLE_STRIP);
-
- for (i = -ni; i < ni; i += 2)
- {
- double vertex[4][2] = {{-1, +1}, {-1, -1}, {+1, +1}, {+1, -1}};
- offset = GzVectorSet(i * this->patchSize, j * this->patchSize, 0.0);
-
- for (k = 0; k < 4; k++)
- {
- q = GzVectorSet(vertex[k][0] * this->patchSize, vertex[k][1] *
this->patchSize, 0.0);
- q = GzVectorMul(0.5, q);
- q = GzVectorAdd(q, offset);
-
- p = GzVectorMul(q.x, this->planeNx);
- p = GzVectorAdd(p, GzVectorMul(q.y, this->planeNy));
-
- // Texture is scaled so that it covers the right amount of the plane
- glTexCoord2f(q.x / this->textureSize.x, q.y / this->textureSize.y);
-
- glVertex3f(p.x, p.y, p.z);
- }
- }
- glEnd();
- }
-
- if (opt->displayTextures && this->textureImage)
- glDisable(GL_TEXTURE_2D);
-
- // Store list options
- this->SetList(opt->cameraIndex, listId, *opt);
- glEndList();
- }
-
- // Call the display list
- if (listId)
- {
- // Compute offset based on camera pose; we only draw the plane around the
camera
- sx = Max(this->patchSize, this->textureSize.x);
- sy = Max(this->patchSize, this->textureSize.y);
- ni = (int) floor(opt->cameraPose.pos.x / sx + 0.5);
- nj = (int) floor(opt->cameraPose.pos.y / sy + 0.5);
- offset = GzVectorSet((ni + 0.5) * sx, (nj + 0.5) * sy, 0);
- glTranslatef(offset.x, offset.y, offset.z);
-
- glCallList(listId);
- PRINT_GL_ERR();
- }
-
- */
return;
}
--- 91,94 ----
Index: LightGeom.cc
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/bodies/LightGeom.cc,v
retrieving revision 1.11.2.2
retrieving revision 1.11.2.3
diff -C2 -d -r1.11.2.2 -r1.11.2.3
*** LightGeom.cc 10 Aug 2006 03:53:11 -0000 1.11.2.2
--- LightGeom.cc 11 Aug 2006 00:29:46 -0000 1.11.2.3
***************
*** 45,52 ****
this->light = this->ogreSceneNode->getCreator()->createLight( "Light1" );
this->light->setType( Ogre::Light::LT_POINT );
! this->light->setPosition( Ogre::Vector3(0,100,-100));
this->light->setDiffuseColour(1.0, 1.0, 1.0);
this->light->setSpecularColour(1.0, 1.0, 1.0);
!
return;
}
--- 45,52 ----
this->light = this->ogreSceneNode->getCreator()->createLight( "Light1" );
this->light->setType( Ogre::Light::LT_POINT );
! this->light->setPosition( Ogre::Vector3(0,200,-50));
this->light->setDiffuseColour(1.0, 1.0, 1.0);
this->light->setSpecularColour(1.0, 1.0, 1.0);
!
return;
}
Index: Geom.hh
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/bodies/Geom.hh,v
retrieving revision 1.31.2.1
retrieving revision 1.31.2.2
diff -C2 -d -r1.31.2.1 -r1.31.2.2
*** Geom.hh 15 Mar 2006 22:45:38 -0000 1.31.2.1
--- Geom.hh 11 Aug 2006 00:29:46 -0000 1.31.2.2
***************
*** 37,40 ****
--- 37,41 ----
class GzImage;
class Body;
+
namespace Ogre
{
***************
*** 189,194 ****
protected: bool dirty;
! /// Scene node for this geometry
! protected: Ogre::SceneNode *ogreSceneNode;
};
--- 190,194 ----
protected: bool dirty;
!
};
Index: WheelGeom.cc
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/bodies/WheelGeom.cc,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -C2 -d -r1.8.2.1 -r1.8.2.2
*** WheelGeom.cc 15 Mar 2006 22:45:38 -0000 1.8.2.1
--- WheelGeom.cc 11 Aug 2006 00:29:46 -0000 1.8.2.2
***************
*** 20,26 ****
*/
! #include <GL/gl.h>
! #include <GL/glu.h>
! #include <GL/glut.h>
#include "WheelGeom.hh"
--- 20,24 ----
*/
! #include <Ogre.h>
#include "WheelGeom.hh"
***************
*** 43,46 ****
--- 41,59 ----
this->tireRadius = tireRadius;
+ // Get the sphere mesh
+ Ogre::Entity *ent =
this->ogreSceneNode->getCreator()->createEntity(this->entityName, "wheel.mesh");
+
+ // Attach thte sphere to the scene node
+ this->ogreSceneNode->attachObject(ent);
+
+ // Set the size of the sphere
+ this->ogreSceneNode->setScale(totalRadius,totalRadius,tireRadius);
+
+ // Set the position of the sphere
+ this->ogreSceneNode->setPosition(0, totalRadius, 0);
+
+ // Allow the sphere to cast shadows
+ ent->setCastShadows(true);
+
return;
}
***************
*** 57,113 ****
void WheelGeom::Render(RenderOptions *opt)
{
- GLUquadricObj *quad;
- GLuint listId;
- RenderOptions listOpt;
-
- // Recover stored display list for this camera
- this->GetList(opt->cameraIndex, &listId, &listOpt);
-
- // See if the current display list is dirty
- this->dirty |= (listId == 0);
- this->dirty |= (opt->displayMaterials != listOpt.displayMaterials);
- this->dirty |= (opt->displayTextures != listOpt.displayTextures);
-
- // Generate the display list
- if (this->dirty)
- {
- if (listId == 0)
- listId = glGenLists(1);
- glNewList(listId, GL_COMPILE);
-
- // Set material properties
- if (opt->displayMaterials)
- {
- glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, this->colorAmbient);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, this->colorDiffuse);
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, this->colorSpecular);
- glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, this->shininess);
- }
-
- // Create the tire
- glutSolidTorus(this->tireRadius, this->totalRadius - this->tireRadius,
16, 16);
-
- // Create the hub
- glTranslatef(0, 0, +this->tireRadius * 0.8);
- quad = gluNewQuadric();
- gluQuadricOrientation(quad, GLU_OUTSIDE);
- gluDisk(quad, 0, this->totalRadius * 0.8, 32, 4);
- gluDeleteQuadric(quad);
-
- glTranslatef(0, 0, -this->tireRadius * 1.6);
- quad = gluNewQuadric();
- gluQuadricOrientation(quad, GLU_INSIDE);
- gluDisk(quad, 0, this->totalRadius * 0.8, 32, 4);
- gluDeleteQuadric(quad);
-
- // Store list options
- this->SetList(opt->cameraIndex, listId, *opt);
- glEndList();
- }
-
- // Call the display list
- if (listId)
- glCallList(listId);
-
return;
}
--- 70,73 ----
Index: CylinderGeom.cc
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/bodies/CylinderGeom.cc,v
retrieving revision 1.20.2.2
retrieving revision 1.20.2.3
diff -C2 -d -r1.20.2.2 -r1.20.2.3
*** CylinderGeom.cc 15 Mar 2006 22:45:38 -0000 1.20.2.2
--- CylinderGeom.cc 11 Aug 2006 00:29:46 -0000 1.20.2.3
***************
*** 55,63 ****
this->length = length;
! Ogre::Entity *ent =
this->ogreSceneNode->getCreator()->createEntity("Cylinder", "column.mesh");
ent->setCastShadows(true);
this->ogreSceneNode->attachObject(ent);
return;
}
--- 55,73 ----
this->length = length;
! // Get the mesh
! Ogre::Entity *ent =
this->ogreSceneNode->getCreator()->createEntity("Cylinder", "cylinder.mesh");
!
! // Allow it to cast shadows
ent->setCastShadows(true);
+ // Attach the sphere to the scene node
this->ogreSceneNode->attachObject(ent);
+ // Set the size of the cylinder
+ this->ogreSceneNode->scale(radius,radius,length);
+
+ // Set the default position of the cylinder
+ this->ogreSceneNode->translate(0,radius,0);
+
return;
}
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit