ScummVM API documentation
shaders.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_SHADERS_H
23 #define TWP_SHADERS_H
24 
25 #include "twp/room.h"
26 #include "math/vector3d.h"
27 
28 namespace Twp {
29 
30 extern const char *vsrc;
31 extern const char *bwShader;
32 extern const char *ghostShader;
33 extern const char *sepiaShader;
34 
35 struct ShaderParams {
36  RoomEffect effect = RoomEffect::None;
37  float sepiaFlicker = 1.f;
38  float randomValue[5] = {0.f, 0.f, 0.f, 0.f, 0.f};
39  float timeLapse = 0.f;
40  float iGlobalTime = 0.f;
41  float iNoiseThreshold = 1.f;
42  float iFade = 1.f;
43  float wobbleIntensity = 1.f;
44  Color shadows = Color(-0.3f, 0.f, 0.f);
45  Color midtones = Color(-0.2f, 0.f, 0.1f);
46  Color highlights = Color(0.f, 0.f, 0.2f);
47 
48  void updateShader();
49 };
50 
51 enum class FadeEffect {
52  None,
53  In,
54  Out,
55  Wobble
56 };
57 
58 class FadeShader : public Shader {
59 public:
60  FadeShader();
61  virtual ~FadeShader() override;
62 
63  int getNumTextures() override;
64  int getTexture(int index) override;
65  int getTextureLoc(int index) override;
66 
67 private:
68  void applyUniforms() override;
69 
70 public:
71  FadeEffect _effect = FadeEffect::None;
73  Texture *_texture1 = nullptr;
74  Texture *_texture2 = nullptr;
75  Math::Vector2d _cameraPos;
76  float _duration = 0.f;
77  float _elapsed = 0.f;
78  float _movement = 0.f; // movement for wobble effect
79  float _fade = 0.f; // fade value between [0.f,1.f]
80  bool _fadeToSepia = false; // true to fade to sepia
81 
82 private:
83  int _textureLoc[2];
84 };
85 
86 } // namespace Twp
87 
88 #endif
Definition: gfx.h:35
Definition: shaders.h:58
Definition: shaders.h:35
Definition: ptr.h:159
Definition: gfx.h:127
Definition: gfx.h:101
Definition: achievements_tables.h:27