Added basic ShaderComponent class and beginnings osgshadercomposition example

This commit is contained in:
Robert Osfield
2010-07-02 12:04:20 +00:00
parent aef5e36cf1
commit a55c4b7d70
12 changed files with 163 additions and 32 deletions

View File

@@ -19,11 +19,13 @@ using namespace osg;
ShaderAttribute::ShaderAttribute()
{
_shaderComponent = new osg::ShaderComponent;
}
ShaderAttribute::ShaderAttribute(const ShaderAttribute& sa,const CopyOp& copyop):
StateAttribute(sa,copyop),
_type(sa._type)
_type(sa._type),
_uniforms(sa._uniforms)
{
}
@@ -50,24 +52,6 @@ void ShaderAttribute::setType(Type type)
_type = type;
}
unsigned int ShaderAttribute::addShader(Shader* shader)
{
// check to see if shader already add, if so return the index of it
for(unsigned int i=0; i<_shaders.size(); ++i)
{
if (_shaders[i] == shader) return i;
}
// add shader and return it's position
_shaders.push_back(shader);
return _shaders.size()-1;
}
void ShaderAttribute::removeShader(unsigned int i)
{
_shaders.erase(_shaders.begin()+i);
}
unsigned int ShaderAttribute::addUniform(Uniform* uniform)
{
// check to see if uniform already add, if so return the index of it