Update of /cvsroot/playerstage/code/gazebo/server
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11506

Modified Files:
      Tag: ogre
        Model.cc OgreAdaptor.cc OgreAdaptor.hh World.cc main.cc 
Log Message:
Updates to ogre integration

Index: OgreAdaptor.hh
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/Attic/OgreAdaptor.hh,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** OgreAdaptor.hh      15 Mar 2006 22:45:37 -0000      1.1.2.5
--- OgreAdaptor.hh      11 Aug 2006 00:29:46 -0000      1.1.2.6
***************
*** 52,55 ****
--- 52,58 ----
    public: virtual ~OgreAdaptor();
  
+   // Default initialization. Let OGRE create the window and rendering context
+   public: int Init();
+ 
    /// Initialize Ogre Rendering engine
    public: int Init(Display *display, XVisualInfo *visual, Window windowId, 
int width, int height);
***************
*** 59,66 ****
  
    private: void SetupResources();
!   private: void SetupRenderSystem();
    private: void CreateCameras();
    private: void CreateViewports();
!   private: void CreateScene();
    private: void CreateWindow(int width, int height);
  
--- 62,69 ----
  
    private: void SetupResources();
!   private: void SetupRenderSystem(bool create);
    private: void CreateCameras();
    private: void CreateViewports();
!   public: void CreateScene();
    private: void CreateWindow(int width, int height);
  

Index: main.cc
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/main.cc,v
retrieving revision 1.60.2.4
retrieving revision 1.60.2.5
diff -C2 -d -r1.60.2.4 -r1.60.2.5
*** main.cc     14 Apr 2006 20:38:03 -0000      1.60.2.4
--- main.cc     11 Aug 2006 00:29:46 -0000      1.60.2.5
***************
*** 286,290 ****
  
    // Get a display handle
!   if (optDisplay)
    {
    //  display = XOpenDisplay(optDisplay);
--- 286,290 ----
  
    // Get a display handle
! /* DELETE if (optDisplay)
    {
    //  display = XOpenDisplay(optDisplay);
***************
*** 296,304 ****
      display = NULL;
    }
  
-   // Initialize GLUT
-   //if (display)
-     //glutInit(argc, argv);
-   
    return 0;
  }
--- 296,301 ----
      display = NULL;
    }
+   */
  
    return 0;
  }

Index: World.cc
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/World.cc,v
retrieving revision 1.92.2.6
retrieving revision 1.92.2.7
diff -C2 -d -r1.92.2.6 -r1.92.2.7
*** World.cc    10 Aug 2006 03:53:11 -0000      1.92.2.6
--- World.cc    11 Aug 2006 00:29:46 -0000      1.92.2.7
***************
*** 140,144 ****
    this->simSpeed = 1.0;
    this->stepTime = 0.020;
!   this->gravity = GzVectorSet(0, 0, -9.8);
    this->utcOffset = 0;
    this->utmZone = GzVectorSet(0, 0, 0);
--- 140,144 ----
    this->simSpeed = 1.0;
    this->stepTime = 0.020;
!   this->gravity = GzVectorSet(0, -9.8, 0);
    this->utcOffset = 0;
    this->utmZone = GzVectorSet(0, 0, 0);
