summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-12-16 15:49:22 +0100
committeraap <aap@papnet.eu>2020-12-16 15:49:22 +0100
commit9200810f602c37e8030c0d1fa1fe38403a75b480 (patch)
tree948e8f918f6afb320d8e0ec7b0b56dcd5aef5568 /src/render
parentmore tiny water sync (diff)
downloadre3-9200810f602c37e8030c0d1fa1fe38403a75b480.tar
re3-9200810f602c37e8030c0d1fa1fe38403a75b480.tar.gz
re3-9200810f602c37e8030c0d1fa1fe38403a75b480.tar.bz2
re3-9200810f602c37e8030c0d1fa1fe38403a75b480.tar.lz
re3-9200810f602c37e8030c0d1fa1fe38403a75b480.tar.xz
re3-9200810f602c37e8030c0d1fa1fe38403a75b480.tar.zst
re3-9200810f602c37e8030c0d1fa1fe38403a75b480.zip
Diffstat (limited to 'src/render')
-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)
{