Supported added for secondary color & fog coords to osg::Geometry and osg::State.
This commit is contained in:
@@ -59,6 +59,22 @@ class SG_EXPORT Geometry : public Drawable
|
||||
const Array* getColorArray() const { return _colorArray.get(); }
|
||||
|
||||
|
||||
void setSecondaryColorBinding(AttributeBinding ab) { _secondaryColorBinding = ab; }
|
||||
AttributeBinding getSecondaryColorBinding() const { return _secondaryColorBinding; }
|
||||
|
||||
void setSecondaryColorArray(Array* array) { _secondaryColorArray = array; if (!_secondaryColorArray.valid()) _secondaryColorBinding=BIND_OFF; dirtyDisplayList(); }
|
||||
Array* getSecondaryColorArray() { return _secondaryColorArray.get(); }
|
||||
const Array* getSecondaryColorArray() const { return _secondaryColorArray.get(); }
|
||||
|
||||
|
||||
void setFogCoordBinding(AttributeBinding ab) { _fogCoordBinding = ab; }
|
||||
AttributeBinding getFogCoordBinding() const { return _fogCoordBinding; }
|
||||
|
||||
void setFogCoordArray(FloatArray* array) { _fogCoordArray = array; if (!_fogCoordArray.valid()) _fogCoordBinding=BIND_OFF; dirtyDisplayList(); }
|
||||
FloatArray* getFogCoordArray() { return _fogCoordArray.get(); }
|
||||
const FloatArray* getFogCoordArray() const { return _fogCoordArray.get(); }
|
||||
|
||||
|
||||
typedef std::vector< ref_ptr<Array> > TexCoordArrayList;
|
||||
|
||||
|
||||
@@ -121,6 +137,12 @@ class SG_EXPORT Geometry : public Drawable
|
||||
AttributeBinding _colorBinding;
|
||||
ref_ptr<Array> _colorArray;
|
||||
|
||||
AttributeBinding _secondaryColorBinding;
|
||||
ref_ptr<Array> _secondaryColorArray;
|
||||
|
||||
AttributeBinding _fogCoordBinding;
|
||||
ref_ptr<FloatArray> _fogCoordArray;
|
||||
|
||||
TexCoordArrayList _texCoordList;
|
||||
|
||||
};
|
||||
|
||||
@@ -24,6 +24,21 @@ namespace osg {
|
||||
#define GL_TEXTURE0 0x84C0
|
||||
#endif
|
||||
|
||||
#ifndef GL_FOG_COORDINATE_ARRAY
|
||||
#ifdef GL_FOG_COORDINATE_ARRAY_EXT
|
||||
#define GL_FOG_COORDINATE_ARRAY GL_FOG_COORDINATE_ARRAY_EXT
|
||||
#else
|
||||
#define GL_FOG_COORDINATE_ARRAY 0x8457
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GL_SECONDARY_COLOR_ARRAY
|
||||
#ifdef GL_SECONDARY_COLOR_ARRAY
|
||||
#define GL_SECONDARY_COLOR_ARRAY GL_SECONDARY_COLOR_ARRAY_EXT
|
||||
#else
|
||||
#define GL_SECONDARY_COLOR_ARRAY 0x845E
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** macro for use with osg::StateAttrbiute::apply methods for detected and
|
||||
* reporting OpenGL error messages.*/
|
||||
@@ -287,6 +302,21 @@ class SG_EXPORT State : public Referenced
|
||||
}
|
||||
}
|
||||
|
||||
/** wrapper around glEnableClientState(GL_SECONDARY_COLOR_ARRAY);glSecondayColorPointer(..);
|
||||
* note, only updates values that change.*/
|
||||
void setSecondaryColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr );
|
||||
|
||||
/** wrapper around glDisableClientState(GL_SECONDARY_COLOR_ARRAY);
|
||||
* note, only updates values that change.*/
|
||||
inline void disableSecondaryColorPointer()
|
||||
{
|
||||
if (_secondaryColorArray._enabled)
|
||||
{
|
||||
_secondaryColorArray._enabled = false;
|
||||
glDisableClientState(GL_SECONDARY_COLOR_ARRAY);
|
||||
}
|
||||
}
|
||||
|
||||
/** wrapper around glEnableClientState(GL_INDEX_ARRAY);glIndexPointer(..);
|
||||
* note, only updates values that change.*/
|
||||
inline void setIndexPointer( GLenum type, GLsizei stride,
|
||||
@@ -315,6 +345,23 @@ class SG_EXPORT State : public Referenced
|
||||
}
|
||||
}
|
||||
|
||||
/** wrapper around glEnableClientState(GL_FOG_COORDINATE_ARRAY);glFogCoordPointer(..);
|
||||
* note, only updates values that change.*/
|
||||
void setFogCoordPointer( GLenum type, GLsizei stride, const GLvoid *ptr );
|
||||
|
||||
/** wrapper around glDisableClientState(GL_FOG_COORDINATE_ARRAY);
|
||||
* note, only updates values that change.*/
|
||||
inline void disableFogCoordPointer()
|
||||
{
|
||||
if (_fogArray._enabled)
|
||||
{
|
||||
_fogArray._enabled = false;
|
||||
glDisableClientState(GL_FOG_COORDINATE_ARRAY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** wrapper around glEnableClientState(GL_TEXTURE_COORD_ARRAY);glTexCoordPointer(..);
|
||||
* note, only updates values that change.*/
|
||||
inline void setTexCoordPointer( unsigned int unit,
|
||||
@@ -383,7 +430,6 @@ class SG_EXPORT State : public Referenced
|
||||
bool setActiveTextureUnit( unsigned int unit );
|
||||
|
||||
|
||||
|
||||
/** Set the current OpenGL context uniqueID.
|
||||
Note, it is the application developers responsibility to
|
||||
set up unique ID for each OpenGL context. This value is
|
||||
@@ -535,9 +581,11 @@ class SG_EXPORT State : public Referenced
|
||||
typedef std::vector<EnabledArrayPair> EnabledTexCoordArrayList;
|
||||
|
||||
EnabledArrayPair _vertexArray;
|
||||
EnabledArrayPair _colorArray;
|
||||
EnabledArrayPair _indexArray;
|
||||
EnabledArrayPair _normalArray;
|
||||
EnabledArrayPair _colorArray;
|
||||
EnabledArrayPair _secondaryColorArray;
|
||||
EnabledArrayPair _indexArray;
|
||||
EnabledArrayPair _fogArray;
|
||||
EnabledTexCoordArrayList _texCoordArrayList;
|
||||
|
||||
unsigned int _currentActiveTextureUnit;
|
||||
|
||||
Reference in New Issue
Block a user