Removed unused vertex and texcoord array dispatchers
This commit is contained in:
parent
b13bbe3bdb
commit
364c838ea1
@ -50,20 +50,16 @@ class OSG_EXPORT ArrayDispatchers : public osg::Referenced
|
|||||||
if (at) _activeDispatchList[binding].push_back(at);
|
if (at) _activeDispatchList[binding].push_back(at);
|
||||||
}
|
}
|
||||||
|
|
||||||
void activateVertexArray(osg::Array* array) { if (array && array->getBinding()>osg::Array::BIND_OFF) activate(array->getBinding(), vertexDispatcher(array)); }
|
|
||||||
void activateColorArray(osg::Array* array) { if (array && array->getBinding()>osg::Array::BIND_OFF) activate(array->getBinding(), colorDispatcher(array)); }
|
void activateColorArray(osg::Array* array) { if (array && array->getBinding()>osg::Array::BIND_OFF) activate(array->getBinding(), colorDispatcher(array)); }
|
||||||
void activateNormalArray(osg::Array* array) { if (array && array->getBinding()>osg::Array::BIND_OFF) activate(array->getBinding(), normalDispatcher(array)); }
|
void activateNormalArray(osg::Array* array) { if (array && array->getBinding()>osg::Array::BIND_OFF) activate(array->getBinding(), normalDispatcher(array)); }
|
||||||
void activateSecondaryColorArray(osg::Array* array) { if (array && array->getBinding()>osg::Array::BIND_OFF) activate(array->getBinding(), secondaryColorDispatcher(array)); }
|
void activateSecondaryColorArray(osg::Array* array) { if (array && array->getBinding()>osg::Array::BIND_OFF) activate(array->getBinding(), secondaryColorDispatcher(array)); }
|
||||||
void activateFogCoordArray(osg::Array* array) { if (array && array->getBinding()>osg::Array::BIND_OFF) activate(array->getBinding(), fogCoordDispatcher(array)); }
|
void activateFogCoordArray(osg::Array* array) { if (array && array->getBinding()>osg::Array::BIND_OFF) activate(array->getBinding(), fogCoordDispatcher(array)); }
|
||||||
void activateTexCoordArray(unsigned int unit, osg::Array* array) { if (array && array->getBinding()>osg::Array::BIND_OFF) activate(array->getBinding(), texCoordDispatcher(unit, array)); }
|
|
||||||
void activateVertexAttribArray(unsigned int unit, osg::Array* array) { if (array && array->getBinding()>osg::Array::BIND_OFF) activate(array->getBinding(), vertexAttribDispatcher(unit, array)); }
|
void activateVertexAttribArray(unsigned int unit, osg::Array* array) { if (array && array->getBinding()>osg::Array::BIND_OFF) activate(array->getBinding(), vertexAttribDispatcher(unit, array)); }
|
||||||
|
|
||||||
AttributeDispatch* vertexDispatcher(Array* array);
|
|
||||||
AttributeDispatch* normalDispatcher(Array* array);
|
AttributeDispatch* normalDispatcher(Array* array);
|
||||||
AttributeDispatch* colorDispatcher(Array* array);
|
AttributeDispatch* colorDispatcher(Array* array);
|
||||||
AttributeDispatch* secondaryColorDispatcher(Array* array);
|
AttributeDispatch* secondaryColorDispatcher(Array* array);
|
||||||
AttributeDispatch* fogCoordDispatcher(Array* array);
|
AttributeDispatch* fogCoordDispatcher(Array* array);
|
||||||
AttributeDispatch* texCoordDispatcher(unsigned int unit, Array* array);
|
|
||||||
AttributeDispatch* vertexAttribDispatcher(unsigned int unit, Array* array);
|
AttributeDispatch* vertexAttribDispatcher(unsigned int unit, Array* array);
|
||||||
|
|
||||||
void dispatch(unsigned int binding, unsigned int index)
|
void dispatch(unsigned int binding, unsigned int index)
|
||||||
@ -89,14 +85,12 @@ class OSG_EXPORT ArrayDispatchers : public osg::Referenced
|
|||||||
bool _initialized;
|
bool _initialized;
|
||||||
State* _state;
|
State* _state;
|
||||||
|
|
||||||
AttributeDispatchMap* _vertexDispatchers;
|
|
||||||
AttributeDispatchMap* _normalDispatchers;
|
AttributeDispatchMap* _normalDispatchers;
|
||||||
AttributeDispatchMap* _colorDispatchers;
|
AttributeDispatchMap* _colorDispatchers;
|
||||||
AttributeDispatchMap* _secondaryColorDispatchers;
|
AttributeDispatchMap* _secondaryColorDispatchers;
|
||||||
AttributeDispatchMap* _fogCoordDispatchers;
|
AttributeDispatchMap* _fogCoordDispatchers;
|
||||||
|
|
||||||
typedef std::vector<AttributeDispatchMap*> AttributeDispatchMapList;
|
typedef std::vector<AttributeDispatchMap*> AttributeDispatchMapList;
|
||||||
AttributeDispatchMapList _texCoordDispatchers;
|
|
||||||
AttributeDispatchMapList _vertexAttribDispatchers;
|
AttributeDispatchMapList _vertexAttribDispatchers;
|
||||||
|
|
||||||
typedef std::vector<AttributeDispatch*> AttributeDispatchList;
|
typedef std::vector<AttributeDispatch*> AttributeDispatchList;
|
||||||
|
@ -144,7 +144,6 @@ public:
|
|||||||
ArrayDispatchers::ArrayDispatchers():
|
ArrayDispatchers::ArrayDispatchers():
|
||||||
_initialized(false),
|
_initialized(false),
|
||||||
_state(0),
|
_state(0),
|
||||||
_vertexDispatchers(0),
|
|
||||||
_normalDispatchers(0),
|
_normalDispatchers(0),
|
||||||
_colorDispatchers(0),
|
_colorDispatchers(0),
|
||||||
_secondaryColorDispatchers(0),
|
_secondaryColorDispatchers(0),
|
||||||
@ -156,19 +155,11 @@ ArrayDispatchers::ArrayDispatchers():
|
|||||||
|
|
||||||
ArrayDispatchers::~ArrayDispatchers()
|
ArrayDispatchers::~ArrayDispatchers()
|
||||||
{
|
{
|
||||||
delete _vertexDispatchers;
|
|
||||||
delete _normalDispatchers;
|
delete _normalDispatchers;
|
||||||
delete _colorDispatchers;
|
delete _colorDispatchers;
|
||||||
delete _secondaryColorDispatchers;
|
delete _secondaryColorDispatchers;
|
||||||
delete _fogCoordDispatchers;
|
delete _fogCoordDispatchers;
|
||||||
|
|
||||||
for(AttributeDispatchMapList::iterator itr = _texCoordDispatchers.begin();
|
|
||||||
itr != _texCoordDispatchers.end();
|
|
||||||
++itr)
|
|
||||||
{
|
|
||||||
delete *itr;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(AttributeDispatchMapList::iterator itr = _vertexAttribDispatchers.begin();
|
for(AttributeDispatchMapList::iterator itr = _vertexAttribDispatchers.begin();
|
||||||
itr != _vertexAttribDispatchers.end();
|
itr != _vertexAttribDispatchers.end();
|
||||||
++itr)
|
++itr)
|
||||||
@ -188,7 +179,6 @@ void ArrayDispatchers::init()
|
|||||||
|
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
|
|
||||||
_vertexDispatchers = new AttributeDispatchMap();
|
|
||||||
_normalDispatchers = new AttributeDispatchMap();
|
_normalDispatchers = new AttributeDispatchMap();
|
||||||
_colorDispatchers = new AttributeDispatchMap();
|
_colorDispatchers = new AttributeDispatchMap();
|
||||||
_secondaryColorDispatchers = new AttributeDispatchMap();
|
_secondaryColorDispatchers = new AttributeDispatchMap();
|
||||||
@ -198,13 +188,6 @@ void ArrayDispatchers::init()
|
|||||||
#ifdef OSG_GL_VERTEX_FUNCS_AVAILABLE
|
#ifdef OSG_GL_VERTEX_FUNCS_AVAILABLE
|
||||||
GLExtensions* extensions = _state->get<GLExtensions>();
|
GLExtensions* extensions = _state->get<GLExtensions>();
|
||||||
|
|
||||||
#ifndef OSG_GLES1_AVAILABLE
|
|
||||||
_vertexDispatchers->assign<GLfloat>(Array::Vec2ArrayType, glVertex2fv, 2);
|
|
||||||
_vertexDispatchers->assign<GLfloat>(Array::Vec3ArrayType, glVertex3fv, 3);
|
|
||||||
_vertexDispatchers->assign<GLdouble>(Array::Vec2dArrayType, glVertex2dv, 2);
|
|
||||||
_vertexDispatchers->assign<GLdouble>(Array::Vec3dArrayType, glVertex3dv, 3);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_normalDispatchers->assign<GLbyte>(Array::Vec3bArrayType, glNormal3bv, 3);
|
_normalDispatchers->assign<GLbyte>(Array::Vec3bArrayType, glNormal3bv, 3);
|
||||||
_normalDispatchers->assign<GLshort>(Array::Vec3sArrayType, glNormal3sv, 3);
|
_normalDispatchers->assign<GLshort>(Array::Vec3sArrayType, glNormal3sv, 3);
|
||||||
_normalDispatchers->assign<GLfloat>(Array::Vec3ArrayType, glNormal3fv, 3);
|
_normalDispatchers->assign<GLfloat>(Array::Vec3ArrayType, glNormal3fv, 3);
|
||||||
@ -229,12 +212,6 @@ void ArrayDispatchers::init()
|
|||||||
//
|
//
|
||||||
// With inidices
|
// With inidices
|
||||||
//
|
//
|
||||||
AttributeDispatch* ArrayDispatchers::vertexDispatcher(Array* array)
|
|
||||||
{
|
|
||||||
return _useVertexAttribAlias ?
|
|
||||||
vertexAttribDispatcher(_state->getVertexAlias()._location, array) :
|
|
||||||
_vertexDispatchers->dispatcher(array);
|
|
||||||
}
|
|
||||||
|
|
||||||
AttributeDispatch* ArrayDispatchers::normalDispatcher(Array* array)
|
AttributeDispatch* ArrayDispatchers::normalDispatcher(Array* array)
|
||||||
{
|
{
|
||||||
@ -264,48 +241,12 @@ AttributeDispatch* ArrayDispatchers::fogCoordDispatcher(Array* array)
|
|||||||
_fogCoordDispatchers->dispatcher(array);
|
_fogCoordDispatchers->dispatcher(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
AttributeDispatch* ArrayDispatchers::texCoordDispatcher(unsigned int unit, Array* array)
|
|
||||||
{
|
|
||||||
if (_useVertexAttribAlias) return vertexAttribDispatcher(_state->getTexCoordAliasList()[unit]._location, array);
|
|
||||||
|
|
||||||
if (unit>=_texCoordDispatchers.size()) assignTexCoordDispatchers(unit);
|
|
||||||
return _texCoordDispatchers[unit]->dispatcher(array);
|
|
||||||
}
|
|
||||||
|
|
||||||
AttributeDispatch* ArrayDispatchers::vertexAttribDispatcher(unsigned int unit, Array* array)
|
AttributeDispatch* ArrayDispatchers::vertexAttribDispatcher(unsigned int unit, Array* array)
|
||||||
{
|
{
|
||||||
if (unit>=_vertexAttribDispatchers.size()) assignVertexAttribDispatchers(unit);
|
if (unit>=_vertexAttribDispatchers.size()) assignVertexAttribDispatchers(unit);
|
||||||
return _vertexAttribDispatchers[unit]->dispatcher(array);
|
return _vertexAttribDispatchers[unit]->dispatcher(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArrayDispatchers::assignTexCoordDispatchers(unsigned int unit)
|
|
||||||
{
|
|
||||||
#if defined(OSG_GL_VERTEX_FUNCS_AVAILABLE) && !defined(OSG_GLES1_AVAILABLE)
|
|
||||||
GLExtensions* extensions = _state->get<GLExtensions>();
|
|
||||||
|
|
||||||
for(unsigned int i=_texCoordDispatchers.size(); i<=unit; ++i)
|
|
||||||
{
|
|
||||||
_texCoordDispatchers.push_back(new AttributeDispatchMap());
|
|
||||||
AttributeDispatchMap& texCoordDispatcher = *_texCoordDispatchers[i];
|
|
||||||
if (i==0)
|
|
||||||
{
|
|
||||||
texCoordDispatcher.assign<GLfloat>(Array::FloatArrayType, glTexCoord1fv, 1);
|
|
||||||
texCoordDispatcher.assign<GLfloat>(Array::Vec2ArrayType, glTexCoord2fv, 2);
|
|
||||||
texCoordDispatcher.assign<GLfloat>(Array::Vec3ArrayType, glTexCoord3fv, 3);
|
|
||||||
texCoordDispatcher.assign<GLfloat>(Array::Vec4ArrayType, glTexCoord4fv, 4);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
texCoordDispatcher.targetAssign<GLenum, GLfloat>((GLenum)(GL_TEXTURE0+i), Array::FloatArrayType, extensions->glMultiTexCoord1fv, 1);
|
|
||||||
texCoordDispatcher.targetAssign<GLenum, GLfloat>((GLenum)(GL_TEXTURE0+i), Array::Vec2ArrayType, extensions->glMultiTexCoord2fv, 2);
|
|
||||||
texCoordDispatcher.targetAssign<GLenum, GLfloat>((GLenum)(GL_TEXTURE0+i), Array::Vec3ArrayType, extensions->glMultiTexCoord3fv, 3);
|
|
||||||
texCoordDispatcher.targetAssign<GLenum, GLfloat>((GLenum)(GL_TEXTURE0+i), Array::Vec4ArrayType, extensions->glMultiTexCoord4fv, 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ArrayDispatchers::assignVertexAttribDispatchers(unsigned int unit)
|
void ArrayDispatchers::assignVertexAttribDispatchers(unsigned int unit)
|
||||||
{
|
{
|
||||||
GLExtensions* extensions = _state->get<GLExtensions>();
|
GLExtensions* extensions = _state->get<GLExtensions>();
|
||||||
|
Loading…
Reference in New Issue
Block a user