CEDRIC  Revision_backup-2009-02
CreatePlanarShadowVisitor.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * Copyright (C) 2008 Boris Iven, Max Hermann
4  *
5  * This file is part of the "CEDRIC Event Display" application.
6  *
7  *****************************************************************************/
8 
9 #ifndef CREATEPLANARSHADOWVISITOR_H
10 #define CREATEPLANARSHADOWVISITOR_H
11 
12 #include <osg/NodeVisitor>
13 #include <osg/Group>
14 #include <osg/Geode>
15 #include <osg/Geometry>
16 #include <osg/Billboard>
17 #include <osg/Transform>
18 #include <osg/ref_ptr>
19 
20 #include <stack>
21 
22 class CreatePlanarShadowVisitor : public osg::NodeVisitor
23 {
24 public:
26 
27  CreatePlanarShadowVisitor( int projectionPlane = XZ_PLANE,
28  double distance = -1.0,
29  osg::Vec4 shadowColor = osg::Vec4(0,0,0,1) );
30 
31  virtual void apply( osg::Geode& geode );
32 
33  virtual void apply( osg::Billboard& billboard );
34 
35  virtual void apply( osg::Transform& transform );
36 
37  osg::Node* getShadow() { return _shadowNode.get(); }
38 
39 protected:
40  osg::Geode* buildShadowFromGeometry( osg::Geometry* geom );
41 
42 private:
43  osg::ref_ptr<osg::Group> _shadowNode;
44 
45  osg::Vec3 _projectionAxis;
46  double _distance;
47  osg::Vec4 _shadowColor;
48 
49  std::stack<osg::Matrix> _matrixStack;
50 };
51 
52 #endif
Definition: CreatePlanarShadowVisitor.h:25
Definition: CreatePlanarShadowVisitor.h:25
CreatePlanarShadowVisitor(int projectionPlane=XZ_PLANE, double distance=-1.0, osg::Vec4 shadowColor=osg::Vec4(0, 0, 0, 1))
Definition: CreatePlanarShadowVisitor.cpp:20
Definition: CreatePlanarShadowVisitor.h:25
ProjectionPlane
Definition: CreatePlanarShadowVisitor.h:25
Definition: CreatePlanarShadowVisitor.h:22
osg::Node * getShadow()
Definition: CreatePlanarShadowVisitor.h:37
virtual void apply(osg::Geode &geode)
osg::Geode * buildShadowFromGeometry(osg::Geometry *geom)
Definition: CreatePlanarShadowVisitor.cpp:133