Skip to content

Commit

Permalink
stencil clear
Browse files Browse the repository at this point in the history
  • Loading branch information
aap committed Nov 4, 2020
1 parent 8c00f78 commit 5ef54dc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/d3d/d3ddevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/d3d/rwd3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/gl/gl3device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/gl/gl3render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#include "rwgl3impl.h"

int renderpassfudge = 2;

namespace rw {
namespace gl3 {

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/rwobjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

Expand Down

0 comments on commit 5ef54dc

Please sign in to comment.