mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 09:00:01 +00:00
update librw with stencil states
This commit is contained in:
parent
78c7459b3a
commit
9200810f60
|
@ -338,6 +338,34 @@ enum {
|
||||||
|
|
||||||
static RwRGBAReal black;
|
static RwRGBAReal black;
|
||||||
|
|
||||||
|
static void
|
||||||
|
SetStencilState(int state)
|
||||||
|
{
|
||||||
|
switch(state){
|
||||||
|
// disable stencil
|
||||||
|
case 0:
|
||||||
|
rw::SetRenderState(rw::STENCILENABLE, FALSE);
|
||||||
|
break;
|
||||||
|
// test against stencil
|
||||||
|
case 1:
|
||||||
|
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::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
|
#ifdef RW_D3D9
|
||||||
struct BuildingInst
|
struct BuildingInst
|
||||||
{
|
{
|
||||||
|
@ -349,34 +377,6 @@ struct BuildingInst
|
||||||
static BuildingInst blendInsts[3][2000];
|
static BuildingInst blendInsts[3][2000];
|
||||||
static int numBlendInsts[3];
|
static int numBlendInsts[3];
|
||||||
|
|
||||||
static void
|
|
||||||
SetStencilState(int state)
|
|
||||||
{
|
|
||||||
switch(state){
|
|
||||||
// disable stencil
|
|
||||||
case 0:
|
|
||||||
rw::d3d::setRenderState(D3DRS_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);
|
|
||||||
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);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SetMatrix(BuildingInst *building, rw::Matrix *worldMat)
|
SetMatrix(BuildingInst *building, rw::Matrix *worldMat)
|
||||||
{
|
{
|
||||||
|
@ -529,30 +529,6 @@ struct BuildingInst
|
||||||
static BuildingInst blendInsts[3][2000];
|
static BuildingInst blendInsts[3][2000];
|
||||||
static int numBlendInsts[3];
|
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
|
static bool
|
||||||
IsTextureTransparent(RwTexture *tex)
|
IsTextureTransparent(RwTexture *tex)
|
||||||
{
|
{
|
||||||
|
|
2
vendor/librw
vendored
2
vendor/librw
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit efc0c307d79e8a7a7586cfecde109257b9fac738
|
Subproject commit ed9cb45ee9a2749a0a89231bf16f09a5c53bfc92
|
Loading…
Reference in a new issue