source: Swollen/swollen/directionallight.h @ 865

Last change on this file since 865 was 88, checked in by darran, 19 years ago
  • Commented out lighting marker pending removal (not a good paradigm)
  • Commented out "picture in picture" hack
  • compiles against OSG 0.9.9 on OSX, can't get focus on window and doesn't accept keyboard input
File size: 1.4 KB
Line 
1
2/*
3    DirectionalLight class
4
5    An OpenSceneGraph viewer for pyVolution .sww files.
6    copyright (C) 2004 Geoscience Australia
7*/
8
9
10#ifndef DIRECTIONALLIGHT_H
11#define DIRECTIONALLIGHT_H
12
13
14#include <project.h>
15#include <osg/Geode>
16#include <osg/Geometry>
17#include <osg/Group>
18#include <osg/Light>
19#include <osg/LightSource>
20#include <osg/MatrixTransform>
21#include <osg/StateAttribute>
22#include <osg/StateSet>
23#include <osg/Vec3>
24
25
26
27class DirectionalLight
28{
29
30public:
31
32    DirectionalLight(osg::StateSet* rootStateSet, int num=0);
33    virtual osg::Group* get(){ return _transform; }
34    virtual void setPosition(osg::Vec3 v);
35    virtual osg::Vec3f* getPosition(){ return _position; }
36    void setMatrix( osg::Matrixf matrix ){ _transform->setMatrix( matrix ); }
37    void setAmbient( osg::Vec3f v ){ _light->setAmbient(osg::Vec4(v,1)); }
38    void setDiffuse( osg::Vec3f v ){ _light->setDiffuse(osg::Vec4(v,1)); }
39    const osg::Matrix getMatrix(){ return _transform->getMatrix(); }
40    // void show(){ _marker->setNodeMask(1); }
41    // void hide(){ _marker->setNodeMask(0); }
42
43
44protected:
45
46    osg::MatrixTransform* _transform;
47    osg::Vec3* _position;
48    osg::Vec3* _target;
49    osg::Light* _light;
50    osg::LightSource* _source;
51
52    // osg::Node* _marker;
53    // osg::Cylinder* _shape;
54    // osg::Geometry* _geom;
55    // osg::StateSet* _stateset;
56
57    virtual ~DirectionalLight();
58
59};
60
61
62#endif  // DIRECTIONALLIGHT_H
Note: See TracBrowser for help on using the repository browser.