|
|
@@ -16,7 +16,7 @@
|
|
|
//
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
-#include "config_dxgsg.h"
|
|
|
+#include "config_dxgsg8.h"
|
|
|
#include <graphicsWindow.h>
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -30,12 +30,12 @@ enable_line_smooth(bool val) {
|
|
|
_line_smooth_enabled = val;
|
|
|
#ifdef NDEBUG
|
|
|
{
|
|
|
- if(val && (scrn.D3DDevDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ANTIALIASEDGES))
|
|
|
+ if(val && (scrn.d3dcaps.RasterCaps & D3DPRASTERCAPS_ANTIALIASEDGES))
|
|
|
dxgsg_cat.error() << "no HW support for line smoothing!!\n";
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
- scrn.pD3DDevice->SetRenderState(D3DRENDERSTATE_EDGEANTIALIAS, (DWORD)val);
|
|
|
+ scrn.pD3DDevice->SetRenderState(D3DRS_EDGEANTIALIAS, (DWORD)val);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -47,7 +47,7 @@ enable_line_smooth(bool val) {
|
|
|
INLINE void DXGraphicsStateGuardian::
|
|
|
enable_lighting(bool val) {
|
|
|
if (_lighting_enabled != val) {
|
|
|
- scrn.pD3DDevice->SetRenderState(D3DRENDERSTATE_LIGHTING, (DWORD)val);
|
|
|
+ scrn.pD3DDevice->SetRenderState(D3DRS_LIGHTING, (DWORD)val);
|
|
|
if(_lighting_enabled = val)
|
|
|
_lighting_enabled_this_frame = true;
|
|
|
}
|
|
|
@@ -64,14 +64,14 @@ enable_dither(bool val) {
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
{
|
|
|
- if(val && !(scrn.D3DDevDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_DITHER))
|
|
|
+ if(val && !(scrn.d3dcaps.RasterCaps & D3DPRASTERCAPS_DITHER))
|
|
|
dxgsg_cat.error() << "no HW support for color dithering!!\n";
|
|
|
return;
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
_dither_enabled = val;
|
|
|
- scrn.pD3DDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, (DWORD)val);
|
|
|
+ scrn.pD3DDevice->SetRenderState(D3DRS_DITHERENABLE, (DWORD)val);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -84,7 +84,7 @@ INLINE void DXGraphicsStateGuardian::
|
|
|
enable_stencil_test(bool val) {
|
|
|
if (_stencil_test_enabled != val) {
|
|
|
_stencil_test_enabled = val;
|
|
|
- scrn.pD3DDevice->SetRenderState(D3DRENDERSTATE_STENCILENABLE, (DWORD)val);
|
|
|
+ scrn.pD3DDevice->SetRenderState(D3DRS_STENCILENABLE, (DWORD)val);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -100,27 +100,55 @@ enable_color_material(bool val) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: DXGraphicsStateGuardian::enable_clip_plane
|
|
|
// Access:
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void DXGraphicsStateGuardian::
|
|
|
-enable_clip_plane(int clip_plane, bool val)
|
|
|
+enable_clip_plane(int clip_plane_id, bool val)
|
|
|
{
|
|
|
- if (_clip_plane_enabled[clip_plane] != val)
|
|
|
- {
|
|
|
- _clip_plane_enabled[clip_plane] = val;
|
|
|
+ assert(clip_plane_id < D3DMAXUSERCLIPPLANES);
|
|
|
+
|
|
|
+ if (_clip_plane_enabled[clip_plane_id] != val) {
|
|
|
+ DWORD bitflag = 1 << clip_plane_id;
|
|
|
+
|
|
|
+ _clip_plane_enabled[clip_plane_id] = val;
|
|
|
DWORD ClipPlaneBits;
|
|
|
- scrn.pD3DDevice->GetRenderState(D3DRENDERSTATE_CLIPPLANEENABLE , &ClipPlaneBits);
|
|
|
+ scrn.pD3DDevice->GetRenderState(D3DRS_CLIPPLANEENABLE , &ClipPlaneBits);
|
|
|
if (val)
|
|
|
- ClipPlaneBits |= 1 << clip_plane;
|
|
|
+ ClipPlaneBits |= bitflag;
|
|
|
else
|
|
|
- ClipPlaneBits &= ~(1 << clip_plane);
|
|
|
- scrn.pD3DDevice->SetRenderState(D3DRENDERSTATE_CLIPPLANEENABLE , ClipPlaneBits);
|
|
|
- }
|
|
|
+ ClipPlaneBits &= ~bitflag;
|
|
|
+ scrn.pD3DDevice->SetRenderState(D3DRS_CLIPPLANEENABLE , ClipPlaneBits);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+#if 0
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+// Function: DXGraphicsStateGuardian::enable_clip_plane
|
|
|
+// Access:
|
|
|
+// Description:
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+INLINE void DXGraphicsStateGuardian::
|
|
|
+enable_clip_plane(int clip_plane_id, bool val)
|
|
|
+{
|
|
|
+ assert(clip_plane_id < D3DMAXUSERCLIPPLANES);
|
|
|
+
|
|
|
+ // clip plane stuff needs total rewriting to get rid of these arrays
|
|
|
+// if (((_clip_planes_enabled & bitflag)!=0) != val)
|
|
|
+ if (_clip_plane_enabled[clip_plane_id] != val) {
|
|
|
+ _clip_plane_enabled[clip_plane_id] = val;
|
|
|
+ if(val)
|
|
|
+ _clip_plane_enabled |= bitflag;
|
|
|
+ else _clip_plane_enabled &= ~bitflag;
|
|
|
+
|
|
|
+ scrn.pD3DDevice->SetRenderState(D3DRS_CLIPPLANEENABLE , _clip_planes_enabled);
|
|
|
+ }
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: DXGraphicsStateGuardian::enable_blend
|
|
|
// Access:
|
|
|
@@ -130,7 +158,7 @@ INLINE void DXGraphicsStateGuardian::
|
|
|
enable_blend(bool val) {
|
|
|
if (_blend_enabled != val) {
|
|
|
_blend_enabled = val;
|
|
|
- scrn.pD3DDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, (DWORD)val);
|
|
|
+ scrn.pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, (DWORD)val);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -140,10 +168,10 @@ enable_blend(bool val) {
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void DXGraphicsStateGuardian::
|
|
|
-set_shademode(D3DSHADEMODE val) {
|
|
|
- if (_CurShadeMode != val) {
|
|
|
- _CurShadeMode = val;
|
|
|
- scrn.pD3DDevice->SetRenderState(D3DRENDERSTATE_SHADEMODE, (DWORD)val);
|
|
|
+enable_gouraud_shading(bool val) {
|
|
|
+ if (_bGouraudShadingOn != val) {
|
|
|
+ _bGouraudShadingOn = val;
|
|
|
+ scrn.pD3DDevice->SetRenderState(D3DRS_COLORVERTEX, (DWORD)val);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -151,7 +179,7 @@ INLINE void DXGraphicsStateGuardian::
|
|
|
enable_primitive_clipping(bool val) {
|
|
|
if (_clipping_enabled != val) {
|
|
|
_clipping_enabled = val;
|
|
|
- scrn.pD3DDevice->SetRenderState(D3DRENDERSTATE_CLIPPING, (DWORD)val);
|
|
|
+ scrn.pD3DDevice->SetRenderState(D3DRS_CLIPPING, (DWORD)val);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -164,7 +192,7 @@ INLINE void DXGraphicsStateGuardian::
|
|
|
enable_fog(bool val) {
|
|
|
if ((_fog_enabled != val) && (_doFogType!=None)) {
|
|
|
_fog_enabled = val;
|
|
|
- scrn.pD3DDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, (DWORD)val);
|
|
|
+ scrn.pD3DDevice->SetRenderState(D3DRS_FOGENABLE, (DWORD)val);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -178,7 +206,7 @@ enable_alpha_test(bool val )
|
|
|
{
|
|
|
if (_alpha_test_enabled != val) {
|
|
|
_alpha_test_enabled = val;
|
|
|
- scrn.pD3DDevice->SetRenderState(D3DRENDERSTATE_ALPHATESTENABLE, (DWORD)val);
|
|
|
+ scrn.pD3DDevice->SetRenderState(D3DRS_ALPHATESTENABLE, (DWORD)val);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -195,8 +223,8 @@ call_dxLightModelAmbient( const Colorf& color)
|
|
|
#ifdef GSG_VERBOSE
|
|
|
dxgsg_cat.debug() << "dxLightModel(LIGHT_MODEL_AMBIENT, " << color << ")" << endl;
|
|
|
#endif
|
|
|
- scrn.pD3DDevice->SetRenderState( D3DRENDERSTATE_AMBIENT,
|
|
|
- D3DRGBA(color[0], color[1], color[2], color[3]));
|
|
|
+ scrn.pD3DDevice->SetRenderState( D3DRS_AMBIENT,
|
|
|
+ D3DCOLOR_COLORVALUE(color[0], color[1], color[2], color[3]));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -242,8 +270,8 @@ call_dxAlphaFunc(D3DCMPFUNC func, DWORD ref)
|
|
|
}
|
|
|
dxgsg_cat.debug() << ref << ")" << endl;
|
|
|
#endif
|
|
|
- scrn.pD3DDevice->SetRenderState(D3DRENDERSTATE_ALPHAFUNC, func);
|
|
|
- scrn.pD3DDevice->SetRenderState(D3DRENDERSTATE_ALPHAREF, ref);
|
|
|
+ scrn.pD3DDevice->SetRenderState(D3DRS_ALPHAFUNC, func);
|
|
|
+ scrn.pD3DDevice->SetRenderState(D3DRS_ALPHAREF, ref);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -254,7 +282,7 @@ call_dxBlendFunc(D3DBLEND sfunc, D3DBLEND dfunc )
|
|
|
if (_blend_source_func != sfunc)
|
|
|
{
|
|
|
_blend_source_func = sfunc;
|
|
|
- scrn.pD3DDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, sfunc);
|
|
|
+ scrn.pD3DDevice->SetRenderState(D3DRS_SRCBLEND, sfunc);
|
|
|
#ifdef GSG_VERBOSE
|
|
|
dxgsg_cat.debug() << "dxSrcBlendFunc(";
|
|
|
switch (sfunc)
|
|
|
@@ -296,7 +324,7 @@ call_dxBlendFunc(D3DBLEND sfunc, D3DBLEND dfunc )
|
|
|
if ( _blend_dest_func != dfunc)
|
|
|
{
|
|
|
_blend_dest_func = dfunc;
|
|
|
- scrn.pD3DDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, dfunc);
|
|
|
+ scrn.pD3DDevice->SetRenderState(D3DRS_DESTBLEND, dfunc);
|
|
|
#ifdef GSG_VERBOSE
|
|
|
dxgsg_cat.debug() << "dxDstBlendFunc(";
|
|
|
switch (dfunc)
|
|
|
@@ -338,7 +366,7 @@ INLINE void DXGraphicsStateGuardian::
|
|
|
enable_zwritemask(bool val) {
|
|
|
if (_depth_write_enabled != val) {
|
|
|
_depth_write_enabled = val;
|
|
|
- scrn.pD3DDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, val);
|
|
|
+ scrn.pD3DDevice->SetRenderState(D3DRS_ZWRITEENABLE, val);
|
|
|
}
|
|
|
}
|
|
|
|