Further work on GLSL support in .ive

This commit is contained in:
Robert Osfield
2005-05-11 11:42:09 +00:00
parent fb34b22e34
commit 8d31e75364
8 changed files with 121 additions and 7 deletions

View File

@@ -43,6 +43,7 @@
#include "FrontFace.h"
#include "Program.h"
#include "Uniform.h"
#include "Shader.h"
#include "Group.h"
#include "MatrixTransform.h"
@@ -599,7 +600,7 @@ void DataOutputStream::writeUniform(const osg::Uniform* uniform)
// Id already exists so just write ID.
writeInt(itr->second);
if (_verboseOutput) std::cout<<"read/writeStateSet() ["<<itr->second<<"]"<<std::endl;
if (_verboseOutput) std::cout<<"read/writeUniform() ["<<itr->second<<"]"<<std::endl;
}
else
{
@@ -620,6 +621,35 @@ void DataOutputStream::writeUniform(const osg::Uniform* uniform)
}
}
void DataOutputStream::writeShader(const osg::Shader* shader)
{
ShaderMap::iterator itr = _shaderMap.find(shader);
if (itr!=_shaderMap.end())
{
// Id already exists so just write ID.
writeInt(itr->second);
if (_verboseOutput) std::cout<<"read/writeShader() ["<<itr->second<<"]"<<std::endl;
}
else
{
// id doesn't exist so create a new ID and
// register the shader.
int id = _shaderMap.size();
_shaderMap[shader] = id;
// write the id.
writeInt(id);
// write the stateset.
((ive::Shader*)(shader))->write(this);
if (_verboseOutput) std::cout<<"read/writeShader() ["<<id<<"]"<<std::endl;
}
}
void DataOutputStream::writeDrawable(const osg::Drawable* drawable)
{
DrawableMap::iterator itr = _drawableMap.find(drawable);