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 _transform; } |
---|
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 ){ _transform->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 _transform->getMatrix(); } |
---|
42 | |
---|
43 | |
---|
44 | protected: |
---|
45 | |
---|
46 | osg::MatrixTransform* _transform; |
---|
47 | osg::Vec3* _position; |
---|
48 | osg::Vec3* _target; |
---|
49 | osg::Light* _light; |
---|
50 | osg::LightSource* _source; |
---|
51 | |
---|
52 | osg::Geode* _marker; |
---|
53 | osg::Cone* _shape; |
---|
54 | osg::Geometry* _geom; |
---|
55 | osg::StateSet* _stateset; |
---|
56 | virtual ~SpotLight(); |
---|
57 | |
---|
58 | }; |
---|
59 | |
---|
60 | |
---|
61 | #endif // SPOTLIGHT_H |
---|
Note: See
TracBrowser
for help on using the repository browser.