|
@@ -2280,8 +2280,6 @@ reset() {
|
|
|
}
|
|
}
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
- _auto_rescale_normal = false;
|
|
|
|
|
-
|
|
|
|
|
// Ensure the initial state is what we say it should be (in some
|
|
// Ensure the initial state is what we say it should be (in some
|
|
|
// cases, we don't want the GL default settings; in others, we have
|
|
// cases, we don't want the GL default settings; in others, we have
|
|
|
// to force the point with some drivers that aren't strictly
|
|
// to force the point with some drivers that aren't strictly
|
|
@@ -5932,10 +5930,6 @@ do_issue_transform() {
|
|
|
DO_PSTATS_STUFF(_transform_state_pcollector.add_level(1));
|
|
DO_PSTATS_STUFF(_transform_state_pcollector.add_level(1));
|
|
|
glMatrixMode(GL_MODELVIEW);
|
|
glMatrixMode(GL_MODELVIEW);
|
|
|
GLPf(LoadMatrix)(transform->get_mat().get_data());
|
|
GLPf(LoadMatrix)(transform->get_mat().get_data());
|
|
|
-
|
|
|
|
|
- if (_auto_rescale_normal) {
|
|
|
|
|
- do_auto_rescale_normal();
|
|
|
|
|
- }
|
|
|
|
|
#endif
|
|
#endif
|
|
|
_transform_stale = false;
|
|
_transform_stale = false;
|
|
|
|
|
|
|
@@ -6155,12 +6149,12 @@ do_issue_antialias() {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
void CLP(GraphicsStateGuardian)::
|
|
void CLP(GraphicsStateGuardian)::
|
|
|
do_issue_rescale_normal() {
|
|
do_issue_rescale_normal() {
|
|
|
- const RescaleNormalAttrib *target_rescale_normal;
|
|
|
|
|
- _target_rs->get_attrib_def(target_rescale_normal);
|
|
|
|
|
-
|
|
|
|
|
- RescaleNormalAttrib::Mode mode = target_rescale_normal->get_mode();
|
|
|
|
|
|
|
+ RescaleNormalAttrib::Mode mode = RescaleNormalAttrib::M_none;
|
|
|
|
|
|
|
|
- _auto_rescale_normal = false;
|
|
|
|
|
|
|
+ const RescaleNormalAttrib *target_rescale_normal;
|
|
|
|
|
+ if (_target_rs->get_attrib(target_rescale_normal)) {
|
|
|
|
|
+ mode = target_rescale_normal->get_mode();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
switch (mode) {
|
|
switch (mode) {
|
|
|
case RescaleNormalAttrib::M_none:
|
|
case RescaleNormalAttrib::M_none:
|
|
@@ -6186,11 +6180,6 @@ do_issue_rescale_normal() {
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
- case RescaleNormalAttrib::M_auto:
|
|
|
|
|
- _auto_rescale_normal = true;
|
|
|
|
|
- do_auto_rescale_normal();
|
|
|
|
|
- break;
|
|
|
|
|
-
|
|
|
|
|
default:
|
|
default:
|
|
|
GLCAT.error()
|
|
GLCAT.error()
|
|
|
<< "Unknown rescale_normal mode " << (int)mode << endl;
|
|
<< "Unknown rescale_normal mode " << (int)mode << endl;
|
|
@@ -9463,61 +9452,6 @@ free_pointers() {
|
|
|
#endif
|
|
#endif
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-// Function: GLGraphicsStateGuardian::do_auto_rescale_normal
|
|
|
|
|
-// Access: Protected
|
|
|
|
|
-// Description: Issues the appropriate GL commands to either rescale
|
|
|
|
|
-// or normalize the normals according to the current
|
|
|
|
|
-// transform.
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-void CLP(GraphicsStateGuardian)::
|
|
|
|
|
-do_auto_rescale_normal() {
|
|
|
|
|
-#ifndef OPENGLES_2
|
|
|
|
|
- if (_internal_transform->has_identity_scale()) {
|
|
|
|
|
- // If there's no scale at all, don't do anything.
|
|
|
|
|
- glDisable(GL_NORMALIZE);
|
|
|
|
|
- if (GLCAT.is_spam()) {
|
|
|
|
|
- GLCAT.spam() << "glDisable(GL_NORMALIZE)\n";
|
|
|
|
|
- }
|
|
|
|
|
- if (_supports_rescale_normal && support_rescale_normal) {
|
|
|
|
|
- glDisable(GL_RESCALE_NORMAL);
|
|
|
|
|
- if (GLCAT.is_spam()) {
|
|
|
|
|
- GLCAT.spam() << "glDisable(GL_RESCALE_NORMAL)\n";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- } else if (_internal_transform->has_uniform_scale()) {
|
|
|
|
|
- // There's a uniform scale; use the rescale feature if available.
|
|
|
|
|
- if (_supports_rescale_normal && support_rescale_normal) {
|
|
|
|
|
- glEnable(GL_RESCALE_NORMAL);
|
|
|
|
|
- glDisable(GL_NORMALIZE);
|
|
|
|
|
- if (GLCAT.is_spam()) {
|
|
|
|
|
- GLCAT.spam() << "glEnable(GL_RESCALE_NORMAL)\n";
|
|
|
|
|
- GLCAT.spam() << "glDisable(GL_NORMALIZE)\n";
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- glEnable(GL_NORMALIZE);
|
|
|
|
|
- if (GLCAT.is_spam()) {
|
|
|
|
|
- GLCAT.spam() << "glEnable(GL_NORMALIZE)\n";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- } else {
|
|
|
|
|
- // If there's a non-uniform scale, normalize everything.
|
|
|
|
|
- glEnable(GL_NORMALIZE);
|
|
|
|
|
- if (GLCAT.is_spam()) {
|
|
|
|
|
- GLCAT.spam() << "glEnable(GL_NORMALIZE)\n";
|
|
|
|
|
- }
|
|
|
|
|
- if (_supports_rescale_normal && support_rescale_normal) {
|
|
|
|
|
- glDisable(GL_RESCALE_NORMAL);
|
|
|
|
|
- if (GLCAT.is_spam()) {
|
|
|
|
|
- GLCAT.spam() << "glDisable(GL_RESCALE_NORMAL)\n";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-#endif
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GLGraphicsStateGuardian::do_issue_texture
|
|
// Function: GLGraphicsStateGuardian::do_issue_texture
|
|
|
// Access: Protected, Virtual
|
|
// Access: Protected, Virtual
|