From 38ff11f8c5d97efd3f9044aaa2a900cabe1e7fe0 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 11 Oct 2016 15:14:14 +0100 Subject: [PATCH] Renamed ArrayDispatchers to AttributeDispatchers to better reflect it's role --- ...{ArrayDispatchers => AttributeDispatchers} | 10 ++++---- include/osg/State | 6 ++--- include/osg/VertexArrayState | 2 +- ...spatchers.cpp => AttributeDispatchers.cpp} | 24 +++++++++---------- src/osg/CMakeLists.txt | 4 ++-- src/osg/Geometry.cpp | 24 +++++++++---------- src/osgTerrain/GeometryPool.cpp | 10 ++++---- 7 files changed, 40 insertions(+), 40 deletions(-) rename include/osg/{ArrayDispatchers => AttributeDispatchers} (95%) rename src/osg/{ArrayDispatchers.cpp => AttributeDispatchers.cpp} (92%) diff --git a/include/osg/ArrayDispatchers b/include/osg/AttributeDispatchers similarity index 95% rename from include/osg/ArrayDispatchers rename to include/osg/AttributeDispatchers index 2044520bb..356a048e3 100644 --- a/include/osg/ArrayDispatchers +++ b/include/osg/AttributeDispatchers @@ -11,8 +11,8 @@ * OpenSceneGraph Public License for more details. */ -#ifndef OSG_ArrayDispatchers -#define OSG_ArrayDispatchers 1 +#ifndef OSG_ATTRIBUTEDISPATCHERS +#define OSG_ATTRIBUTEDISPATCHERS 1 #include #include @@ -31,12 +31,12 @@ struct AttributeDispatch : public osg::Referenced }; /** Helper class for managing the dispatch to OpenGL of various attribute arrays such as stored in osg::Geometry.*/ -class OSG_EXPORT ArrayDispatchers : public osg::Referenced +class OSG_EXPORT AttributeDispatchers : public osg::Referenced { public: - ArrayDispatchers(); - ~ArrayDispatchers(); + AttributeDispatchers(); + ~AttributeDispatchers(); void setState(osg::State* state); diff --git a/include/osg/State b/include/osg/State index b84575cb9..62bedd2d9 100644 --- a/include/osg/State +++ b/include/osg/State @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include @@ -877,7 +877,7 @@ class OSG_EXPORT State : public Referenced void initializeExtensionProcs(); /** Get the helper class for dispatching osg::Arrays as OpenGL attribute data.*/ - inline ArrayDispatchers& getArrayDispatchers() { return _arrayDispatchers; } + inline AttributeDispatchers& getAttributeDispatchers() { return _arrayDispatchers; } /** Set the helper class that provides applications with estimate on how much different graphics operations will cost.*/ @@ -1341,7 +1341,7 @@ class OSG_EXPORT State : public Referenced unsigned int _dynamicObjectCount; osg::ref_ptr _completeDynamicObjectRenderingCallback; - ArrayDispatchers _arrayDispatchers; + AttributeDispatchers _arrayDispatchers; osg::ref_ptr _graphicsCostEstimator; diff --git a/include/osg/VertexArrayState b/include/osg/VertexArrayState index 2dfe4ed41..d7f99c269 100644 --- a/include/osg/VertexArrayState +++ b/include/osg/VertexArrayState @@ -17,7 +17,7 @@ #include #include #include -#include +#include namespace osg { diff --git a/src/osg/ArrayDispatchers.cpp b/src/osg/AttributeDispatchers.cpp similarity index 92% rename from src/osg/ArrayDispatchers.cpp rename to src/osg/AttributeDispatchers.cpp index e9acfc9fc..e3b0d0538 100644 --- a/src/osg/ArrayDispatchers.cpp +++ b/src/osg/AttributeDispatchers.cpp @@ -10,7 +10,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ -#include +#include #include #include @@ -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(); @@ -262,7 +262,7 @@ void ArrayDispatchers::assignVertexAttribDispatchers(unsigned int unit) } } -void ArrayDispatchers::reset() +void AttributeDispatchers::reset() { if (!_initialized) init(); diff --git a/src/osg/CMakeLists.txt b/src/osg/CMakeLists.txt index 2f2817358..2ab5f3ca1 100644 --- a/src/osg/CMakeLists.txt +++ b/src/osg/CMakeLists.txt @@ -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 diff --git a/src/osg/Geometry.cpp b/src/osg/Geometry.cpp index 58ea71c6a..633cf7458 100644 --- a/src/osg/Geometry.cpp +++ b/src/osg/Geometry.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include @@ -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(); diff --git a/src/osgTerrain/GeometryPool.cpp b/src/osgTerrain/GeometryPool.cpp index 0ec6f46ff..c22d4c487 100644 --- a/src/osgTerrain/GeometryPool.cpp +++ b/src/osgTerrain/GeometryPool.cpp @@ -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();