ScummVM API documentation
fog.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_FOG_H
23 #define BLADERUNNER_FOG_H
24 
25 #include "bladerunner/color.h"
26 #include "bladerunner/matrix.h"
27 
28 namespace Common {
29  class ReadStream;
30 }
31 
32 namespace BladeRunner {
33 
34 class SetEffects;
35 
36 class Fog {
37  friend class SetEffects;
38  friend class Debugger;
39 
40 protected:
41  Common::String _name;
42 
43  int _frameCount;
44  int _animatedParameters;
45  Matrix4x3 _matrix;
46  Matrix4x3 _inverted;
47  Color _fogColor;
48  float _fogDensity;
49  float *_animationData;
50  float *_m11ptr;
51  float *_m12ptr;
52  float *_m13ptr;
53  float *_m14ptr;
54  float *_m21ptr;
55  float *_m22ptr;
56  float *_m23ptr;
57  float *_m24ptr;
58  float *_m31ptr;
59  float *_m32ptr;
60  float *_m33ptr;
61  float *_m34ptr;
62 
63  Fog *_next;
64 
65 public:
66  Fog();
67  virtual ~Fog();
68 
69  virtual void read(Common::ReadStream *stream, int frameCount) = 0;
70  virtual void calculateCoeficient(Vector3 position, Vector3 viewPosition, float *coeficient) = 0;
71  void reset();
72 
73  void setupFrame(int frame);
74 
75 protected:
76  int readCommon(Common::ReadStream *stream);
77  void readAnimationData(Common::ReadStream *stream, int count);
78 
79 };
80 
81 class FogSphere : public Fog {
82 private:
83  float _radius_sq;
84 
85 public:
86  FogSphere():_radius_sq(0.0f) {};
87 
88  void read(Common::ReadStream *stream, int frameCount) override;
89  void calculateCoeficient(Vector3 position, Vector3 viewPosition, float *coeficient) override;
90 };
91 
92 class FogCone : public Fog {
93 private:
94  float _tan_coneAngle_sq;
95  float _cos_coneAngle;
96 
97 public:
98  FogCone():_tan_coneAngle_sq(0.0f), _cos_coneAngle(1.0f) {};
99 
100  void read(Common::ReadStream *stream, int frameCount) override;
101  void calculateCoeficient(Vector3 position, Vector3 viewPosition, float *coeficient) override;
102 };
103 
104 class FogBox : public Fog {
105 private:
106  Vector3 _size;
107 
108 public:
109  FogBox():_size() {};
110 
111  void read(Common::ReadStream *stream, int frameCount) override;
112  void calculateCoeficient(Vector3 position, Vector3 viewPosition, float *coeficient) override;
113 };
114 
115 } // End of namespace BladeRunner
116 
117 #endif
Definition: str.h:59
Definition: actor.h:31
Definition: fog.h:92
Definition: color.h:29
Definition: set_effects.h:33
Definition: fog.h:36
Definition: matrix.h:74
Definition: algorithm.h:29
Definition: fog.h:104
Definition: debugger.h:56
Definition: vector.h:47
Definition: stream.h:385
Definition: fog.h:81