***************
*** 250,254 ****
  {
    this->worldFile = worldFile;
!   
    // Recursively load models
    if (this->LoadModel( this->worldFile->GetRootNode(), NULL ) != 0)
--- 250,254 ----
  {
    this->worldFile = worldFile;
!  
    // Recursively load models
    if (this->LoadModel( this->worldFile->GetRootNode(), NULL ) != 0)
***************
*** 256,264 ****
  
    // Set the gravity
!   /*dWorldSetGravity( this->worldId,
                      this->gravity.x,
                      this->gravity.y, 
                      this->gravity.z );
-                     */
                      
    Ogre::Plane *plane = new Ogre::Plane();
--- 256,263 ----
  
    // Set the gravity
!   dWorldSetGravity( this->worldId,
                      this->gravity.x,
                      this->gravity.y, 
                      this->gravity.z );
                      
    Ogre::Plane *plane = new Ogre::Plane();
***************
*** 300,304 ****
      {
        PRINT_MSG1(2, "Model:%s", node->GetName());
!             
        // Load plugin *before* instantiating the model
        pluginName = node->GetString("plugin", NULL, 0);
--- 299,303 ----
      {
        PRINT_MSG1(2, "Model:%s", node->GetName());
!            
        // Load plugin *before* instantiating the model
        pluginName = node->GetString("plugin", NULL, 0);
***************
*** 362,366 ****
        pose.pos = node->GetPosition( "xyz", pose.pos );
        pose.rot = node->GetRotation( "rpy", pose.rot );
!       
        // Set the model's pose (relative to parent)
        this->SetModelPose( model, pose );
--- 361,365 ----
        pose.pos = node->GetPosition( "xyz", pose.pos );
        pose.rot = node->GetRotation( "rpy", pose.rot );
!      
        // Set the model's pose (relative to parent)
        this->SetModelPose( model, pose );
***************
*** 701,705 ****
      // Do collision detection; this will add contacts to the contact
      // group
! /*TESTING    dSpaceCollide( this->spaceId, this, CollisionCallback );
      
      // Update the dynamical model
--- 700,704 ----
      // Do collision detection; this will add contacts to the contact
      // group
!     dSpaceCollide( this->spaceId, this, CollisionCallback );
      
      // Update the dynamical model
***************
*** 720,724 ****
        }
      }
-     */
    }
  
--- 719,722 ----

Index: Model.cc
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/Model.cc,v
retrieving revision 1.36.2.3
retrieving revision 1.36.2.4
diff -C2 -d -r1.36.2.3 -r1.36.2.4
*** Model.cc    23 Feb 2006 23:21:18 -0000      1.36.2.3
--- Model.cc    11 Aug 2006 00:29:46 -0000      1.36.2.4
***************
*** 110,119 ****
  void Model::MasterUpdate( double step )
  {
    if (this->logPoses)
      this->LogPose();
  
    this->Update(step);
- }
  
  
  //////////////////////////////////////////////////////////////////////////////
--- 110,125 ----
  void Model::MasterUpdate( double step )
  {
+   Body *body;
+   int i;
+   GzPose pose;
+ 
    if (this->logPoses)
      this->LogPose();
  
    this->Update(step);
  
+   pose = this->GetPose();
+   this->ogreSceneNode->setPosition(pose.pos.x, pose.pos.y, pose.pos.x);
+ }
  
  //////////////////////////////////////////////////////////////////////////////
***************
*** 313,316 ****
--- 319,323 ----
    npose = pose;
  
+ 
    for (i = 0; i < this->bodyCount; i++)
    {
***************
*** 329,332 ****
--- 336,340 ----
      // Set the new position and rotation
      body->SetPose( mpose );
+ 
     
      // Reset the object velocity

Index: OgreAdaptor.cc
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/Attic/OgreAdaptor.cc,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -C2 -d -r1.1.2.9 -r1.1.2.10
*** OgreAdaptor.cc      10 Aug 2006 03:53:11 -0000      1.1.2.9
--- OgreAdaptor.cc      11 Aug 2006 00:29:46 -0000      1.1.2.10
***************
*** 5,9 ****
  OgreAdaptor::OgreAdaptor()
  {
!   // Make the root node
    this->root = new Ogre::Root(); 
  }
--- 5,9 ----
  OgreAdaptor::OgreAdaptor()
  {
!   // Make the root 
    this->root = new Ogre::Root(); 
  }
***************
*** 15,18 ****
--- 15,58 ----
  }
  
+ int OgreAdaptor::Init()
+ {
+   printf("SetupResources\n");
+   // Setup the available resources 
+   this->SetupResources();
+ 
+   printf("SetupRenderingSystem\n");
+ 
+   // Setup the rendering system, and create the context
+   this->SetupRenderSystem(true);
+ 
+   printf("Root Init\n");
+   // Initialize the root node, and create a window
+   this->window = this->root->initialise(true); 
+ 
+   printf("CreateSceneManager\n");
+   // Get the SceneManager, in this case a generic one
+   this->sceneMgr = this->root->createSceneManager(Ogre::ST_GENERIC);
+ 
+   printf("CreateCamera\n");
+   this->CreateCameras();
+ 
+   printf("CreateViewports\n");
+   this->CreateViewports();
+ 
+   // Set default mipmap level (NB some APIs ignore this)
+   Ogre::TextureManager::getSingleton().setDefaultNumMipmaps( 5 );
+ 
+   // Load Resources
+   Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
+ 
+   // Default lighting
+   this->sceneMgr->setAmbientLight(Ogre::ColourValue(0.0f, 0.0f, 0.0f, 1.0f)); 
+   this->sceneMgr->setShadowTechnique( Ogre::SHADOWTYPE_STENCIL_ADDITIVE );
+ 
+   printf("Done\n");
+ 
+   return 0;
+ }
+ 
  int OgreAdaptor::Init(Display *display, XVisualInfo *visual, 
      Window windowId, int width, int height)
***************
*** 30,38 ****
  
    printf("SetupRenderingSystem\n");
!   // Setup the rendering system
!   this->SetupRenderSystem();
  
    printf("Root Init\n");
- 
    // Initialize the root node, and don't create a window
    this->window = this->root->initialise(false); 
--- 70,77 ----
  
    printf("SetupRenderingSystem\n");
!   // Setup the rendering system, and don't create the context
!   this->SetupRenderSystem(false);
  
    printf("Root Init\n");
    // Initialize the root node, and don't create a window
    this->window = this->root->initialise(false); 
***************
*** 73,76 ****
--- 112,117 ----
  
    printf("Done\n");
+ 
+   return 0;
  }
  
***************
*** 101,105 ****
  }
  
! void OgreAdaptor::SetupRenderSystem()
  {
    // Set parameters of render system (window size, etc.)
--- 142,146 ----
  }
  
! void OgreAdaptor::SetupRenderSystem(bool create)
  {
    // Set parameters of render system (window size, etc.)
***************
*** 122,126 ****
  
      selectedRenderSystem->setConfigOption("Full Screen","No");
!     //selectedRenderSystem->setConfigOption("Video Mode","800 x 600 @ 16-bit 
colour");
      this->root->setRenderSystem(selectedRenderSystem);
    }
--- 163,173 ----
  
      selectedRenderSystem->setConfigOption("Full Screen","No");
!     selectedRenderSystem->setConfigOption("FSAA","2");
! 
!     if (create)
!     {
!       selectedRenderSystem->setConfigOption("Video Mode","800 x 600 @ 16-bit 
colour");
!     }
! 
      this->root->setRenderSystem(selectedRenderSystem);
    }
***************
*** 133,137 ****
  
    // Position it
!   this->camera->setPosition(Ogre::Vector3(2,20,10));
  
    this->camera->lookAt(Ogre::Vector3(0,0,0));
--- 180,184 ----
  
    // Position it
!   this->camera->setPosition(Ogre::Vector3(0,5,5));
  
    this->camera->lookAt(Ogre::Vector3(0,0,0));
***************
*** 144,148 ****
    // Create one viewport, entire window
    Ogre::Viewport* vp = this->window->addViewport(this->camera);
!   vp->setBackgroundColour( Ogre::ColourValue( 0,0,0) );
  
    // Alter the camera aspect ratio to match the viewport
--- 191,195 ----
    // Create one viewport, entire window
    Ogre::Viewport* vp = this->window->addViewport(this->camera);
!   vp->setBackgroundColour( Ogre::ColourValue(0,0,0) );
  
    // Alter the camera aspect ratio to match the viewport
***************
*** 152,155 ****
--- 199,222 ----
  void OgreAdaptor::CreateScene()
  {
+   // Create the scene
+   Ogre::Entity *ent = this->sceneMgr->createEntity( "Ninja", "ninja.mesh" );
+   ent->setCastShadows(true);
+   
this->sceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);
+ 
+   Ogre::Plane plane(Ogre::Vector3::UNIT_Y,0);
+   Ogre::MeshManager::getSingleton().createPlane("ground",
+       Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,plane,
+       1500,1500,20,20,true,1,5,5,Ogre::Vector3::UNIT_Z);
+ 
+   ent = this->sceneMgr->createEntity( "GroundEntity", "ground");
+   
this->sceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);
+   ent->setMaterialName("Examples/Rockwall");
+   ent->setCastShadows(false);
+ 
+   Ogre::Light *light = this->sceneMgr->createLight( "Light1" );
+   light->setType( Ogre::Light::LT_POINT );
+   light->setPosition( Ogre::Vector3(0,200,-50) );
+   light->setDiffuseColour( 1.0, 0.0, 0.0 );
+   light->setSpecularColour( 1.0, 0.0, 0.0 );
  }
  
***************
*** 172,177 ****
  int OgreAdaptor::Render()
  {
!   //this->root->renderOneFrame();
!   this->root->_updateAllRenderTargets();
  
    return 0;
--- 239,245 ----
  int OgreAdaptor::Render()
  {
!   Ogre::PlatformManager::getSingleton().messagePump(window);
!     
!   root->renderOneFrame();
  
    return 0;


-------------------------------------------------------------------------
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

Reply via email to