support-rescale-normal

This commit is contained in:
David Rose 2005-05-12 20:00:37 +00:00
parent 2f9bd15e9c
commit 646aa49ea0
3 changed files with 16 additions and 6 deletions

View File

@ -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 "

View File

@ -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;

View File

@ -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);
}
}