Changeset 293
- Timestamp:
- Jun 5, 2011, 10:33:34 PM (13 years ago)
- Location:
- osgVisual/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/trunk/bin/osgVisualConfig.xml
r286 r293 15 15 16 16 <scenery> 17 <terrain filename="D:/OpenSceneGraph/VPB-Testdatensatz/DB_Small/database.ive.terrainmod" filename2="J:\BRD1m_MUC0.25m_srtmEU_BM\terrain.ive.terrainmod" ></terrain>17 <terrain filename="D:/OpenSceneGraph/VPB-Testdatensatz/DB_Small/database.ive.terrainmod" filename2="J:\BRD1m_MUC0.25m_srtmEU_BM\terrain.ive.terrainmod" filename3="axes.osg.10000000.scale"></terrain> 18 18 <animationpath filename="airport_muc.path"></animationpath> 19 19 <models> -
osgVisual/trunk/include/util/visual_util.h
r273 r293 296 296 static bool strToBool(std::string s); 297 297 298 /** 299 * \brief \todo : Kommentieren 300 * 301 * @param StartPoint 302 * @param EndPoint 303 * @param radius 304 * @param CylinderColor 305 * @param pAddToThisGroup 306 */ 307 static void AddCylinderBetweenPoints(osg::Vec3d StartPoint, osg::Vec3d EndPoint, float radius, float length, osg::Vec4d CylinderColor, osg::Group *pAddToThisGroup); 308 298 309 template<class T> 299 310 class FindTopMostNodeOfTypeVisitor : public osg::NodeVisitor … … 352 363 */ 353 364 static xmlNode* checkXMLNodeChildrenForScenery(xmlNode* node); 365 354 366 }; 355 367 -
osgVisual/trunk/src/sky_Silverlining/skySilverLining_skyDrawable.cpp
r292 r293 78 78 //direction = view * direction; 79 79 direction.normalize(); 80 81 //OSG_NOTIFY(osg::ALWAYS) << "Light Vector: X:"<<direction.x()<<" Y:"<<direction.y()<<" Z:"<<direction.z() << std::endl; 82 util::AddCylinderBetweenPoints(osg::Vec3d(0,0,0), direction , 10000.0, 15000000.0, osg::Vec4d(1.0, 1.0, 0.0, 1 ), sceneRoot); 80 83 81 84 light->setAmbient(ambient); 82 85 light->setDiffuse(diffuse); 83 86 //light->setSpecular(osg::Vec4(0,0,0,1)); 84 light->setSpecular(osg::Vec4(1.0,1.0,1.0,1)); // Test87 //light->setSpecular(osg::Vec4(1.0,1.0,1.0,1)); // Test 85 88 light->setPosition(osg::Vec4(direction.x(), direction.y(), direction.z(), 0)); 86 89 } -
osgVisual/trunk/src/util/visual_util.cpp
r226 r293 16 16 17 17 #include <visual_util.h> 18 #include <osg/Material> 18 19 19 20 using namespace osgVisual; … … 569 570 return(false); 570 571 } 572 573 void util::AddCylinderBetweenPoints(osg::Vec3d StartPoint, osg::Vec3d EndPoint, float radius, float length, osg::Vec4d CylinderColor, osg::Group *pAddToThisGroup) 574 { 575 osg::ref_ptr<osg::Geode> geode = new osg::Geode; 576 osg::Vec3d center; 577 float height; 578 osg::ref_ptr<osg::Cylinder> cylinder; 579 osg::ref_ptr<osg::Drawable> cylinderDrawable; 580 osg::ref_ptr<osg::Material> pMaterial; 581 582 //height = (StartPoint-EndPoint).length(); 583 height = length; 584 center = osg::Vec3( (StartPoint.x() + EndPoint.x()) / 2, (StartPoint.y() + EndPoint.y()) / 2, (StartPoint.z() + EndPoint.z()) / 2); 585 586 // This is the default direction for the cylinders to face in OpenGL 587 osg::Vec3d z = osg::Vec3d(0,0,1); 588 589 // Get diff between two points you want cylinder along 590 osg::Vec3d p = StartPoint - EndPoint; 591 592 // Get CROSS product (the axis of rotation) 593 osg::Vec3d t = z ^ p; 594 595 // Get angle. length is magnitude of the vector 596 double angle = acos( (z * p) / p.length()); 597 598 // Create a cylinder between the two points with the given radius 599 cylinder = new osg::Cylinder(center,radius,height); 600 cylinder->setRotation(osg::Quat(angle, osg::Vec3(t.x(), t.y(), t.z()))); 601 602 cylinderDrawable = new osg::ShapeDrawable(cylinder ); 603 geode->addDrawable(cylinderDrawable); 604 605 // Set the color of the cylinder that extends between the two points. 606 pMaterial = new osg::Material; 607 pMaterial->setDiffuse( osg::Material::FRONT, CylinderColor); 608 geode->getOrCreateStateSet()->setAttribute( pMaterial, osg::StateAttribute::OVERRIDE ); 609 610 // Add the cylinder between the two points to an existing group 611 pAddToThisGroup->addChild(geode); 612 }
Note: See TracChangeset
for help on using the changeset viewer.