summaryrefslogtreecommitdiff
path: root/cad/plugins/NanoVision-1/src/Plugins/RenderingEngines/OpenGL/GLT/glt_light.h
blob: ea2195eb9168a31952a44266b14a52a74822edab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#ifndef GLT_LIGHT_H
#define GLT_LIGHT_H

/*

  GLT OpenGL C++ Toolkit      
  Copyright (C) 2000-2002 Nigel Stewart
  Email: nigels@nigels.com   WWW: http://www.nigels.com/glt/

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*/

/*! \file 
    \brief OpenGL Light Source Class
    \ingroup GLT

    $Id: light.h,v 1.8 2002/10/07 16:33:35 nigels Exp $

    $Log: light.h,v $
    Revision 1.8  2002/10/07 16:33:35  nigels
    Added CVS info


*/

#include "glt_gl.h"

#include <iosfwd>

#include "glt_vector3.h"
#include "glt_color.h"

/*! \class GltLight
    \brief OpenGL Light Source Class
    \ingroup GLT

    Convenient manipulation of lightsource configuration.
*/

class GltLight
{
public:
	
	/// Constructor
	GltLight(const GLenum light = GL_LIGHT0,const bool getIt = false);
	/// Destructor
	~GltLight();

	/// Get the current OpenGL light settings
	void get();
	/// Set the current OpenGL light settings
	void set() const;

	GLenum   &light();
	bool     &isEnabled();
	GltColor &ambient();
	GltColor &diffuse();
	GltColor &specular();
	Vector   &position();
        bool     &isDirectional();
	Vector   &spotDirection();
	GLfloat  &spotExponent();
	GLfloat  &spotCutoff();
	GLfloat  &attenutationConstant();
	GLfloat  &attenutationLinear();
	GLfloat  &attenutationQuadratic();
        bool     &inEyeSpace();
    
	const GLenum   &light() const;
	const bool     &isEnabled() const;
	const GltColor &ambient() const;
	const GltColor &diffuse() const;
	const GltColor &specular() const;
	const Vector   &position() const;
        const bool     &isDirectional() const;
	const Vector   &spotDirection() const;
	const GLfloat  &spotExponent() const;
	const GLfloat  &spotCutoff() const;
	const GLfloat  &attenutationConstant() const;
	const GLfloat  &attenutationLinear() const;
	const GLfloat  &attenutationQuadratic() const;
        const bool     &inEyeSpace() const;
    
private:

	GLenum  _light;
	bool    _isEnabled;

	GltColor _ambient;
	GltColor _diffuse;
	GltColor _specular;
	Vector   _position;
        bool     _isDirectional;
	Vector   _spotDirection;
	GLfloat  _spotExponent;
	GLfloat  _spotCutoff;
	GLfloat  _attenuationConstant;
	GLfloat  _attenuationLinear;
	GLfloat  _attenuationQuadratic;
        bool     _inEyeSpace;

	const static GltColor _ambientDefault;
	const static GltColor _diffuseDefault;
	const static GltColor _specularDefault;
	const static Vector   _positionDefault;
	const static Vector   _spotDirectionDefault;
	const static GLfloat  _spotExponentDefault;
	const static GLfloat  _spotCutoffDefault;
	const static GLfloat  _attenuationConstantDefault;
	const static GLfloat  _attenuationLinearDefault;
	const static GLfloat  _attenuationQuadraticDefault;
};

#endif