From 4770614973ce7fb0627de0c5fc9172c4d390b53f Mon Sep 17 00:00:00 2001 From: cxgeorge <> Date: Tue, 12 Jun 2001 03:17:49 +0000 Subject: [PATCH] add anti-aliasing flag --- panda/src/dxgsg/dxGraphicsStateGuardian.cxx | 23 +++++++++++++++++++-- panda/src/wdxdisplay/wdxGraphicsWindow.cxx | 14 +++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/panda/src/dxgsg/dxGraphicsStateGuardian.cxx b/panda/src/dxgsg/dxGraphicsStateGuardian.cxx index 1589c8df88..5c680e5adc 100644 --- a/panda/src/dxgsg/dxGraphicsStateGuardian.cxx +++ b/panda/src/dxgsg/dxGraphicsStateGuardian.cxx @@ -20,6 +20,7 @@ #pragma hdrstop +//#define DISABLE_DECALING #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 @@ -422,6 +423,15 @@ init_dx( LPDIRECTDRAW7 context, #endif _d3dDevice->SetRenderState(D3DRENDERSTATE_SHADEMODE, _CurShadeMode); + + if(dx_full_screen_antialiasing) { + if(_D3DDevDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT) { + _d3dDevice->SetRenderState(D3DRENDERSTATE_ANTIALIAS,D3DANTIALIAS_SORTINDEPENDENT); + dxgsg_cat.debug() << "enabling full-screen anti-aliasing\n"; + } else { + dxgsg_cat.debug() << "device doesnt support full-screen anti-aliasing\n"; + } + } } //////////////////////////////////////////////////////////////////// @@ -4882,6 +4892,8 @@ begin_decal(GeomNode *base_geom) { _d3dDevice->SetRenderState(D3DRENDERSTATE_ZBIAS, POLYGON_OFFSET_MULTIPLIER * _decal_level); // _decal_level better not be higher than 8! } else #endif + +#ifndef DISABLE_DECALING { if (_decal_level > 1) base_geom->draw(this); // If we're already decaling, just draw the geometry. @@ -4897,6 +4909,9 @@ begin_decal(GeomNode *base_geom) { // buffer write off during this. } } +#else + base_geom->draw(this); +#endif } //////////////////////////////////////////////////////////////////// @@ -4908,9 +4923,13 @@ begin_decal(GeomNode *base_geom) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: end_decal(GeomNode *base_geom) { - nassertv(base_geom != (GeomNode *)NULL); - _decal_level--; + +#ifdef DISABLE_DECALING + return; +#endif + + nassertv(base_geom != (GeomNode *)NULL); // nassertv(_decal_level >= 1); #ifndef DISABLE_POLYGON_OFFSET_DECALING diff --git a/panda/src/wdxdisplay/wdxGraphicsWindow.cxx b/panda/src/wdxdisplay/wdxGraphicsWindow.cxx index ed7d9f1b50..0bd63354c7 100644 --- a/panda/src/wdxdisplay/wdxGraphicsWindow.cxx +++ b/panda/src/wdxdisplay/wdxGraphicsWindow.cxx @@ -28,6 +28,8 @@ TypeHandle wdxGraphicsWindow::_type_handle; // need to replace this with global hwnd->wdx classptr STL map obj wdxGraphicsWindow* global_dxwin = NULL; +extern bool dx_full_screen_antialiasing; + #define MOUSE_ENTERED 0 #define MOUSE_EXITED 1 @@ -952,6 +954,12 @@ dx_setup() { DDSCAPS_FLIP | DDSCAPS_COMPLEX; ddsd.dwBackBufferCount = 1; + if(dx_full_screen_antialiasing) { + // cant check that d3ddevice has this capability yet, so got to set it anyway. + // hope this is OK. + ddsd.ddsCaps.dwCaps2 |= DDSCAPS2_HINTANTIALIASING; + } + PRINTVIDMEM(pDD,&ddsd.ddsCaps,"initial primary & backbuf"); // Create the primary surface @@ -1087,6 +1095,12 @@ dx_setup() { SurfaceDesc.dwWidth = dwRenderWidth; SurfaceDesc.dwHeight = dwRenderHeight; + if(dx_full_screen_antialiasing) { + // cant check that d3ddevice has this capability yet, so got to set it anyway. + // hope this is OK. + SurfaceDesc.ddsCaps.dwCaps2 |= DDSCAPS2_HINTANTIALIASING; + } + PRINTVIDMEM(pDD,&SurfaceDesc.ddsCaps,"initial backbuf"); // Create the backbuffer. (might want to handle failure due to running out of video memory.