Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. void MyCullVisitor::apply(osg::LightSource& node)
  2. {              
  3.    
  4.     osg::Matrixd inverseViewMatrix = osg::Matrixd::inverse(getCurrentCamera()->getViewMatrix());
  5.     osg::Matrixd worldMatrix = inverseViewMatrix * (*getModelViewMatrix());
  6.  
  7.     osg::Vec3d pos(node.getLight()->getPosition().x(), node.getLight()->getPosition().y(), node.getLight()->getPosition().z());
  8.     worldMatrix = osg::Matrixd::translate(pos) * worldMatrix;
  9.  
  10.     node.setUserValue("WorldMatrix", worldMatrix);
  11.     if (node.getLight()->getLightNum() == 0)
  12.     {
  13.         osgUtil::CullVisitor::apply(node);
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement