1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
/*
This file is part of Warzone 2100.
Copyright (C) 1999-2004 Eidos Interactive
Copyright (C) 2005-2010 Warzone 2100 Project
Warzone 2100 is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Warzone 2100 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Warzone 2100; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "piestate.h"
unsigned int pieStateCount = 0; // Used in pie_GetResetCounts
RENDER_STATE rendStates;
void pie_SetDefaultStates(void)//Sets all states
{
PIELIGHT black;
//fog off
rendStates.fogEnabled = false;// enable fog before renderer
rendStates.fog = false;//to force reset to false
pie_SetFogStatus(false);
black.rgba = 0;
black.byte.a = 255;
pie_SetFogColour(black);//nicks colour
//depth Buffer on
pie_SetDepthBufferStatus(DEPTH_CMP_LEQ_WRT_ON);
rendStates.transMode = TRANS_ALPHA;//to force reset to DECAL
pie_SetTranslucencyMode(TRANS_DECAL);
//chroma keying on black
rendStates.keyingOn = false;//to force reset to true
pie_SetAlphaTest(true);
}
//***************************************************************************
//
// pie_EnableFog(BOOL val)
//
// Global enable/disable fog to allow fog to be turned of ingame
//
//***************************************************************************
void pie_EnableFog(BOOL val)
{
if (rendStates.fogEnabled != val)
{
debug(LOG_FOG, "pie_EnableFog: Setting fog to %s", val ? "ON" : "OFF");
rendStates.fogEnabled = val;
if (val == true)
{
PIELIGHT nickscolour;
nickscolour.byte.r = 0xB0;
nickscolour.byte.g = 0x08;
nickscolour.byte.b = 0x5f;
nickscolour.byte.a = 0xff;
pie_SetFogColour(nickscolour); // nicks colour
}
else
{
PIELIGHT black;
black.rgba = 0;
black.byte.a = 255;
pie_SetFogColour(black); // clear background to black
}
}
}
BOOL pie_GetFogEnabled(void)
{
return rendStates.fogEnabled;
}
//***************************************************************************
//
// pie_SetFogStatus(BOOL val)
//
// Toggle fog on and off for rendering objects inside or outside the 3D world
//
//***************************************************************************
BOOL pie_GetFogStatus(void)
{
return rendStates.fog;
}
void pie_SetFogColour(PIELIGHT colour)
{
rendStates.fogColour = colour;
}
PIELIGHT pie_GetFogColour(void)
{
return rendStates.fogColour;
}
void pie_SetRendMode(REND_MODE rendMode)
{
if (rendMode != rendStates.rendMode)
{
rendStates.rendMode = rendMode;
switch (rendMode)
{
case REND_FLAT:
case REND_GOURAUD_TEX:
pie_SetTranslucencyMode(TRANS_DECAL);
break;
case REND_ALPHA_TEX:
case REND_ALPHA_FLAT:
pie_SetTranslucencyMode(TRANS_ALPHA);
break;
case REND_ADDITIVE_TEX:
case REND_ALPHA_ITERATED:
pie_SetTranslucencyMode(TRANS_ADDITIVE);
break;
default:
break;
}
}
return;
}
|