|
@@ -725,7 +725,8 @@ Viewer::Viewer(roadmanager::OpenDrive* odrManager, const char* modelFilename, co
|
|
|
keyRight_ = false;
|
|
|
quit_request_ = false;
|
|
|
showInfoText = true; // show info text HUD per default
|
|
|
- camMode_ = osgGA::RubberbandManipulator::RB_MODE_ORBIT;
|
|
|
+// camMode_ = osgGA::RubberbandManipulator::RB_MODE_ORBIT;
|
|
|
+ camMode_ = osgGA::RubberbandManipulator::RB_MODE_RUBBER_BAND;//更改初始化时候的视角
|
|
|
shadow_node_ = NULL;
|
|
|
environment_ = NULL;
|
|
|
roadGeom = NULL;
|
|
@@ -902,20 +903,20 @@ Viewer::Viewer(roadmanager::OpenDrive* odrManager, const char* modelFilename, co
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (odrManager->GetNumOfRoads() > 0 && !CreateRoadLines(odrManager))
|
|
|
- {
|
|
|
- LOG("Viewer::Viewer Failed to create road lines!\n");
|
|
|
- }
|
|
|
+ if (odrManager->GetNumOfRoads() > 0 && !CreateRoadLines(odrManager))
|
|
|
+ {
|
|
|
+ LOG("Viewer::Viewer Failed to create road lines!\n");
|
|
|
+ }
|
|
|
|
|
|
- if (odrManager->GetNumOfRoads() > 0 && !CreateRoadMarkLines(odrManager))
|
|
|
- {
|
|
|
- LOG("Viewer::Viewer Failed to create road mark lines!\n");
|
|
|
- }
|
|
|
+ if (odrManager->GetNumOfRoads() > 0 && !CreateRoadMarkLines(odrManager))
|
|
|
+ {
|
|
|
+ LOG("Viewer::Viewer Failed to create road mark lines!\n");
|
|
|
+ }
|
|
|
|
|
|
- if (odrManager->GetNumOfRoads() > 0 && CreateRoadSignsAndObjects(odrManager) != 0)
|
|
|
- {
|
|
|
- LOG("Viewer::Viewer Failed to create road signs!\n");
|
|
|
- }
|
|
|
+ if (odrManager->GetNumOfRoads() > 0 && CreateRoadSignsAndObjects(odrManager) != 0)
|
|
|
+ {
|
|
|
+ LOG("Viewer::Viewer Failed to create road signs!\n");
|
|
|
+ }
|
|
|
|
|
|
#if 0
|
|
|
osgViewer_->setSceneData(shadowedScene);
|
|
@@ -1153,7 +1154,7 @@ EntityModel* Viewer::AddBackModel(osg::Vec3 trail_color,std::string name)
|
|
|
EntityModel* model;
|
|
|
int i;
|
|
|
int j;
|
|
|
- osg::ref_ptr<osg::Texture2D> xtexture = new osg::Texture2D(osgDB::readImageFile("/home/yuchuli/git/esmini/resources/models/grass.jpg"));
|
|
|
+ osg::ref_ptr<osg::Texture2D> xtexture = new osg::Texture2D(osgDB::readImageFile("/home/nvidia/map/models/grass.jpg"));
|
|
|
for(i=0;i<100;i++)
|
|
|
{
|
|
|
|
|
@@ -1365,15 +1366,15 @@ int Viewer::AddOSGBEnv(const char* filename,osg::Vec3 trail_color, std::string
|
|
|
|
|
|
model = new EntityModel(osgViewer_, group, rootnode_, trails_, dot_node_, trail_color, name);
|
|
|
|
|
|
- model->state_set_ = model->lod_->getOrCreateStateSet(); // Creating material
|
|
|
- model->blend_color_ = new osg::BlendColor(osg::Vec4(1, 1, 1, 1));
|
|
|
- model->state_set_->setAttributeAndModes(model->blend_color_);
|
|
|
- model->blend_color_->setDataVariance(osg::Object::DYNAMIC);
|
|
|
+// model->state_set_ = model->lod_->getOrCreateStateSet(); // Creating material
|
|
|
+// model->blend_color_ = new osg::BlendColor(osg::Vec4(1, 1, 1, 1));
|
|
|
+// model->state_set_->setAttributeAndModes(model->blend_color_);
|
|
|
+// model->blend_color_->setDataVariance(osg::Object::DYNAMIC);
|
|
|
|
|
|
- osg::BlendFunc* bf = new osg::BlendFunc(osg::BlendFunc::CONSTANT_ALPHA, osg::BlendFunc::ONE_MINUS_CONSTANT_ALPHA);
|
|
|
- model->state_set_->setAttributeAndModes(bf);
|
|
|
- model->state_set_->setMode(GL_DEPTH_TEST, osg::StateAttribute::ON);
|
|
|
- model->state_set_->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
|
|
+// osg::BlendFunc* bf = new osg::BlendFunc(osg::BlendFunc::CONSTANT_ALPHA, osg::BlendFunc::ONE_MINUS_CONSTANT_ALPHA);
|
|
|
+// model->state_set_->setAttributeAndModes(bf);
|
|
|
+// model->state_set_->setMode(GL_DEPTH_TEST, osg::StateAttribute::ON);
|
|
|
+// model->state_set_->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
|
|
|
|
|
model->SetPosition(0,0,0);
|
|
|
|
|
@@ -1413,6 +1414,8 @@ EntityModel* Viewer::AddEntityModel(std::string modelFilepath, osg::Vec3 trail_c
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// group = LoadEntityModel("/home/nvidia/beijing_0719_bus.rpj.opt.osgb");
|
|
|
+
|
|
|
if (boundingBox || group == 0)
|
|
|
{
|
|
|
// Create a bounding box visual representation
|
|
@@ -1561,6 +1564,7 @@ osg::ref_ptr<osg::Group> Viewer::LoadEntityModel(const char *filename)
|
|
|
osg::ref_ptr<osg::Node> node;
|
|
|
osg::ref_ptr<osg::Group> group = new osg::Group;
|
|
|
|
|
|
+
|
|
|
node = osgDB::readNodeFile(filename);
|
|
|
if (!node)
|
|
|
{
|
|
@@ -2343,6 +2347,7 @@ bool ViewerEventHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActi
|
|
|
case(osgGA::GUIEventAdapter::KEY_K):
|
|
|
if (ea.getEventType() & osgGA::GUIEventAdapter::KEYDOWN)
|
|
|
{
|
|
|
+ std::cout<<"mode is "<<viewer_->camMode_ <<std::endl;
|
|
|
viewer_->camMode_ += 1;
|
|
|
if (viewer_->camMode_ >= osgGA::RubberbandManipulator::RB_NUM_MODES)
|
|
|
{
|