diff --git a/include/osg/State b/include/osg/State index dc9c5c267..c8655374f 100644 --- a/include/osg/State +++ b/include/osg/State @@ -263,14 +263,35 @@ class OSG_EXPORT State : public Referenced, public Observer typedef std::vector VertexAttribAliasList; + /** Reset the vertex attribute aliasing to osg's default. This method needs to be called before render anything unless you really know what you're doing !*/ + void resetVertexAttributeAlias(bool compactAliasing=true); + + /** Set the vertex attribute aliasing for "vertex". This method needs to be called before render anything unless you really know what you're doing !*/ + void setVertexAlias(const VertexAttribAlias& alias) { _vertexAlias = alias; } const VertexAttribAlias& getVertexAlias() { return _vertexAlias; } + + /** Set the vertex attribute aliasing for "normal". This method needs to be called before render anything unless you really know what you're doing !*/ + void setNormalAlias(const VertexAttribAlias& alias) { _normalAlias = alias; } const VertexAttribAlias& getNormalAlias() { return _normalAlias; } + + /** Set the vertex attribute aliasing for "color". This method needs to be called before render anything unless you really know what you're doing !*/ + void setColorAlias(const VertexAttribAlias& alias) { _colorAlias = alias; } const VertexAttribAlias& getColorAlias() { return _colorAlias; } + + /** Set the vertex attribute aliasing for "secondary color". This method needs to be called before render anything unless you really know what you're doing !*/ + void setSecondaryColorAlias(const VertexAttribAlias& alias) { _secondaryColorAlias = alias; } const VertexAttribAlias& getSecondaryColorAlias() { return _secondaryColorAlias; } + + /** Set the vertex attribute aliasing for "fog coord". This method needs to be called before render anything unless you really know what you're doing !*/ + void setFogCoordAlias(const VertexAttribAlias& alias) { _fogCoordAlias = alias; } const VertexAttribAlias& getFogCoordAlias() { return _fogCoordAlias; } + + /** Set the vertex attribute aliasing list for texture coordinates. This method needs to be called before render anything unless you really know what you're doing !*/ + void setTexCoordAliasList(const VertexAttribAliasList& aliasList) { _texCoordAliasList = aliasList; } const VertexAttribAliasList& getTexCoordAliasList() { return _texCoordAliasList; } - + /** Set the vertex attribute binding list. This method needs to be called before render anything unless you really know what you're doing !*/ + void setAttributeBindingList(const Program::AttribBindingList& attribBindingList) { _attributeBindingList = attribBindingList; } const Program::AttribBindingList& getAttributeBindingList() { return _attributeBindingList; } bool convertVertexShaderSourceToOsgBuiltIns(std::string& source) const; diff --git a/src/osg/State.cpp b/src/osg/State.cpp index 471b372a0..e9f7109c8 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -67,47 +67,7 @@ State::State(): _modelViewProjectionMatrixUniform = new Uniform(Uniform::FLOAT_MAT4,"osg_ModelViewProjectionMatrix"); _normalMatrixUniform = new Uniform(Uniform::FLOAT_MAT3,"osg_NormalMatrix"); - bool compactAliasing = true; - if (compactAliasing) - { - setUpVertexAttribAlias(_vertexAlias,0, "gl_Vertex","osg_Vertex","attribute vec4 "); - setUpVertexAttribAlias(_normalAlias, 1, "gl_Normal","osg_Normal","attribute vec3 "); - setUpVertexAttribAlias(_colorAlias, 2, "gl_Color","osg_Color","attribute vec4 "); - - _texCoordAliasList.resize(5); - for(unsigned int i=0; i<_texCoordAliasList.size(); i++) - { - std::stringstream gl_MultiTexCoord; - std::stringstream osg_MultiTexCoord; - gl_MultiTexCoord<<"gl_MultiTexCoord"<