summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/render/Renderer.cpp70
1 files changed, 23 insertions, 47 deletions
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 78977a9a..b9be21fe 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -338,45 +338,45 @@ enum {
static RwRGBAReal black;
-#ifdef RW_D3D9
-struct BuildingInst
-{
- rw::RawMatrix combinedMat;
- rw::d3d9::InstanceDataHeader *instHeader;
- uint8 fadeAlpha;
- bool lighting;
-};
-static BuildingInst blendInsts[3][2000];
-static int numBlendInsts[3];
-
static void
SetStencilState(int state)
{
switch(state){
// disable stencil
case 0:
- rw::d3d::setRenderState(D3DRS_STENCILENABLE, FALSE);
+ rw::SetRenderState(rw::STENCILENABLE, FALSE);
break;
// test against stencil
case 1:
- rw::d3d::setRenderState(D3DRS_STENCILENABLE, TRUE);
- rw::d3d::setRenderState(D3DRS_STENCILFUNC, D3DCMP_NOTEQUAL);
- rw::d3d::setRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_KEEP);
- rw::d3d::setRenderState(D3DRS_STENCILFAIL, D3DSTENCILOP_KEEP);
- rw::d3d::setRenderState(D3DRS_STENCILZFAIL, D3DSTENCILOP_KEEP);
- rw::d3d::setRenderState(D3DRS_STENCILMASK, 0xFF);
- rw::d3d::setRenderState(D3DRS_STENCILREF, 0xFF);
+ rw::SetRenderState(rw::STENCILENABLE, TRUE);
+ rw::SetRenderState(rw::STENCILFUNCTION, rw::STENCILNOTEQUAL);
+ rw::SetRenderState(rw::STENCILPASS, rw::STENCILKEEP);
+ rw::SetRenderState(rw::STENCILFAIL, rw::STENCILKEEP);
+ rw::SetRenderState(rw::STENCILZFAIL, rw::STENCILKEEP);
+ rw::SetRenderState(rw::STENCILFUNCTIONMASK, 0xFF);
+ rw::SetRenderState(rw::STENCILFUNCTIONREF, 0xFF);
break;
// write to stencil
case 2:
- rw::d3d::setRenderState(D3DRS_STENCILENABLE, TRUE);
- rw::d3d::setRenderState(D3DRS_STENCILFUNC, D3DCMP_ALWAYS);
- rw::d3d::setRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_REPLACE);
- rw::d3d::setRenderState(D3DRS_STENCILREF, 0xFF);
+ rw::SetRenderState(rw::STENCILENABLE, TRUE);
+ rw::SetRenderState(rw::STENCILFUNCTION, rw::STENCILALWAYS);
+ rw::SetRenderState(rw::STENCILPASS, rw::STENCILREPLACE);
+ rw::SetRenderState(rw::STENCILFUNCTIONREF, 0xFF);
break;
}
}
+#ifdef RW_D3D9
+struct BuildingInst
+{
+ rw::RawMatrix combinedMat;
+ rw::d3d9::InstanceDataHeader *instHeader;
+ uint8 fadeAlpha;
+ bool lighting;
+};
+static BuildingInst blendInsts[3][2000];
+static int numBlendInsts[3];
+
static void
SetMatrix(BuildingInst *building, rw::Matrix *worldMat)
{
@@ -529,30 +529,6 @@ struct BuildingInst
static BuildingInst blendInsts[3][2000];
static int numBlendInsts[3];
-static void
-SetStencilState(int state)
-{
- switch(state){
- // disable stencil
- case 0:
- glDisable(GL_STENCIL_TEST);
- break;
- // test against stencil
- case 1:
- glEnable(GL_STENCIL_TEST);
- glStencilFunc(GL_NOTEQUAL, 0xFF, 0xFF);
- glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
- glStencilMask(0xFF);
- break;
- // write to stencil
- case 2:
- glEnable(GL_STENCIL_TEST);
- glStencilFunc(GL_ALWAYS, 0xFF, 0xFF);
- glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
- break;
- }
-}
-
static bool
IsTextureTransparent(RwTexture *tex)
{