Show
Ignore:
Timestamp:
11/23/06 17:55:46 (8 years ago)
Author:
robert
Message:

First cut at generating the ShadowVolumeGeometry?

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgshadow/osgshadow.cpp

    r5705 r5746  
    5454    } 
    5555     
     56    const osg::BoundingSphere& bs = model->getBound(); 
     57    osg::Plane basePlane(0.0, 0.0, 1.0, -( bs.center().z() - bs.radius() ) ); 
    5658     
    5759    osg::ref_ptr<osg::Geode> geode = new osg::Geode; 
     
    5961    osg::ref_ptr<osgShadow::OccluderGeometry> occluder = new osgShadow::OccluderGeometry; 
    6062    occluder->computeOccluderGeometry(model.get()); 
     63    occluder->getBoundingPolytope().add(basePlane); 
     64    //geode->addDrawable(occluder.get()); 
    6165     
    62     geode->addDrawable(occluder.get()); 
     66    osg::ref_ptr<osgShadow::ShadowVolumeGeometry> shadowVolume = new osgShadow::ShadowVolumeGeometry; 
     67    occluder->comptueShadowVolumeGeometry(osg::Vec4(0.0f,-.5f,-1.0f,0.0f), *shadowVolume); 
     68    geode->addDrawable(shadowVolume.get()); 
    6369 
    64     viewer.setSceneData(geode.get()); 
     70 
     71    osg::ref_ptr<osg::Group> group = new osg::Group; 
     72    group->addChild(model.get()); 
     73    group->addChild(geode.get()); 
     74 
     75 
     76    viewer.setSceneData(group.get()); 
    6577 
    6678    // create the windows and run the threads.