Line | |
---|
1 | |
---|
2 | |
---|
3 | /* |
---|
4 | SpotLight class |
---|
5 | |
---|
6 | An OpenSceneGraph viewer for pyVolution .sww files. |
---|
7 | copyright (C) 2004 Geoscience Australia |
---|
8 | */ |
---|
9 | |
---|
10 | |
---|
11 | #ifndef SPOTLIGHT_H |
---|
12 | #define SPOTLIGHT_H |
---|
13 | |
---|
14 | |
---|
15 | #include <project.h> |
---|
16 | #include <osg/Geode> |
---|
17 | #include <osg/Geometry> |
---|
18 | #include <osg/Group> |
---|
19 | #include <osg/Light> |
---|
20 | #include <osg/LightSource> |
---|
21 | #include <osg/MatrixTransform> |
---|
22 | #include <osg/StateAttribute> |
---|
23 | #include <osg/StateSet> |
---|
24 | #include <osg/Vec3> |
---|
25 | |
---|
26 | |
---|
27 | |
---|
28 | class SpotLight |
---|
29 | { |
---|
30 | |
---|
31 | public: |
---|
32 | |
---|
33 | SpotLight(osg::StateSet* rootStateSet, int num=0); |
---|
34 | virtual osg::Group* get(){ return _group; } |
---|
35 | virtual void setPosition(osg::Vec3 v); |
---|
36 | virtual osg::Vec3f* getPosition(){ return _position; } |
---|
37 | void setSpotAngle( float degrees ); |
---|
38 | void setMatrix( osg::Matrixf matrix ){ _group->setMatrix( matrix ); } |
---|
39 | void setAmbient( osg::Vec3f v ){ _light->setAmbient(osg::Vec4(v,1)); } |
---|
40 | void setDiffuse( osg::Vec3f v ){ _light->setDiffuse(osg::Vec4(v,1)); } |
---|
41 | const osg::Matrix getMatrix(){ return _group->getMatrix(); } |
---|
42 | |
---|
43 | |
---|
44 | protected: |
---|
45 | |
---|
46 | //osg::Group* _group; |
---|
47 | osg::MatrixTransform* _group; |
---|
48 | osg::Vec3* _position; |
---|
49 | osg::Vec3* _target; |
---|
50 | osg::Light* _light; |
---|
51 | osg::LightSource* _source; |
---|
52 | |
---|
53 | osg::Geode* _marker; |
---|
54 | osg::Cone* _shape; |
---|
55 | osg::Geometry* _geom; |
---|
56 | osg::StateSet* _stateset; |
---|
57 | virtual ~SpotLight(); |
---|
58 | |
---|
59 | }; |
---|
60 | |
---|
61 | |
---|
62 | #endif // SPOTLIGHT_H |
---|
Note: See
TracBrowser
for help on using the repository browser.