ScummVM API documentation
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 BLADERUNNER_LIGHT_H
23 #define BLADERUNNER_LIGHT_H
24 
25 #include "bladerunner/matrix.h"
26 #include "bladerunner/color.h"
27 
28 #include "common/stream.h"
29 
30 namespace Common{
31 class ReadStream;
32 }
33 
34 namespace BladeRunner {
35 
36 class Lights;
37 
38 class Light {
39  friend class Debugger;
40  friend class Lights;
41  friend class SliceRenderer;
42 
43 protected:
44  Common::String _name;
45 
46  int _frameCount;
47  int _animated;
48  int _animatedParameters;
49  Matrix4x3 _matrix;
50  Color _color;
51  float _falloffStart;
52  float _falloffEnd;
53  float _angleStart;
54  float _angleEnd;
55  float *_animationData;
56  float *_m11ptr;
57  float *_m12ptr;
58  float *_m13ptr;
59  float *_m14ptr;
60  float *_m21ptr;
61  float *_m22ptr;
62  float *_m23ptr;
63  float *_m24ptr;
64  float *_m31ptr;
65  float *_m32ptr;
66  float *_m33ptr;
67  float *_m34ptr;
68  float *_colorRPtr;
69  float *_colorGPtr;
70  float *_colorBPtr;
71  float *_falloffStartPtr;
72  float *_falloffEndPtr;
73  float *_angleStartPtr;
74  float *_angleEndPtr;
75 
76 public:
77  Light();
78  virtual ~Light();
79 
80  void read(Common::ReadStream *stream, int frameCount, int frame, int animated);
81  void readVqa(Common::ReadStream *stream, int frameCount, int frame, int animated);
82 
83  void setupFrame(int frame);
84 
85  virtual float calculate(Vector3 start, Vector3 end) const;
86  virtual void calculateColor(Color *outColor, Vector3 position) const;
87 
88 protected:
89  float calculateFalloutCoefficient(Vector3 start, Vector3 end, float a3, float a4) const;
90  float attenuation(float min, float max, float distance) const;
91 };
92 
93 class Light1 : public Light {
94  float calculate(Vector3 start, Vector3 end) const override;
95  void calculateColor(Color *outColor, Vector3 position) const override;
96 };
97 
98 class Light2 : public Light {
99  float calculate(Vector3 start, Vector3 end) const override;
100  void calculateColor(Color *outColor, Vector3 position) const override;
101 };
102 
103 class Light3 : public Light {
104  void calculateColor(Color *outColor, Vector3 position) const override;
105 };
106 
107 class Light4 : public Light {
108  void calculateColor(Color *outColor, Vector3 position) const override;
109 };
110 
111 class LightAmbient : public Light {
112  float calculate(Vector3 start, Vector3 end) const override;
113  void calculateColor(Color *outColor, Vector3 position) const override;
114 };
115 
116 } // End of namespace BladeRunner
117 
118 #endif
Definition: light.h:93
Definition: str.h:59
Definition: actor.h:31
Definition: light.h:107
Definition: light.h:38
Definition: color.h:29
Definition: light.h:103
Definition: matrix.h:74
Definition: light.h:111
Definition: algorithm.h:29
Definition: lights.h:33
Definition: debugger.h:56
Definition: vector.h:47
Definition: stream.h:385
Definition: slice_renderer.h:45
Definition: light.h:98