ScummVM API documentation
te_light.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef TETRAEDGE_TE_TE_LIGHT_H
23 #define TETRAEDGE_TE_TE_LIGHT_H
24 
25 #include "tetraedge/te/te_vector3f32.h"
26 #include "tetraedge/te/te_vector2f32.h"
27 #include "tetraedge/te/te_color.h"
28 
29 namespace Tetraedge {
30 
31 enum TeLightType {
32  LightTypePoint = 0,
33  LightTypeDirectional = 1,
34  LightTypeSpot = 2
35 };
36 
37 class TeCamera;
38 
39 class TeLight {
40 public:
41  TeLight();
42  virtual ~TeLight() {};
43 
44  TeVector3f32 directionVector() const;
45  virtual void disable(uint lightno) = 0;
46  virtual void enable(uint lightno) = 0;
47 
48  virtual void draw(TeCamera &camera) = 0;
49 
50  void transformDirPoint(const TeVector3f32 &pt1, TeVector3f32 &pt2);
51  void transformSpotPoint(TeVector3f32 &pt1);
52 
53  virtual void update(uint lightno) = 0;
54  static void setGlobalAmbient(const TeColor &col) { _globalAmbientColor = col.getPacked32(); }
55  static TeColor globalAmbient() { return TeColor(_globalAmbientColor); }
56 
57  void setSpecular(const TeColor &col) { _colSpecular = col; }
58  void setDiffuse(const TeColor &col) { _colDiffuse = col; }
59  void setAmbient(const TeColor &col) { _colAmbient = col; }
60 
61  void setConstAtten(float val) { _constAtten = val; }
62  void setLinearAtten(float val) { _linearAtten = val; }
63  void setQuadraticAtten(float val) { _quadraticAtten = val; }
64  void setCutoff(float val) { _cutoff = val; }
65  void setExponent(float val) { _exponent = val; }
66  void setDisplaySize(float val) { _displaySize = val; }
67  void setPosition3d(const TeVector3f32 &pos) { _position3d = pos; }
68  void setPositionRadial(const TeVector2f32 &pos) { _positionRadial = pos; }
69  void setType(TeLightType ltype) { _type = ltype; }
70 
71  const TeVector2f32 &positionRadial() const { return _positionRadial; }
72  const TeVector3f32 &position3d() const { return _position3d; }
73 
74  Common::String dump() const;
75  void correctAttenuation();
76 
77  static TeLight *makeInstance();
78 
79 protected:
80  TeVector3f32 _position3d;
81  TeVector2f32 _positionRadial;
82 
83  TeColor _colAmbient;
84  TeColor _colDiffuse;
85  TeColor _colSpecular;
86 
87  enum TeLightType _type;
88 
89  static uint32 _globalAmbientColor;
90 
91  float _constAtten;
92  float _linearAtten;
93  float _quadraticAtten;
94  float _cutoff;
95  float _exponent;
96  float _displaySize;
97 };
98 
99 } // end namespace Tetraedge
100 
101 #endif // TETRAEDGE_TE_TE_LIGHT_H
Definition: te_camera.h:38
Definition: str.h:59
Definition: detection.h:27
Definition: te_color.h:30
Definition: te_vector3f32.h:33
Definition: te_vector2f32.h:32
Definition: te_light.h:39