From 29afc8d547c8bad9aa1f1d25f09dd5110976190c Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 29 Mar 2002 00:40:17 +0000 Subject: [PATCH] fix build break --- panda/src/dxgsg/dxGraphicsStateGuardian.cxx | 1 + panda/src/dxgsg8/dxGraphicsStateGuardian8.I | 14 ----- panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx | 53 +++++++++++-------- panda/src/dxgsg8/dxGraphicsStateGuardian8.h | 5 +- 4 files changed, 36 insertions(+), 37 deletions(-) diff --git a/panda/src/dxgsg/dxGraphicsStateGuardian.cxx b/panda/src/dxgsg/dxGraphicsStateGuardian.cxx index 462e0439ae..dda74bf8e2 100644 --- a/panda/src/dxgsg/dxGraphicsStateGuardian.cxx +++ b/panda/src/dxgsg/dxGraphicsStateGuardian.cxx @@ -759,6 +759,7 @@ dx_init( void) { _available_clip_plane_ids = PTA(PlaneNode*)::empty_array(_max_clip_planes); _clip_plane_enabled = new bool[_max_clip_planes]; _cur_clip_plane_enabled = new bool[_max_clip_planes]; + int i; for (i = 0; i < _max_clip_planes; i++) { _available_clip_plane_ids[i] = NULL; _clip_plane_enabled[i] = false; diff --git a/panda/src/dxgsg8/dxGraphicsStateGuardian8.I b/panda/src/dxgsg8/dxGraphicsStateGuardian8.I index 3ec59c4381..b1336c910b 100644 --- a/panda/src/dxgsg8/dxGraphicsStateGuardian8.I +++ b/panda/src/dxgsg8/dxGraphicsStateGuardian8.I @@ -39,20 +39,6 @@ enable_line_smooth(bool val) { } } -//////////////////////////////////////////////////////////////////// -// Function: DXGraphicsStateGuardian::enable_lighting -// Access: -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void DXGraphicsStateGuardian:: -enable_lighting(bool val) { - if (_lighting_enabled != val) { - scrn.pD3DDevice->SetRenderState(D3DRS_LIGHTING, (DWORD)val); - if(_lighting_enabled = val) - _lighting_enabled_this_frame = true; - } -} - //////////////////////////////////////////////////////////////////// // Function: DXGraphicsStateGuardian::enable_dither // Access: diff --git a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx index 0923d0a658..b6e3ae17af 100644 --- a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx +++ b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx @@ -467,7 +467,7 @@ DXGraphicsStateGuardian(GraphicsWindow *win) : GraphicsStateGuardian(win) { _pFPSFont=NULL; _bShowFPSMeter = false; - _max_light_range = __D3DLIGHT_RANGE_MAX; + // _max_light_range = __D3DLIGHT_RANGE_MAX; // non-dx obj values inited here should not change if resize is // called and dx objects need to be recreated (otherwise they @@ -1045,25 +1045,6 @@ clear(const RenderBuffer &buffer, const DisplayRegion *region) { pop_display_region(old_dr); } -//////////////////////////////////////////////////////////////////// -// Function: DXGraphicsStateGuardian::enable_light -// Access: -// Description: -//////////////////////////////////////////////////////////////////// -bool DXGraphicsStateGuardian:: -enable_light(int light_id, bool val) { - HRESULT hr = scrn.pD3DDevice->LightEnable( light_id, val ); - -#ifdef GSG_VERBOSE - dxgsg_cat.debug() << "LightEnable(" << light_id << "=" << val << ")" << endl; -#endif - - if (FAILED(hr)) { - dxgsg_cat.error() << "LightEnable(" << light_id << "=" << val << ") failed, " <get_color(); + // _cur_ambient_light = _cur_ambient_light + light->get_color(); } //////////////////////////////////////////////////////////////////// @@ -5399,6 +5380,36 @@ get_fog_mode_type(Fog::Mode m) const { return D3DFOG_EXP; } +//////////////////////////////////////////////////////////////////// +// Function: DXGraphicsStateGuardian::enable_lighting +// Access: Protected, Virtual +// Description: Intended to be overridden by a derived class to +// enable or disable the use of lighting overall. This +// is called by issue_light() according to whether any +// lights are in use or not. +//////////////////////////////////////////////////////////////////// +void DXGraphicsStateGuardian:: +enable_lighting(bool enable) { + scrn.pD3DDevice->SetRenderState(D3DRS_LIGHTING, (DWORD)enable); +} + +//////////////////////////////////////////////////////////////////// +// Function: DXGraphicsStateGuardian::enable_light +// Access: Protected, Virtual +// Description: Intended to be overridden by a derived class to +// enable the indicated light id. A specific Light will +// already have been bound to this id via bind_light(). +//////////////////////////////////////////////////////////////////// +void DXGraphicsStateGuardian:: +enable_light(int light_id, bool enable) { + HRESULT res = scrn.pD3DDevice->LightEnable(light_id, enable); + +#ifdef GSG_VERBOSE + dxgsg_cat.debug() + << "LightEnable(" << light << "=" << val << ")" << endl; +#endif +} + //////////////////////////////////////////////////////////////////// // Function: DXGraphicsStateGuardian::free_pointers // Access: Public diff --git a/panda/src/dxgsg8/dxGraphicsStateGuardian8.h b/panda/src/dxgsg8/dxGraphicsStateGuardian8.h index 479bb06f5d..d22554591d 100644 --- a/panda/src/dxgsg8/dxGraphicsStateGuardian8.h +++ b/panda/src/dxgsg8/dxGraphicsStateGuardian8.h @@ -179,6 +179,9 @@ public: DXScreenData scrn; protected: + virtual void enable_lighting(bool enable); + virtual void enable_light(int light_id, bool enable); + void free_pointers(); // free local internal buffers void free_dxgsg_objects(void); // free the DirectX objects we create virtual PT(SavedFrameBuffer) save_frame_buffer(const RenderBuffer &buffer, @@ -241,10 +244,8 @@ protected: INLINE void call_dxLightModelAmbient(const Colorf& color); INLINE void call_dxAlphaFunc(D3DCMPFUNC func, DWORD ref); INLINE void call_dxBlendFunc(D3DBLEND sfunc, D3DBLEND dfunc); - INLINE void enable_lighting(bool val); INLINE void enable_dither(bool val); INLINE void enable_stencil_test(bool val); - bool enable_light(int light, bool val); void report_texmgr_stats(); void draw_multitri(Geom *geom, D3DPRIMITIVETYPE tri_id);