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

@@ -60,6 +60,7 @@
#include "Impostor.h"
#include "CoordinateSystemNode.h"
#include "Uniform.h"
#include "Shader.h"
#include "LightPointNode.h"
#include "MultiSwitch.h"
@@ -818,6 +819,31 @@ osg::Uniform* DataInputStream::readUniform()
return uniform;
}
osg::Shader* DataInputStream::readShader()
{
// Read shaders unique ID.
int id = readInt();
// See if shader is already in the list.
ShaderMap::iterator itr= _shaderMap.find(id);
if (itr!=_shaderMap.end()) return itr->second.get();
// Shader is not in list.
// Create a new shader,
osg::Shader* shader = new osg::Shader();
// read its properties from stream
((ive::Shader*)(shader))->read(this);
// and add it to the shader map,
_shaderMap[id] = shader;
if (_verboseOutput) std::cout<<"read/writeShader() ["<<id<<"]"<<std::endl;
return shader;
}
osg::Drawable* DataInputStream::readDrawable()
{
// Read stateattributes unique ID.