From Farshid Lashkari, Added GLBeginEndAdapter::reset(), and _overallNormalAssigned, _overallColorAssigned flags to avoid the GLBeginEndAdapter adapter setting colour and normals when none has been assigned.

This commit is contained in:
Robert Osfield
2012-09-20 11:18:19 +00:00
parent d511288718
commit 01c7d87b1a
3 changed files with 19 additions and 3 deletions

View File

@@ -70,6 +70,7 @@ class OSG_EXPORT GLBeginEndAdapter
void Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
{
_overallColorAssigned = true;
_colorAssigned = true;
_color.set(red,green,blue,alpha);
}
@@ -80,6 +81,7 @@ class OSG_EXPORT GLBeginEndAdapter
void Normal3f(GLfloat x, GLfloat y, GLfloat z)
{
_overallNormalAssigned = true;
_normalAssigned = true;
_normal.set(x,y,z);
}
@@ -125,6 +127,8 @@ class OSG_EXPORT GLBeginEndAdapter
void Begin(GLenum mode);
void End();
void reset();
protected:
State* _state;
@@ -140,6 +144,8 @@ class OSG_EXPORT GLBeginEndAdapter
bool _colorAssigned;
osg::Vec4f _color;
bool _overallNormalAssigned;
bool _overallColorAssigned;
osg::Vec3f _overallNormal;
osg::Vec4f _overallColor;