Index: ddraw/fog.h |
— | — | @@ -1,21 +0,0 @@ |
2 | | -// DXGL
|
3 | | -// Copyright (C) 2012 William Feely
|
4 | | -
|
5 | | -// This library is free software; you can redistribute it and/or
|
6 | | -// modify it under the terms of the GNU Lesser General Public
|
7 | | -// License as published by the Free Software Foundation; either
|
8 | | -// version 2.1 of the License, or (at your option) any later version.
|
9 | | -
|
10 | | -// This library is distributed in the hope that it will be useful,
|
11 | | -// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 | | -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13 | | -// Lesser General Public License for more details.
|
14 | | -
|
15 | | -// You should have received a copy of the GNU Lesser General Public
|
16 | | -// License along with this library; if not, write to the Free Software
|
17 | | -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18 | | -
|
19 | | -void SetFogColor(DWORD color);
|
20 | | -void SetFogStart(GLfloat start);
|
21 | | -void SetFogEnd(GLfloat end);
|
22 | | -void SetFogDensity(GLfloat density); |
\ No newline at end of file |
Index: ddraw/fog.cpp |
— | — | @@ -1,57 +0,0 @@ |
2 | | -// DXGL
|
3 | | -// Copyright (C) 2012 William Feely
|
4 | | -
|
5 | | -// This library is free software; you can redistribute it and/or
|
6 | | -// modify it under the terms of the GNU Lesser General Public
|
7 | | -// License as published by the Free Software Foundation; either
|
8 | | -// version 2.1 of the License, or (at your option) any later version.
|
9 | | -
|
10 | | -// This library is distributed in the hope that it will be useful,
|
11 | | -// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 | | -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13 | | -// Lesser General Public License for more details.
|
14 | | -
|
15 | | -// You should have received a copy of the GNU Lesser General Public
|
16 | | -// License along with this library; if not, write to the Free Software
|
17 | | -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18 | | -
|
19 | | -#include "common.h"
|
20 | | -#include "fog.h"
|
21 | | -
|
22 | | -static DWORD fogcolor = 0;
|
23 | | -static GLfloat fogstart = 0;
|
24 | | -static GLfloat fogend = 1;
|
25 | | -static GLfloat fogdensity = 1;
|
26 | | -
|
27 | | -void SetFogColor(DWORD color)
|
28 | | -{
|
29 | | - if(color == fogcolor) return;
|
30 | | - fogcolor = color;
|
31 | | - GLfloat colors[4];
|
32 | | - colors[0] = (GLfloat)((color >> 16) & 255)/255.0f;
|
33 | | - colors[1] = (GLfloat)((color >> 8) & 255)/255.0f;
|
34 | | - colors[2] = (GLfloat)(color & 255)/255.0f;
|
35 | | - colors[3] = (GLfloat)((color >> 24) & 255)/255.0f;
|
36 | | - glFogfv(GL_FOG_COLOR,colors);
|
37 | | -}
|
38 | | -
|
39 | | -void SetFogStart(GLfloat start)
|
40 | | -{
|
41 | | - if(start == fogstart) return;
|
42 | | - fogstart = start;
|
43 | | - glFogf(GL_FOG_START,start);
|
44 | | -}
|
45 | | -
|
46 | | -void SetFogEnd(GLfloat end)
|
47 | | -{
|
48 | | - if(end == fogend) return;
|
49 | | - fogend = end;
|
50 | | - glFogf(GL_FOG_END,end);
|
51 | | -}
|
52 | | -
|
53 | | -void SetFogDensity(GLfloat density)
|
54 | | -{
|
55 | | - if(density == fogdensity) return;
|
56 | | - fogdensity = density;
|
57 | | - glFogf(GL_FOG_DENSITY,density);
|
58 | | -} |
\ No newline at end of file |
Index: ddraw/ddraw.vcxproj |
— | — | @@ -284,7 +284,6 @@ |
285 | 285 | <ClInclude Include="glRenderer.h" />
|
286 | 286 | <ClInclude Include="glRenderWindow.h" />
|
287 | 287 | <ClInclude Include="glutil.h" />
|
288 | | - <ClInclude Include="fog.h" />
|
289 | 288 | <ClInclude Include="include\d3d.h" />
|
290 | 289 | <ClInclude Include="include\d3dcaps.h" />
|
291 | 290 | <ClInclude Include="include\d3dtypes.h" />
|
— | — | @@ -324,7 +323,6 @@ |
325 | 324 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release no DXGL|Win32'">
|
326 | 325 | </PrecompiledHeader>
|
327 | 326 | </ClCompile>
|
328 | | - <ClCompile Include="fog.cpp" />
|
329 | 327 | <ClCompile Include="glClassFactory.cpp" />
|
330 | 328 | <ClCompile Include="dxguid.cpp">
|
331 | 329 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
Index: ddraw/ddraw.vcxproj.filters |
— | — | @@ -119,9 +119,6 @@ |
120 | 120 | <ClInclude Include="texture.h">
|
121 | 121 | <Filter>Header Files</Filter>
|
122 | 122 | </ClInclude>
|
123 | | - <ClInclude Include="fog.h">
|
124 | | - <Filter>Header Files</Filter>
|
125 | | - </ClInclude>
|
126 | 123 | <ClInclude Include="glDirect3DExecuteBuffer.h">
|
127 | 124 | <Filter>Header Files</Filter>
|
128 | 125 | </ClInclude>
|
— | — | @@ -214,9 +211,6 @@ |
215 | 212 | <ClCompile Include="texture.cpp">
|
216 | 213 | <Filter>Source Files</Filter>
|
217 | 214 | </ClCompile>
|
218 | | - <ClCompile Include="fog.cpp">
|
219 | | - <Filter>Source Files</Filter>
|
220 | | - </ClCompile>
|
221 | 215 | <ClCompile Include="glDirect3DExecuteBuffer.cpp">
|
222 | 216 | <Filter>Source Files</Filter>
|
223 | 217 | </ClCompile>
|
Index: ddraw/glRenderer.cpp |
— | — | @@ -17,7 +17,6 @@ |
18 | 18 |
|
19 | 19 | #include "common.h"
|
20 | 20 | #include "texture.h"
|
21 | | -#include "fog.h"
|
22 | 21 | #include "glutil.h"
|
23 | 22 | #include "timer.h"
|
24 | 23 | #include "glDirectDraw.h"
|
— | — | @@ -192,6 +191,10 @@ |
193 | 192 | */
|
194 | 193 | glRenderer::glRenderer(int width, int height, int bpp, bool fullscreen, unsigned int frequency, HWND hwnd, glDirectDraw7 *glDD7)
|
195 | 194 | {
|
| 195 | + fogcolor = 0;
|
| 196 | + fogstart = 0.0f;
|
| 197 | + fogend = 1.0f;
|
| 198 | + fogdensity = 1.0f;
|
196 | 199 | backbuffer = NULL;
|
197 | 200 | hDC = NULL;
|
198 | 201 | hRC = NULL;
|
— | — | @@ -821,10 +824,10 @@ |
822 | 825 | glEnable(GL_CULL_FACE);
|
823 | 826 | SwapBuffers(hDC);
|
824 | 827 | SetActiveTexture(0);
|
825 | | - SetFogColor(0);
|
826 | | - SetFogStart(0);
|
827 | | - SetFogEnd(1);
|
828 | | - SetFogDensity(1);
|
| 828 | + _SetFogColor(0);
|
| 829 | + _SetFogStart(0);
|
| 830 | + _SetFogEnd(1);
|
| 831 | + _SetFogDensity(1);
|
829 | 832 | SetPolyMode(D3DFILL_SOLID);
|
830 | 833 | SetShadeMode(D3DSHADE_GOURAUD);
|
831 | 834 | if(hWnd)
|
— | — | @@ -1625,10 +1628,10 @@ |
1626 | 1629 | else BlendEnable(false);
|
1627 | 1630 | SetBlend(device->renderstate[D3DRENDERSTATE_SRCBLEND],device->renderstate[D3DRENDERSTATE_DESTBLEND]);
|
1628 | 1631 | SetCull((D3DCULL)device->renderstate[D3DRENDERSTATE_CULLMODE]);
|
1629 | | - SetFogColor(device->renderstate[D3DRENDERSTATE_FOGCOLOR]);
|
1630 | | - SetFogStart(*(GLfloat*)(&device->renderstate[D3DRENDERSTATE_FOGSTART]));
|
1631 | | - SetFogEnd(*(GLfloat*)(&device->renderstate[D3DRENDERSTATE_FOGEND]));
|
1632 | | - SetFogDensity(*(GLfloat*)(&device->renderstate[D3DRENDERSTATE_FOGDENSITY]));
|
| 1632 | + _SetFogColor(device->renderstate[D3DRENDERSTATE_FOGCOLOR]);
|
| 1633 | + _SetFogStart(*(GLfloat*)(&device->renderstate[D3DRENDERSTATE_FOGSTART]));
|
| 1634 | + _SetFogEnd(*(GLfloat*)(&device->renderstate[D3DRENDERSTATE_FOGEND]));
|
| 1635 | + _SetFogDensity(*(GLfloat*)(&device->renderstate[D3DRENDERSTATE_FOGDENSITY]));
|
1633 | 1636 | SetPolyMode((D3DFILLMODE)device->renderstate[D3DRENDERSTATE_FILLMODE]);
|
1634 | 1637 | SetShadeMode((D3DSHADEMODE)device->renderstate[D3DRENDERSTATE_SHADEMODE]);
|
1635 | 1638 | if(indices) glDrawElements(mode,indexcount,GL_UNSIGNED_SHORT,indices);
|
— | — | @@ -1645,4 +1648,37 @@ |
1646 | 1649 | {
|
1647 | 1650 | ::DeleteFBO(fbo);
|
1648 | 1651 | SetEvent(busy);
|
1649 | | -} |
\ No newline at end of file |
| 1652 | +}
|
| 1653 | +
|
| 1654 | +void glRenderer::_SetFogColor(DWORD color)
|
| 1655 | +{
|
| 1656 | + if (color == fogcolor) return;
|
| 1657 | + fogcolor = color;
|
| 1658 | + GLfloat colors[4];
|
| 1659 | + colors[0] = (GLfloat)((color >> 16) & 255) / 255.0f;
|
| 1660 | + colors[1] = (GLfloat)((color >> 8) & 255) / 255.0f;
|
| 1661 | + colors[2] = (GLfloat)(color & 255) / 255.0f;
|
| 1662 | + colors[3] = (GLfloat)((color >> 24) & 255) / 255.0f;
|
| 1663 | + glFogfv(GL_FOG_COLOR, colors);
|
| 1664 | +}
|
| 1665 | +
|
| 1666 | +void glRenderer::_SetFogStart(GLfloat start)
|
| 1667 | +{
|
| 1668 | + if (start == fogstart) return;
|
| 1669 | + fogstart = start;
|
| 1670 | + glFogf(GL_FOG_START, start);
|
| 1671 | +}
|
| 1672 | +
|
| 1673 | +void glRenderer::_SetFogEnd(GLfloat end)
|
| 1674 | +{
|
| 1675 | + if (end == fogend) return;
|
| 1676 | + fogend = end;
|
| 1677 | + glFogf(GL_FOG_END, end);
|
| 1678 | +}
|
| 1679 | +
|
| 1680 | +void glRenderer::_SetFogDensity(GLfloat density)
|
| 1681 | +{
|
| 1682 | + if (density == fogdensity) return;
|
| 1683 | + fogdensity = density;
|
| 1684 | + glFogf(GL_FOG_DENSITY, density);
|
| 1685 | +}
|
Index: ddraw/glRenderer.h |
— | — | @@ -122,6 +122,10 @@ |
123 | 123 | void _Flush();
|
124 | 124 | void _SetWnd(int width, int height, int fullscreen, int bpp, unsigned int frequency, HWND newwnd);
|
125 | 125 | void _DeleteFBO(FBO *fbo);
|
| 126 | + void _SetFogColor(DWORD color);
|
| 127 | + void _SetFogStart(GLfloat start);
|
| 128 | + void _SetFogEnd(GLfloat end);
|
| 129 | + void _SetFogDensity(GLfloat density);
|
126 | 130 | int opcode;
|
127 | 131 | void* inputs[32];
|
128 | 132 | void* outputs[32];
|
— | — | @@ -140,6 +144,10 @@ |
141 | 145 | TEXTURE *backbuffer;
|
142 | 146 | int backx;
|
143 | 147 | int backy;
|
| 148 | + DWORD fogcolor;
|
| 149 | + GLfloat fogstart;
|
| 150 | + GLfloat fogend;
|
| 151 | + GLfloat fogdensity;
|
144 | 152 | };
|
145 | 153 |
|
146 | 154 | #endif //_GLRENDERER_H |
\ No newline at end of file |