Revision: 6556
http://playerstage.svn.sourceforge.net/playerstage/?rev=6556&view=rev
Author: natepak
Date: 2008-06-13 13:55:07 -0700 (Fri, 13 Jun 2008)
Log Message:
-----------
Updates to the grid, removed bad gui classes
Modified Paths:
--------------
code/gazebo/trunk/TODO
code/gazebo/trunk/server/Simulator.cc
code/gazebo/trunk/server/rendering/OgreAdaptor.cc
code/gazebo/trunk/server/rendering/OgreCreator.cc
code/gazebo/trunk/worlds/pioneer2dx.world
code/gazebo/trunk/worlds/simpleshapes.world
Modified: code/gazebo/trunk/TODO
===================================================================
--- code/gazebo/trunk/TODO 2008-06-13 20:54:30 UTC (rev 6555)
+++ code/gazebo/trunk/TODO 2008-06-13 20:55:07 UTC (rev 6556)
@@ -1,4 +1,5 @@
Open:
+- Make headless
- Mouse picking
-Implement in CameraSensor class.
- Shadows draw on multiple surfaces(seem to pass through walls).
Modified: code/gazebo/trunk/server/Simulator.cc
===================================================================
--- code/gazebo/trunk/server/Simulator.cc 2008-06-13 20:54:30 UTC (rev
6555)
+++ code/gazebo/trunk/server/Simulator.cc 2008-06-13 20:55:07 UTC (rev
6556)
@@ -31,10 +31,9 @@
//#include <boost/bind.hpp>
#include "World.hh"
-#include "GuiFactory.hh"
#include "Gui.hh"
-#include "DummyGui.hh"
#include "XMLConfig.hh"
+#include "Gui.hh"
#include "GazeboConfig.hh"
#include "gazebo.h"
#include "PhysicsEngine.hh"
@@ -134,8 +133,24 @@
//Create and initialize the Gui
try
{
- this->gui=GuiFactory::NewGui(rootNode);
- this->gui->Init();
+ XMLConfigNode *childNode = rootNode->GetChild("gui");
+
+ if (childNode)
+ {
+ int width = childNode->GetTupleInt("size",0,640);
+ int height = childNode->GetTupleInt("size",1,480);
+ int x = childNode->GetTupleInt("pos",0,0);
+ int y = childNode->GetTupleInt("pos",1,0);
+ std::string type = childNode->GetString("type","fltk",1);
+
+ gzmsg(1) << "Creating GUI:\n\tType[" << type
+ << "] Pos[" << x << " " << y
+ << "] Size[" << width << " " << height << "]\n";
+
+ // Create the GUI
+ this->gui = new Gui(x, y, width, height, type+"::Gazebo");
+ this->gui->Init();
+ }
}
catch (GazeboError e)
{
@@ -259,7 +274,8 @@
}
// Update the gui
- this->gui->Update();
+ if (this->gui)
+ this->gui->Update();
elapsedTime = (this->GetRealTime() - currTime);
@@ -386,13 +402,12 @@
}
-// Move to GuiFactory?
void Simulator::SaveGui(XMLConfigNode *node)
{
Vector2<int> size;
XMLConfigNode* childNode = node->GetChild("gui");
- if (childNode)
+ if (childNode && this->gui)
{
size.x = this->gui->GetWidth();
size.y = this->gui->GetHeight();
Modified: code/gazebo/trunk/server/rendering/OgreAdaptor.cc
===================================================================
--- code/gazebo/trunk/server/rendering/OgreAdaptor.cc 2008-06-13 20:54:30 UTC
(rev 6555)
+++ code/gazebo/trunk/server/rendering/OgreAdaptor.cc 2008-06-13 20:55:07 UTC
(rev 6556)
@@ -167,6 +167,10 @@
// Create a window for Ogre
this->CreateWindow();
+ // No window...then exit
+ if (!this->window)
+ return;
+
// Get the SceneManager, in this case a generic one
if (node->GetChild("bsp"))
{
@@ -459,20 +463,23 @@
{
Ogre::StringVector paramsVector;
Ogre::NameValuePairList params;
- Gui *gui=Simulator::Instance()->GetUI();
+ Gui *gui = Simulator::Instance()->GetUI();
- paramsVector.push_back( Ogre::StringConverter::toString(
(size_t)(gui->GetDisplay()) ) );
- paramsVector.push_back(
Ogre::StringConverter::toString((int)gui->GetVisualInfo()->screen));
+ if (gui)
+ {
+ paramsVector.push_back( Ogre::StringConverter::toString(
(size_t)(gui->GetDisplay()) ) );
+ paramsVector.push_back(
Ogre::StringConverter::toString((int)gui->GetVisualInfo()->screen));
- paramsVector.push_back(
Ogre::StringConverter::toString((int)gui->GetWindowId()));
- paramsVector.push_back(
Ogre::StringConverter::toString((size_t)(gui->GetVisualInfo())));
+ paramsVector.push_back(
Ogre::StringConverter::toString((int)gui->GetWindowId()));
+ paramsVector.push_back(
Ogre::StringConverter::toString((size_t)(gui->GetVisualInfo())));
- params["parentWindowHandle"] = Ogre::StringConverter::toString(paramsVector);
+ params["parentWindowHandle"] =
Ogre::StringConverter::toString(paramsVector);
- this->window = this->root->createRenderWindow( "WindowName",
gui->GetWidth(), gui->GetHeight(), false, ¶ms);
+ this->window = this->root->createRenderWindow( "WindowName",
gui->GetWidth(), gui->GetHeight(), false, ¶ms);
- this->window->setActive(true);
- this->window->setAutoUpdated(true);
+ this->window->setActive(true);
+ this->window->setAutoUpdated(true);
+ }
}
////////////////////////////////////////////////////////////////////////////////
Modified: code/gazebo/trunk/server/rendering/OgreCreator.cc
===================================================================
--- code/gazebo/trunk/server/rendering/OgreCreator.cc 2008-06-13 20:54:30 UTC
(rev 6555)
+++ code/gazebo/trunk/server/rendering/OgreCreator.cc 2008-06-13 20:55:07 UTC
(rev 6556)
@@ -360,7 +360,7 @@
Ogre::Plane plane;
plane.d = 49;
plane.normal = Ogre::Vector3::NEGATIVE_UNIT_Z;
- OgreAdaptor::Instance()->sceneMgr->setSkyPlane(true, plane,
material, 50, 8, true, 0.5, 150, 150);
+ OgreAdaptor::Instance()->sceneMgr->setSkyPlane(true, plane,
material, 500, 100, true, 0.5, 150, 150);
}
else
{
@@ -386,43 +386,86 @@
{
Ogre::ManualObject* gridObject =
OgreAdaptor::Instance()->sceneMgr->createManualObject("__OGRE_GRID__");
+ gridObject->setCastShadows(false);
+
Ogre::SceneNode* gridObjectNode =
OgreAdaptor::Instance()->sceneMgr->getRootSceneNode()->createChildSceneNode("__OGRE_GRID_NODE__");
Ogre::MaterialPtr gridObjectMaterialX =
Ogre::MaterialManager::getSingleton().create("__OGRE_GRID_MATERIAL_X__","debugger1");
gridObjectMaterialX->setReceiveShadows(true);
gridObjectMaterialX->getTechnique(0)->setLightingEnabled(true);
- gridObjectMaterialX->getTechnique(0)->getPass(0)->setDiffuse(0.4,0.0,0.0,0);
- gridObjectMaterialX->getTechnique(0)->getPass(0)->setAmbient(0.4,0.0,0.0);
-
gridObjectMaterialX->getTechnique(0)->getPass(0)->setSelfIllumination(0.1,0.0,0.0);
+ gridObjectMaterialX->getTechnique(0)->getPass(0)->setDiffuse(0.2,0.2,0.2,0);
+ gridObjectMaterialX->getTechnique(0)->getPass(0)->setAmbient(0.2,0.2,0.2);
+
gridObjectMaterialX->getTechnique(0)->getPass(0)->setSelfIllumination(0.0,0.0,0.0);
+ gridObjectMaterialX->setReceiveShadows(false);
Ogre::MaterialPtr gridObjectMaterialY =
Ogre::MaterialManager::getSingleton().create("__OGRE_GRID_MATERIAL_Y__","debugger2");
gridObjectMaterialY->setReceiveShadows(true);
gridObjectMaterialY->getTechnique(0)->setLightingEnabled(true);
- gridObjectMaterialY->getTechnique(0)->getPass(0)->setDiffuse(0.0,0.0,0.4,0);
- gridObjectMaterialY->getTechnique(0)->getPass(0)->setAmbient(0.0,0.0,0.4);
-
gridObjectMaterialY->getTechnique(0)->getPass(0)->setSelfIllumination(0.0,0.0,0.1);
+ gridObjectMaterialY->getTechnique(0)->getPass(0)->setDiffuse(0.2,0.2,0.2,0);
+ gridObjectMaterialY->getTechnique(0)->getPass(0)->setAmbient(0.2,0.2,0.2);
+
gridObjectMaterialY->getTechnique(0)->getPass(0)->setSelfIllumination(0.0,0.0,0.0);
+ gridObjectMaterialY->setReceiveShadows(false);
float d = 0.01;
- float z = 0.01;
+ float z_bottom = .02;
+ float height = 1.0;
+ int dim = 50;
+
+ // Vertex Values for a square box
+ float 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}
+ };
+
+ // Indices
+ int ind[36] =
+ {
+ // Bottom Face
+ 0, 1, 2,
+ 2, 3, 0,
+
+ // Top Face
+ 4, 5, 7,
+ 7, 5, 6,
+
+ // Front Face
+ 0, 4, 7,
+ 7, 3, 0,
+
+ // Back face
+ 5, 1, 6,
+ 6, 1, 2,
+
+ // Left face
+ 0, 5, 4,
+ 0, 1, 5,
+
+ // Right face
+ 3, 7, 6,
+ 6, 2, 3
+
+
+ };
+
gridObject->begin("__OGRE_GRID_MATERIAL_Y__",
Ogre::RenderOperation::OT_TRIANGLE_LIST);
- for (int y=-100; y<100; y++)
+ for (int y=-dim; y<dim; y++)
{
if (y%10 == 0)
d = 0.04;
else
d = 0.01;
- gridObject->position(-100, y-d, z);
- gridObject->position(100, y-d, z);
- gridObject->position(100, y+d, z);
-
- gridObject->position(-100, y-d, z);
- gridObject->position(100, y+d, z);
- gridObject->position(-100, y+d, z);
-
+ // For each face
+ for (int i = 0; i < 36; i++)
+ {
+ gridObject->position( v[ind[i]][0] * dim,
+ y+v[ind[i]][1] * 0.02,
+ v[ind[i]][2] * 0.01 );
+ }
char *name=new char[20];
char *text=new char[10];
@@ -453,25 +496,24 @@
}
gridObject->end();
+
gridObject->begin("__OGRE_GRID_MATERIAL_X__",
Ogre::RenderOperation::OT_TRIANGLE_LIST);
- z -= 0.001;
-
- for (int x=-100; x<100; x++)
+ for (int x=-dim; x<dim; x++)
{
if (x%10 == 0)
d = 0.04;
else
d = 0.01;
- gridObject->position(x+d, 100, z);
- gridObject->position(x-d, 100, z);
- gridObject->position(x-d, -100, z);
+ // For each face
+ for (int i = 0; i < 36; i++)
+ {
+ gridObject->position(x+v[ind[i]][0] * 0.02,
+ v[ind[i]][1] * dim,
+ v[ind[i]][2] * 0.01 );
+ }
- gridObject->position(x+d, -100, z);
- gridObject->position(x+d, 100, z);
- gridObject->position(x-d, -100, z);
-
char *name=new char[20];
char *text=new char[10];
Modified: code/gazebo/trunk/worlds/pioneer2dx.world
===================================================================
--- code/gazebo/trunk/worlds/pioneer2dx.world 2008-06-13 20:54:30 UTC (rev
6555)
+++ code/gazebo/trunk/worlds/pioneer2dx.world 2008-06-13 20:55:07 UTC (rev
6556)
@@ -26,17 +26,25 @@
<maxUpdateRate>0</maxUpdateRate>
</physics:ode>
- <rendering:gui>
+ <!--<rendering:gui>
<type>fltk</type>
<size>640 480</size>
<pos>0 0</pos>
</rendering:gui>
+ -->
<rendering:ogre>
<ambient>0.5 0.5 0.5 1.0</ambient>
<sky>
<material>Gazebo/CloudySky</material>
</sky>
+
+ <fog>
+ <color>1.0 1.0 1.0</color>
+ <linearStart>10</linearStart>
+ <linearEnd>100</linearEnd>
+ </fog>
+
<maxUpdateRate>0</maxUpdateRate>
</rendering:ogre>
@@ -52,7 +60,7 @@
<size>2000 2000</size>
<segments>10 10</segments>
<uvTile>100 100</uvTile>
- <material>Gazebo/GrassFloor</material>
+ <material>Gazebo/Grey</material>
</geom:plane>
</body:plane>
</model:physical>
Modified: code/gazebo/trunk/worlds/simpleshapes.world
===================================================================
--- code/gazebo/trunk/worlds/simpleshapes.world 2008-06-13 20:54:30 UTC (rev
6555)
+++ code/gazebo/trunk/worlds/simpleshapes.world 2008-06-13 20:55:07 UTC (rev
6556)
@@ -32,7 +32,6 @@
<sky>
<material>Gazebo/CloudySky</material>
</sky>
-
</rendering:ogre>
<model:physical name="sphere1_model">
@@ -100,7 +99,7 @@
<size>2000 2000</size>
<segments>10 10</segments>
<uvTile>100 100</uvTile>
- <material>Gazebo/GrassFloor</material>
+ <material>Gazebo/Grey</material>
</geom:plane>
</body:plane>
</model:physical>
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit