From 646aa49ea040bbbc44b19aca2b33a85f1033e8ad Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 12 May 2005 20:00:37 +0000 Subject: [PATCH] support-rescale-normal --- panda/src/display/config_display.cxx | 9 +++++++++ panda/src/display/config_display.h | 1 + panda/src/glstuff/glGraphicsStateGuardian_src.cxx | 12 ++++++------ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/panda/src/display/config_display.cxx b/panda/src/display/config_display.cxx index f790c9e9d7..bc2c7952be 100644 --- a/panda/src/display/config_display.cxx +++ b/panda/src/display/config_display.cxx @@ -129,6 +129,15 @@ ConfigVariableBool support_render_texture "offscreen renders will be copied to a texture instead of directly " "rendered there.")); +ConfigVariableBool support_rescale_normal +("support-rescale-normal", true, + PRC_DESC("Set this true allow use of the rescale-normal feature, if it " + "is supported by your graphics card. This allows lighting normals " + "to be uniformly counter-scaled, instead of re-normalized, " + "in the presence of a uniform scale, which should in principle be " + "a bit faster. This feature is only supported " + "by the OpenGL API.")); + ConfigVariableBool copy_texture_inverted ("copy-texture-inverted", false, PRC_DESC("Set this true to indicate that the GSG in use will invert textures when " diff --git a/panda/src/display/config_display.h b/panda/src/display/config_display.h index c1a0311845..63e0d263e6 100644 --- a/panda/src/display/config_display.h +++ b/panda/src/display/config_display.h @@ -53,6 +53,7 @@ extern EXPCL_PANDA ConfigVariableBool prefer_parasite_buffer; extern EXPCL_PANDA ConfigVariableBool prefer_single_buffer; extern EXPCL_PANDA ConfigVariableBool support_render_texture; +extern EXPCL_PANDA ConfigVariableBool support_rescale_normal; extern EXPCL_PANDA ConfigVariableBool copy_texture_inverted; extern EXPCL_PANDA ConfigVariableBool window_inverted; extern EXPCL_PANDA ConfigVariableBool depth_offset_decals; diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index d9cec26835..9f5902402a 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -3665,13 +3665,13 @@ issue_rescale_normal(const RescaleNormalAttrib *attrib) { switch (mode) { case RescaleNormalAttrib::M_none: GLP(Disable)(GL_NORMALIZE); - if (_supports_rescale_normal) { + if (_supports_rescale_normal && support_rescale_normal) { GLP(Disable)(GL_RESCALE_NORMAL); } break; case RescaleNormalAttrib::M_rescale: - if (_supports_rescale_normal) { + if (_supports_rescale_normal && support_rescale_normal) { GLP(Enable)(GL_RESCALE_NORMAL); GLP(Disable)(GL_NORMALIZE); } else { @@ -3681,7 +3681,7 @@ issue_rescale_normal(const RescaleNormalAttrib *attrib) { case RescaleNormalAttrib::M_normalize: GLP(Enable)(GL_NORMALIZE); - if (_supports_rescale_normal) { + if (_supports_rescale_normal && support_rescale_normal) { GLP(Disable)(GL_RESCALE_NORMAL); } break; @@ -5665,13 +5665,13 @@ do_auto_rescale_normal() { if (IS_NEARLY_EQUAL(_transform->get_uniform_scale(), 1.0f)) { // If there's no scale at all, don't do anything. GLP(Disable)(GL_NORMALIZE); - if (_supports_rescale_normal) { + if (_supports_rescale_normal && support_rescale_normal) { GLP(Disable)(GL_RESCALE_NORMAL); } } else { // There's a uniform scale; use the rescale feature if available. - if (_supports_rescale_normal) { + if (_supports_rescale_normal && support_rescale_normal) { GLP(Enable)(GL_RESCALE_NORMAL); GLP(Disable)(GL_NORMALIZE); } else { @@ -5682,7 +5682,7 @@ do_auto_rescale_normal() { } else { // If there's a non-uniform scale, normalize everything. GLP(Enable)(GL_NORMALIZE); - if (_supports_rescale_normal) { + if (_supports_rescale_normal && support_rescale_normal) { GLP(Disable)(GL_RESCALE_NORMAL); } }