Changeset 6280 for OpenSceneGraph/trunk/examples/osglogo/osglogo.cpp
- Timestamp:
- 02/27/07 12:51:32 (6 years ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/examples/osglogo/osglogo.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osglogo/osglogo.cpp
r5928 r6280 21 21 22 22 #include <iostream> 23 24 static bool s_ProfessionalServices = false;25 23 26 24 class MyBillboardTransform : public osg::PositionAttitudeTransform … … 123 121 } 124 122 125 osg:: Node* createTextBelow(const osg::BoundingBox& bb )123 osg:: Node* createTextBelow(const osg::BoundingBox& bb, const std::string& label, const std::string&) 126 124 { 127 125 osg::Geode* geode = new osg::Geode(); … … 137 135 text->setPosition(bb.center()-osg::Vec3(0.0f,0.0f,(bb.zMax()-bb.zMin()))); 138 136 text->setColor(osg::Vec4(0.37f,0.48f,0.67f,1.0f)); 139 text->setText( "OpenSceneGraph");137 text->setText(label); 140 138 141 139 geode->addDrawable( text ); … … 144 142 } 145 143 146 osg:: Node* createTextLeft(const osg::BoundingBox& bb )144 osg:: Node* createTextLeft(const osg::BoundingBox& bb, const std::string& label, const std::string& subscript) 147 145 { 148 146 osg::Geode* geode = new osg::Geode(); … … 166 164 //text->setColor(osg::Vec4(0.37f,0.48f,0.67f,1.0f)); // Neil's orignal OSG colour 167 165 text->setColor(osg::Vec4(0.20f,0.45f,0.60f,1.0f)); // OGL logo colour 168 text->setText( "OpenSceneGraph");166 text->setText(label); 169 167 170 168 #if 1 … … 198 196 199 197 200 if ( s_ProfessionalServices)198 if (!subscript.empty()) 201 199 { 202 200 //osgText::Text* subscript = new osgText::Text(new osgText::TextureFont(font,45)); 203 201 204 osgText::Text* subscript = new osgText::Text;205 subscript ->setFont(font);206 subscript ->setText("Professional Services");207 subscript ->setAlignment(osgText::Text::RIGHT_CENTER);208 subscript ->setAxisAlignment(osgText::Text::XZ_PLANE);209 subscript ->setPosition(bb.center()-osg::Vec3((bb.xMax()-bb.xMin())*4.3f,-(bb.yMax()-bb.yMin())*0.5f,(bb.zMax()-bb.zMin())*0.6f));210 subscript ->setColor(osg::Vec4(0.0f,0.0f,0.0f,1.0f)); // black211 212 geode->addDrawable( subscript );202 osgText::Text* subscriptText = new osgText::Text; 203 subscriptText->setFont(font); 204 subscriptText->setText(subscript); 205 subscriptText->setAlignment(osgText::Text::RIGHT_CENTER); 206 subscriptText->setAxisAlignment(osgText::Text::XZ_PLANE); 207 subscriptText->setPosition(bb.center()-osg::Vec3((bb.xMax()-bb.xMin())*4.3f,-(bb.yMax()-bb.yMin())*0.5f,(bb.zMax()-bb.zMin())*0.6f)); 208 subscriptText->setColor(osg::Vec4(0.0f,0.0f,0.0f,1.0f)); // black 209 210 geode->addDrawable( subscriptText ); 213 211 } 214 212 … … 374 372 } 375 373 376 osg::Node* createLogo(const std::string& filename )374 osg::Node* createLogo(const std::string& filename, const std::string& label, const std::string& subscript) 377 375 { 378 376 osg::BoundingBox bb(osg::Vec3(0.0f,0.0f,0.0f),osg::Vec3(100.0f,100.0f,100.0f)); … … 413 411 // add the text to the group. 414 412 //group->addChild(createTextBelow(bb)); 415 logo_group->addChild(createTextLeft(bb ));413 logo_group->addChild(createTextLeft(bb, label, subscript)); 416 414 417 415 … … 460 458 } 461 459 462 while (arguments.read("ps")) s_ProfessionalServices = true; 463 464 osg::Node* node = 0; 465 466 if (arguments.argc()>1) createLogo(arguments[1]); 467 else node = createLogo(""); 460 std::string label = "OpenSceneGraph"; 461 std::string subscript = ""; 462 463 while (arguments.read("--label", label)) {} 464 while (arguments.read("--subscript", subscript)) {} 465 466 osg::ref_ptr<osg::Node> node; 467 468 if (arguments.argc()>1) node = createLogo(arguments[1], label, subscript); 469 else node = createLogo("", label, subscript); 468 470 469 471 // add model to viewer. 470 viewer.setSceneData( node );472 viewer.setSceneData( node.get() ); 471 473 472 474 return viewer.run();
