mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
disable polygon offset, which isnt working properly now
This commit is contained in:
parent
b3f2abc0b5
commit
7bc7babc51
@ -67,6 +67,10 @@
|
|||||||
|
|
||||||
#include <pandabase.h>
|
#include <pandabase.h>
|
||||||
|
|
||||||
|
#define DISABLE_POLYGON_OFFSET_DECALING
|
||||||
|
// currently doesnt work well enough in toontown models for us to use
|
||||||
|
// prob is when viewer gets close to decals, they disappear into wall poly, need to investigate
|
||||||
|
|
||||||
TypeHandle DXGraphicsStateGuardian::_type_handle;
|
TypeHandle DXGraphicsStateGuardian::_type_handle;
|
||||||
|
|
||||||
// bit masks used for drawing primitives
|
// bit masks used for drawing primitives
|
||||||
@ -384,7 +388,7 @@ init_dx( LPDIRECTDRAW7 context,
|
|||||||
#if(DIRECT3D_VERSION < 0x700)
|
#if(DIRECT3D_VERSION < 0x700)
|
||||||
dxgsg_cat.error() << "dx-decal-type 'offset' not supported by hardware, switching to decal masking\n";
|
dxgsg_cat.error() << "dx-decal-type 'offset' not supported by hardware, switching to decal masking\n";
|
||||||
#else
|
#else
|
||||||
dxgsg_cat.error() << "dx-decal-type 'offset' not supported by hardware, switching to decal blend-based masking\n";
|
dxgsg_cat.error() << "dx-decal-type 'offset' not supported by hardware, switching to decal double-draw blend-based masking\n";
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if(DIRECT3D_VERSION < 0x700)
|
#if(DIRECT3D_VERSION < 0x700)
|
||||||
@ -394,6 +398,18 @@ init_dx( LPDIRECTDRAW7 context,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DISABLE_POLYGON_OFFSET_DECALING
|
||||||
|
#ifdef _DEBUG
|
||||||
|
dxgsg_cat.spam() << "polygon-offset decaling disabled in dxgsg, switching to double-draw decaling\n";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if(DIRECT3D_VERSION < 0x700)
|
||||||
|
dx_decal_type = GDT_mask;
|
||||||
|
#else
|
||||||
|
dx_decal_type = GDT_blend;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
if((dx_decal_type==GDT_mask) && !(D3DDevDesc.dpcTriCaps.dwMiscCaps & D3DPMISCCAPS_MASKPLANES)) {
|
if((dx_decal_type==GDT_mask) && !(D3DDevDesc.dpcTriCaps.dwMiscCaps & D3DPMISCCAPS_MASKPLANES)) {
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
dxgsg_cat.error() << "No hardware support for colorwrite disabling, switching to dx-decal-type 'mask' to 'blend'\n";
|
dxgsg_cat.error() << "No hardware support for colorwrite disabling, switching to dx-decal-type 'mask' to 'blend'\n";
|
||||||
@ -3729,13 +3745,16 @@ begin_decal(GeomNode *base_geom) {
|
|||||||
_decal_level++;
|
_decal_level++;
|
||||||
nassertv(4*_decal_level < 16);
|
nassertv(4*_decal_level < 16);
|
||||||
|
|
||||||
|
#ifndef DISABLE_POLYGON_OFFSET_DECALING
|
||||||
if (dx_decal_type == GDT_offset) {
|
if (dx_decal_type == GDT_offset) {
|
||||||
|
|
||||||
#define POLYGON_OFFSET_MULTIPLIER 2
|
#define POLYGON_OFFSET_MULTIPLIER 2
|
||||||
// Just draw the base geometry normally.
|
// Just draw the base geometry normally.
|
||||||
base_geom->draw(this);
|
base_geom->draw(this);
|
||||||
_d3dDevice->SetRenderState(D3DRENDERSTATE_ZBIAS, POLYGON_OFFSET_MULTIPLIER * _decal_level); // _decal_level better not be higher than 4!
|
_d3dDevice->SetRenderState(D3DRENDERSTATE_ZBIAS, POLYGON_OFFSET_MULTIPLIER * _decal_level); // _decal_level better not be higher than 8!
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
if (_decal_level > 1)
|
if (_decal_level > 1)
|
||||||
base_geom->draw(this); // If we're already decaling, just draw the geometry.
|
base_geom->draw(this); // If we're already decaling, just draw the geometry.
|
||||||
else {
|
else {
|
||||||
@ -3766,10 +3785,13 @@ end_decal(GeomNode *base_geom) {
|
|||||||
_decal_level--;
|
_decal_level--;
|
||||||
// nassertv(_decal_level >= 1);
|
// nassertv(_decal_level >= 1);
|
||||||
|
|
||||||
|
#ifndef DISABLE_POLYGON_OFFSET_DECALING
|
||||||
if (dx_decal_type == GDT_offset) {
|
if (dx_decal_type == GDT_offset) {
|
||||||
// Restore the Zbias offset.
|
// Restore the Zbias offset.
|
||||||
_d3dDevice->SetRenderState(D3DRENDERSTATE_ZBIAS, POLYGON_OFFSET_MULTIPLIER * _decal_level); // _decal_level better not be higher than 8!
|
_d3dDevice->SetRenderState(D3DRENDERSTATE_ZBIAS, POLYGON_OFFSET_MULTIPLIER * _decal_level); // _decal_level better not be higher than 8!
|
||||||
} else { // for GDT_mask
|
} else
|
||||||
|
#endif
|
||||||
|
{ // for GDT_mask
|
||||||
if (_decal_level == 0) {
|
if (_decal_level == 0) {
|
||||||
// Now we need to re-render the base geometry with the depth write
|
// Now we need to re-render the base geometry with the depth write
|
||||||
// on and the color mask off, so we update the depth buffer
|
// on and the color mask off, so we update the depth buffer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user