From 5ef54dcb78ea01171e2c0d690e5a64c2ed2ceb3b Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 4 Nov 2020 16:21:24 +0100 Subject: [PATCH] stencil clear --- src/d3d/d3ddevice.cpp | 2 ++ src/d3d/rwd3d.h | 2 ++ src/gl/gl3device.cpp | 2 ++ src/gl/gl3render.cpp | 4 ++++ src/rwobjects.h | 2 +- 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/d3d/d3ddevice.cpp b/src/d3d/d3ddevice.cpp index bfd72f8..95ab256 100644 --- a/src/d3d/d3ddevice.cpp +++ b/src/d3d/d3ddevice.cpp @@ -1170,6 +1170,8 @@ clearCamera(Camera *cam, RGBA *col, uint32 mode) mode |= D3DCLEAR_TARGET; if(mode & Camera::CLEARZ) mode |= D3DCLEAR_ZBUFFER; + if(mode & Camera::CLEARSTENCIL) + mode |= D3DCLEAR_STENCIL; D3DCOLOR c = D3DCOLOR_RGBA(col->red, col->green, col->blue, col->alpha); RECT r; diff --git a/src/d3d/rwd3d.h b/src/d3d/rwd3d.h index 6ff8484..94e618a 100644 --- a/src/d3d/rwd3d.h +++ b/src/d3d/rwd3d.h @@ -273,6 +273,8 @@ int32 lightingCB_Shader(Atomic *atomic); // for VS void uploadMatrices(void); // no world transform void uploadMatrices(Matrix *worldMat); +void setAmbient(const RGBAf &color); +void setNumLights(int numDir, int numPoint, int numSpot); int32 uploadLights(WorldLights *lightData); // called by lightingCB_Shader extern void *im2dOverridePS; diff --git a/src/gl/gl3device.cpp b/src/gl/gl3device.cpp index 877141c..de26f8b 100644 --- a/src/gl/gl3device.cpp +++ b/src/gl/gl3device.cpp @@ -1206,6 +1206,8 @@ clearCamera(Camera *cam, RGBA *col, uint32 mode) mask |= GL_COLOR_BUFFER_BIT; if(mode & Camera::CLEARZ) mask |= GL_DEPTH_BUFFER_BIT; + if(mode & Camera::CLEARSTENCIL) + mask |= GL_STENCIL_BUFFER_BIT; glDepthMask(GL_TRUE); glClear(mask); glDepthMask(rwStateCache.zwrite); diff --git a/src/gl/gl3render.cpp b/src/gl/gl3render.cpp index 467d8b1..0cacaf3 100644 --- a/src/gl/gl3render.cpp +++ b/src/gl/gl3render.cpp @@ -16,6 +16,8 @@ #include "rwgl3impl.h" +int renderpassfudge = 2; + namespace rw { namespace gl3 { @@ -65,6 +67,8 @@ drawInst_GSemu(InstanceDataHeader *header, InstanceData *inst) void drawInst(InstanceDataHeader *header, InstanceData *inst) { +if(getAlphaBlend() == renderpassfudge) +return; if(rw::GetRenderState(rw::GSALPHATEST)) drawInst_GSemu(header, inst); else diff --git a/src/rwobjects.h b/src/rwobjects.h index 32ee631..333e42d 100644 --- a/src/rwobjects.h +++ b/src/rwobjects.h @@ -723,7 +723,7 @@ struct Camera PLUGINBASE enum { ID = 4 }; enum { PERSPECTIVE = 1, PARALLEL }; - enum { CLEARIMAGE = 0x1, CLEARZ = 0x2}; + enum { CLEARIMAGE = 0x1, CLEARZ = 0x2, CLEARSTENCIL = 0x4 }; // return value of frustumTestSphere enum { SPHEREOUTSIDE, SPHEREBOUNDARY, SPHEREINSIDE };