56 void assign(
unsigned int size,
const unsigned char* data);
59 unsigned int getSize()
const {
return static_cast<unsigned int>(_data.size()); }
62 unsigned char*
getData() {
return _data.empty() ? 0 : &(_data.front()); }
65 const unsigned char*
getData()
const {
return _data.empty() ? 0 : &(_data.front()); }
73 typedef std::vector<unsigned char>
Data;
124 inline void setFileName(
const std::string& fileName) { _shaderFileName = fileName; }
127 inline const std::string&
getFileName()
const {
return _shaderFileName; }
165#ifdef OSG_USE_DEPRECATED_API
167 static Shader* readShaderFile( Type type,
const std::string& fileName );
170 bool loadShaderSourceFromFile(
const std::string& fileName );
182 void addCodeInjection(
float position,
const std::string& code) { _codeInjectionMap.insert(CodeInjectionMap::value_type(position, code)); }
332 unsigned int getNumShaders()
const {
return static_cast<unsigned int>(_shaders.size()); }
340 typedef std::vector< osg::ref_ptr<osg::Shader> >
Shaders;
#define GL_FRAGMENT_SHADER
Definition GLDefines:92
#define GL_GEOMETRY_SHADER
Definition GLDefines:198
#define GL_TESS_CONTROL_SHADER
Definition GLDefines:242
#define GL_COMPUTE_SHADER
Definition GLDefines:477
#define GL_TESS_EVALUATION_SHADER
Definition GLDefines:241
#define GL_VERTEX_SHADER
Definition GLDefines:93
This class provides an object-oriented thread mutex interface.
Definition Mutex:31
@ SHALLOW_COPY
Definition CopyOp:47
Definition osg/Program:52
Data _data
Definition Shader:74
unsigned char * getData()
Definition Shader:62
ShaderBinary(const ShaderBinary &rhs, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
META_Object(osg, ShaderBinary)
void allocate(unsigned int size)
const unsigned char * getData() const
Definition Shader:65
static ShaderBinary * readShaderBinaryFile(const std::string &fileName)
unsigned int getSize() const
Definition Shader:59
std::vector< unsigned char > Data
Definition Shader:73
void assign(unsigned int size, const unsigned char *data)
unsigned int getNumShaders() const
Definition Shader:332
std::vector< osg::ref_ptr< osg::Shader > > Shaders
Definition Shader:340
virtual void releaseGLObjects(State *state=0) const
virtual void compileGLObjects(State &state) const
const osg::Shader * getShader(unsigned int i) const
Definition Shader:330
ShaderComponent(const ShaderComponent &sc, const CopyOp ©op=CopyOp::SHALLOW_COPY)
META_Object(osg, ShaderComponent)
Shaders _shaders
Definition Shader:341
osg::Shader * getShader(unsigned int i)
Definition Shader:329
void removeShader(unsigned int i)
virtual void resizeGLObjectBuffers(unsigned int maxSize)
unsigned int addShader(osg::Shader *shader)
void attachShader(GLuint program) const
bool needsCompile() const
Definition Shader:223
std::string _defineStr
Definition Shader:247
bool _needsCompile
Definition Shader:250
const Shader * _shader
Definition Shader:238
bool getInfoLog(std::string &infoLog) const
void setDefineString(const std::string &defStr)
Definition Shader:216
GLuint _glShaderHandle
Definition Shader:244
bool isCompiled() const
Definition Shader:224
void compileShader(osg::State &state)
const std::string & getDefineString() const
Definition Shader:217
const unsigned int _contextID
Definition Shader:255
PerContextShader(const Shader *shader, unsigned int contextID)
GLuint getHandle() const
Definition Shader:219
bool _isCompiled
Definition Shader:253
osg::ref_ptr< osg::GLExtensions > _extensions
Definition Shader:241
void detachShader(GLuint program) const
ShaderDefines _shaderRequirements
Definition Shader:304
const std::string & getFileName() const
Definition Shader:127
Type _type
Definition Shader:294
Shader(const Shader &rhs, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
std::string _shaderFileName
Definition Shader:295
ShaderBinary * getShaderBinary()
Definition Shader:160
Shader(Type type, ShaderBinary *shaderBinary)
const ShaderDefines & getShaderRequirements() const
Definition Shader:153
Shader(Type type, const std::string &source)
void _parseShaderDefines(const std::string &str, ShaderDefines &defines)
osg::buffered_value< osg::ref_ptr< ShaderObjects > > _pcsList
Definition Shader:310
ShaderDefinesMode
Definition Shader:138
@ USE_SHADER_PRAGMA
Definition Shader:139
ShaderDefines _shaderDefines
Definition Shader:303
const ShaderBinary * getShaderBinary() const
Definition Shader:163
void releaseGLObjects(osg::State *state=0) const
ShaderDefines & getShaderDefines()
Definition Shader:148
virtual void resizeGLObjectBuffers(unsigned int maxSize)
osg::ref_ptr< ShaderBinary > _shaderBinary
Definition Shader:297
std::string _shaderSource
Definition Shader:296
void _computeShaderDefines()
std::set< osg::Program * > ProgramSet
Definition Shader:307
Type getType() const
Definition Shader:117
ShaderDefinesMode getShaderDefinesMode() const
Definition Shader:144
void setShaderBinary(ShaderBinary *shaderBinary)
Definition Shader:157
void setFileName(const std::string &fileName)
Definition Shader:124
const ShaderDefines & getShaderDefines() const
Definition Shader:149
ProgramSet _programSet
Definition Shader:308
void setShaderSource(const std::string &sourceText)
bool addProgramRef(osg::Program *program)
void setShaderDefines(const ShaderDefines &shaderDefs)
Definition Shader:147
ShaderDefines & getShaderRequirements()
Definition Shader:152
PerContextShader * getPCS(osg::State &state) const
const char * getTypename() const
void setShaderDefinesMode(ShaderDefinesMode sdm)
Definition Shader:143
OpenThreads::Mutex _programSetMutex
Definition Shader:309
bool removeProgramRef(osg::Program *program)
int compare(const Shader &rhs) const
Shader(Type type=UNDEFINED)
const std::string & getShaderSource() const
Definition Shader:134
CodeInjectionMap & getCodeInjectionMap()
Definition Shader:185
void setShaderRequirements(const ShaderDefines &shaderDefs)
Definition Shader:151
void addCodeInjection(float position, const std::string &code)
Definition Shader:182
void compileShader(osg::State &state) const
const CodeInjectionMap & getCodeInjectionMap() const
Definition Shader:188
CodeInjectionMap _codeInjectionMap
Definition Shader:299
static Shader::Type getTypeId(const std::string &tname)
std::multimap< float, std::string > CodeInjectionMap
Definition Shader:174
ShaderDefinesMode _shaderDefinesMode
Definition Shader:302
Definition buffered_value:27
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19
std::set< std::string > ShaderDefines
Definition Shader:37
#define OSG_EXPORT
Definition osg/Export:39
ShaderObjects(const Shader *shader, unsigned int contextID)
unsigned int _contextID
Definition Shader:270
PerContextShader * createPerContextShader(const std::string &defineStr)
PerContextShader * getPCS(const std::string &defineStr) const
PerContextShaders _perContextShaders
Definition Shader:272
std::vector< osg::ref_ptr< PerContextShader > > PerContextShaders
Definition Shader:266
const Shader * _shader
Definition Shader:271