1 /*
2 This file is part of Warzone 2100.
3 Copyright (C) 1999-2004 Eidos Interactive
4 Copyright (C) 2005-2020 Warzone 2100 Project
5
6 Warzone 2100 is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 Warzone 2100 is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Warzone 2100; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 /***************************************************************************/
21 /*
22 * pieState.h
23 *
24 * render State controlr all pumpkin image library functions.
25 *
26 */
27 /***************************************************************************/
28
29 #ifndef _piestate_h
30 #define _piestate_h
31
32 /***************************************************************************/
33
34 #include <string>
35 #include <vector>
36
37 #include "lib/framework/frame.h"
38 #include "lib/framework/vector.h"
39 #include "lib/ivis_opengl/gfx_api.h"
40 #include <glm/gtc/type_ptr.hpp>
41 #include "piedef.h"
42
43 struct iIMDShape;
44
45 /***************************************************************************/
46 /*
47 * Global Definitions
48 */
49 /***************************************************************************/
50
51 struct RENDER_STATE
52 {
53 bool fogEnabled;
54 bool fog;
55 PIELIGHT fogColour;
56 float fogBegin;
57 float fogEnd;
58 SDWORD texPage;
59 REND_MODE rendMode;
60 };
61
62 void rendStatesRendModeHack(); // Sets rendStates.rendMode = REND_ALPHA; (Added during merge, since the renderStates is now static.)
63
64 /***************************************************************************/
65 /*
66 * Global ProtoTypes
67 */
68 /***************************************************************************/
69 void pie_SetDefaultStates();//Sets all states
70 //fog available
71 void pie_EnableFog(bool val);
72 bool pie_GetFogEnabled();
73 //fog currently on
74 void pie_SetFogStatus(bool val);
75 bool pie_GetFogStatus();
76 void pie_SetFogColour(PIELIGHT colour);
77 PIELIGHT pie_GetFogColour() WZ_DECL_PURE;
78 void pie_UpdateFogDistance(float begin, float end);
79 //render states
80 RENDER_STATE getCurrentRenderState();
81
82 int pie_GetMaxAntialiasing();
83
84 bool pie_LoadShaders();
85 void pie_FreeShaders();
86
87 namespace pie_internal
88 {
89 extern gfx_api::buffer* rectBuffer;
90 }
91
92 void pie_SetShaderStretchDepth(float stretch);
93 float pie_GetShaderTime();
94 float pie_GetShaderStretchDepth();
95 void pie_SetShaderTime(uint32_t shaderTime);
96 void pie_SetShaderEcmEffect(bool value);
97 int pie_GetShaderEcmEffect();
98
pal_PIELIGHTtoVec4(PIELIGHT rgba)99 static inline glm::vec4 pal_PIELIGHTtoVec4(PIELIGHT rgba)
100 {
101 return (1 / 255.0f) * glm::vec4{
102 rgba.byte.r,
103 rgba.byte.g,
104 rgba.byte.b,
105 rgba.byte.a
106 };
107 }
108
109 #endif // _pieState_h
110