Renamed ArrayDispatchers to AttributeDispatchers to better reflect it's role

This commit is contained in:
Robert Osfield
2016-10-11 15:14:14 +01:00
parent e14ee80282
commit 38ff11f8c5
7 changed files with 40 additions and 40 deletions

View File

@@ -10,7 +10,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/ArrayDispatchers>
#include <osg/AttributeDispatchers>
#include <osg/State>
#include <osg/Drawable>
@@ -141,7 +141,7 @@ public:
AttributeDispatchList _attributeDispatchList;
};
ArrayDispatchers::ArrayDispatchers():
AttributeDispatchers::AttributeDispatchers():
_initialized(false),
_state(0),
_normalDispatchers(0),
@@ -153,7 +153,7 @@ ArrayDispatchers::ArrayDispatchers():
}
ArrayDispatchers::~ArrayDispatchers()
AttributeDispatchers::~AttributeDispatchers()
{
delete _normalDispatchers;
delete _colorDispatchers;
@@ -168,12 +168,12 @@ ArrayDispatchers::~ArrayDispatchers()
}
}
void ArrayDispatchers::setState(osg::State* state)
void AttributeDispatchers::setState(osg::State* state)
{
_state = state;
}
void ArrayDispatchers::init()
void AttributeDispatchers::init()
{
if (_initialized) return;
@@ -213,41 +213,41 @@ void ArrayDispatchers::init()
// With inidices
//
AttributeDispatch* ArrayDispatchers::normalDispatcher(Array* array)
AttributeDispatch* AttributeDispatchers::normalDispatcher(Array* array)
{
return _useVertexAttribAlias ?
vertexAttribDispatcher(_state->getNormalAlias()._location, array) :
_normalDispatchers->dispatcher(array);
}
AttributeDispatch* ArrayDispatchers::colorDispatcher(Array* array)
AttributeDispatch* AttributeDispatchers::colorDispatcher(Array* array)
{
return _useVertexAttribAlias ?
vertexAttribDispatcher(_state->getColorAlias()._location, array) :
_colorDispatchers->dispatcher(array);
}
AttributeDispatch* ArrayDispatchers::secondaryColorDispatcher(Array* array)
AttributeDispatch* AttributeDispatchers::secondaryColorDispatcher(Array* array)
{
return _useVertexAttribAlias ?
vertexAttribDispatcher(_state->getSecondaryColorAlias()._location, array) :
_secondaryColorDispatchers->dispatcher(array);
}
AttributeDispatch* ArrayDispatchers::fogCoordDispatcher(Array* array)
AttributeDispatch* AttributeDispatchers::fogCoordDispatcher(Array* array)
{
return _useVertexAttribAlias ?
vertexAttribDispatcher(_state->getFogCoordAlias()._location, array) :
_fogCoordDispatchers->dispatcher(array);
}
AttributeDispatch* ArrayDispatchers::vertexAttribDispatcher(unsigned int unit, Array* array)
AttributeDispatch* AttributeDispatchers::vertexAttribDispatcher(unsigned int unit, Array* array)
{
if (unit>=_vertexAttribDispatchers.size()) assignVertexAttribDispatchers(unit);
return _vertexAttribDispatchers[unit]->dispatcher(array);
}
void ArrayDispatchers::assignVertexAttribDispatchers(unsigned int unit)
void AttributeDispatchers::assignVertexAttribDispatchers(unsigned int unit)
{
GLExtensions* extensions = _state->get<GLExtensions>();
@@ -262,7 +262,7 @@ void ArrayDispatchers::assignVertexAttribDispatchers(unsigned int unit)
}
}
void ArrayDispatchers::reset()
void AttributeDispatchers::reset()
{
if (!_initialized) init();

View File

@@ -24,7 +24,7 @@ SET(TARGET_H
${HEADER_PATH}/ApplicationUsage
${HEADER_PATH}/ArgumentParser
${HEADER_PATH}/Array
${HEADER_PATH}/ArrayDispatchers
${HEADER_PATH}/AttributeDispatchers
${HEADER_PATH}/AudioStream
${HEADER_PATH}/AutoTransform
${HEADER_PATH}/Billboard
@@ -239,7 +239,7 @@ SET(TARGET_SRC
ApplicationUsage.cpp
ArgumentParser.cpp
Array.cpp
ArrayDispatchers.cpp
AttributeDispatchers.cpp
AudioStream.cpp
AutoTransform.cpp
Billboard.cpp

View File

@@ -13,7 +13,7 @@
#include <stdlib.h>
#include <osg/Geometry>
#include <osg/ArrayDispatchers>
#include <osg/AttributeDispatchers>
#include <osg/VertexArrayState>
#include <osg/Notify>
@@ -827,24 +827,24 @@ void Geometry::drawVertexArraysImplementation(RenderInfo& renderInfo) const
bool handleVertexAttributes = !_vertexAttribList.empty();
ArrayDispatchers& arrayDispatchers = state.getArrayDispatchers();
AttributeDispatchers& attributeDispatchers = state.getAttributeDispatchers();
arrayDispatchers.reset();
arrayDispatchers.setUseVertexAttribAlias(state.getUseVertexAttributeAliasing());
attributeDispatchers.reset();
attributeDispatchers.setUseVertexAttribAlias(state.getUseVertexAttributeAliasing());
if (handleVertexAttributes)
{
for(unsigned int unit=0;unit<_vertexAttribList.size();++unit)
{
arrayDispatchers.activateVertexAttribArray(unit, _vertexAttribList[unit].get());
attributeDispatchers.activateVertexAttribArray(unit, _vertexAttribList[unit].get());
}
}
// activate or dispatch any attributes that are bound overall
arrayDispatchers.activateNormalArray(_normalArray.get());
arrayDispatchers.activateColorArray(_colorArray.get());
arrayDispatchers.activateSecondaryColorArray(_secondaryColorArray.get());
arrayDispatchers.activateFogCoordArray(_fogCoordArray.get());
attributeDispatchers.activateNormalArray(_normalArray.get());
attributeDispatchers.activateColorArray(_colorArray.get());
attributeDispatchers.activateSecondaryColorArray(_secondaryColorArray.get());
attributeDispatchers.activateFogCoordArray(_fogCoordArray.get());
if (state.useVertexArrayObject(_useVertexArrayObject))
{
@@ -896,14 +896,14 @@ void Geometry::drawVertexArraysImplementation(RenderInfo& renderInfo) const
void Geometry::drawPrimitivesImplementation(RenderInfo& renderInfo) const
{
State& state = *renderInfo.getState();
ArrayDispatchers& arrayDispatchers = state.getArrayDispatchers();
AttributeDispatchers& attributeDispatchers = state.getAttributeDispatchers();
bool usingVertexBufferObjects = state.useVertexBufferObject(_supportsVertexBufferObjects && _useVertexBufferObjects);
bool bindPerPrimitiveSetActive = arrayDispatchers.active();
bool bindPerPrimitiveSetActive = attributeDispatchers.active();
for(unsigned int primitiveSetNum=0; primitiveSetNum!=_primitives.size(); ++primitiveSetNum)
{
// dispatch any attributes that are bound per primitive
if (bindPerPrimitiveSetActive) arrayDispatchers.dispatch(primitiveSetNum);
if (bindPerPrimitiveSetActive) attributeDispatchers.dispatch(primitiveSetNum);
const PrimitiveSet* primitiveset = _primitives[primitiveSetNum].get();

View File

@@ -868,13 +868,13 @@ void SharedGeometry::drawImplementation(osg::RenderInfo& renderInfo) const
bool checkForGLErrors = state.getCheckForGLErrors()==osg::State::ONCE_PER_ATTRIBUTE;
if (checkForGLErrors) state.checkGLErrors("start of SharedGeometry::drawImplementation()");
osg::ArrayDispatchers& arrayDispatchers = state.getArrayDispatchers();
osg::AttributeDispatchers& attributeDispatchers = state.getAttributeDispatchers();
arrayDispatchers.reset();
arrayDispatchers.setUseVertexAttribAlias(state.getUseVertexAttributeAliasing());
attributeDispatchers.reset();
attributeDispatchers.setUseVertexAttribAlias(state.getUseVertexAttributeAliasing());
arrayDispatchers.activateNormalArray(_normalArray.get());
arrayDispatchers.activateColorArray(_colorArray.get());
attributeDispatchers.activateNormalArray(_normalArray.get());
attributeDispatchers.activateColorArray(_colorArray.get());
state.lazyDisablingOfVertexAttributes();