Implemented lighter weight setting of the CurrentVertexArrayState and introduced GlobalVertexArrayState.
This commit is contained in:
@@ -500,12 +500,22 @@ class OSG_EXPORT State : public Referenced
|
||||
void dirtyAllAttributes();
|
||||
|
||||
|
||||
struct SetCurrentVertexArrayStateProxy
|
||||
{
|
||||
SetCurrentVertexArrayStateProxy(osg::State& state, VertexArrayState* vas):_state(state) { _state.setCurrentVertexArrayState(vas); }
|
||||
~SetCurrentVertexArrayStateProxy() { _state.setCurrentToGloabalVertexArrayState(); }
|
||||
osg::State& _state;
|
||||
};
|
||||
|
||||
|
||||
/** Set the CurrentVetexArrayState object that take which vertex arrays are bound.*/
|
||||
void setCurrentVertexArrayState(VertexArrayState* vas) { _currentVertexArrayState = vas; }
|
||||
|
||||
/** Get the CurrentVetexArrayState object that take which vertex arrays are bound.*/
|
||||
VertexArrayState* getCurrentVertexArrayState() const { return _currentVertexArrayState.get(); }
|
||||
VertexArrayState* getCurrentVertexArrayState() const { return _currentVertexArrayState; }
|
||||
|
||||
/** Set the getCurrentVertexArrayState to the GloabalVertexArrayState.*/
|
||||
void setCurrentToGloabalVertexArrayState() { _currentVertexArrayState = _globalVertexArrayState.get(); }
|
||||
|
||||
|
||||
/** disable the vertex, normal, color, tex coords, secondary color, fog coord and index arrays.*/
|
||||
@@ -1780,7 +1790,8 @@ class OSG_EXPORT State : public Referenced
|
||||
GraphicsContext* _graphicsContext;
|
||||
unsigned int _contextID;
|
||||
|
||||
osg::ref_ptr<VertexArrayState> _currentVertexArrayState;
|
||||
osg::ref_ptr<VertexArrayState> _globalVertexArrayState;
|
||||
VertexArrayState* _currentVertexArrayState;
|
||||
|
||||
bool _shaderCompositionEnabled;
|
||||
bool _shaderCompositionDirty;
|
||||
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
public:
|
||||
|
||||
|
||||
osg::GLBufferObject* getGLBufferObject(osg::Array* array);
|
||||
// osg::GLBufferObject* getGLBufferObject(osg::Array* array);
|
||||
|
||||
osg::ref_ptr<osg::GLExtensions> _ext;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user