ScummVM API documentation
lighting.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 TWP_LIGHTING_H
23 #define TWP_LIGHTING_H
24 
25 #include "twp/gfx.h"
26 #include "twp/spritesheet.h"
27 
28 #define MAX_LIGHTS 50
29 
30 namespace Twp {
31 
32 struct Lights;
33 
34 class Lighting : public Shader {
35 public:
36  Lighting();
37  virtual ~Lighting();
38 
39  void setSpriteOffset(const Math::Vector2d &offset);
40  void setSpriteSheetFrame(const SpriteSheetFrame &frame, const Texture &getNumTextures, bool flipX);
41 
42  void update(const Lights &lights);
43 
44 private:
45  virtual void applyUniforms() final;
46 
47 public:
48  Math::Vector2d _contentSize;
49  Math::Vector2d _spriteOffset;
50  Math::Vector2d _spritePosInSheet;
51  Math::Vector2d _spriteSizeRelToSheet;
52 
53  bool _debug = false; // if true change the way we draw the lights to debug them easily
54  Color _ambientLight; // Ambient light color
55  int u_numberLights = 0;
56  float u_lightPos[3 * MAX_LIGHTS];
57  float u_coneDirection[2 * MAX_LIGHTS];
58  float u_coneCosineHalfConeAngle[MAX_LIGHTS];
59  float u_coneFalloff[MAX_LIGHTS];
60  float u_lightColor[3 * MAX_LIGHTS];
61  float u_brightness[MAX_LIGHTS];
62  float u_cutoffRadius[MAX_LIGHTS];
63  float u_halfRadius[MAX_LIGHTS];
64 
65 private:
66  bool _currentDebug = false;
67 };
68 
69 } // namespace Twp
70 
71 #endif
Definition: room.h:91
Definition: gfx.h:35
Definition: lighting.h:34
Definition: gfx.h:127
Definition: gfx.h:101
Definition: achievements_tables.h:27
Definition: spritesheet.h:37