Privacy
An open-source, flexible 3D physical simulation framework
osg_material_manager::YamlSP Class Reference

Implementation (not much more than a wrapper) of the IShaderProvider for use with the old YamlShader files. More...

#include <YamlSP.h>

Public Member Functions

 YamlSP (string res_path)
 
int getMinVersion ()
 Returns the minimal glsl version needed for the generated shader. More...
 
const set< GLSLUniform > & getUniforms () const
 Returns the set of uniforms needed by this shader. More...
 
const set< GLSLAttribute > & getVaryings () const
 Returns the set of varyings needed/created by this shader. More...
 
const set< string > & getEnabledExtensions () const
 Returns the set of extensions enabled by this shader. More...
 
const set< string > & getDisabledExtensions () const
 Returns the set of extensions disabled by this shader. More...
 
const vector< pair< string, string > > getDependencies () const
 Returns this shaders dependencies. More...
 
const std::set< GLSLConstant > & getConstants () const
 Returns the set of constants created by this shader. More...
 
const std::set< GLSLAttribute > & getAttributes () const
 Returns the set of attributes needed by this shader. More...
 
string generateMainSource ()
 Generates the main function of this shader. More...
 
string generateDefinitions ()
 Generates function definitions for this shader. More...
 
void addShaderFunction (ShaderFunc *func)
 Adds a shader function to this Provider or merges it with an existing one if present. More...
 
void setupShaderEnv (ShaderType shader_type, ConfigMap material, bool has_texture, bool use_world_tex_coords)
 Sets up uniforms, exports, etc in code needed by the Yaml Shader Files. More...
 
- Public Member Functions inherited from osg_material_manager::IShaderProvider
 IShaderProvider (string res_path)
 

Private Attributes

unique_ptr< ShaderFuncfunction
 Pointer to the shader function containing all necessary information to generate the shader code. More...
 

Additional Inherited Members

- Protected Attributes inherited from osg_material_manager::IShaderProvider
string resPath
 The resource path for accessing definition files. More...
 

Detailed Description

Implementation (not much more than a wrapper) of the IShaderProvider for use with the old YamlShader files.

Intended only for demonstration and not recommended for productive use anymore. (The shader functions still have to be created manually by code or YamlShader instances)

Definition at line 41 of file YamlSP.h.

Constructor & Destructor Documentation

◆ YamlSP()

osg_material_manager::YamlSP::YamlSP ( string  res_path)

Definition at line 26 of file YamlSP.cpp.

Member Function Documentation

◆ addShaderFunction()

void osg_material_manager::YamlSP::addShaderFunction ( ShaderFunc func)

Adds a shader function to this Provider or merges it with an existing one if present.

This function takes ownership of the given pointer and manages its memory.

Parameters
funcThe function to add/merge to this provider

Definition at line 134 of file YamlSP.cpp.

◆ generateDefinitions()

string osg_material_manager::YamlSP::generateDefinitions ( )
virtual

Generates function definitions for this shader.

Should also contain everything else outside of the main function that is not defining uniforms, varyings, extensions, constants or attributes.

Implements osg_material_manager::IShaderProvider.

Definition at line 108 of file YamlSP.cpp.

◆ generateMainSource()

string osg_material_manager::YamlSP::generateMainSource ( )
virtual

Generates the main function of this shader.

Implements osg_material_manager::IShaderProvider.

Definition at line 64 of file YamlSP.cpp.

◆ getAttributes()

const std::set< GLSLAttribute > & osg_material_manager::YamlSP::getAttributes ( ) const
virtual

Returns the set of attributes needed by this shader.

Implements osg_material_manager::IShaderProvider.

Definition at line 57 of file YamlSP.cpp.

◆ getConstants()

const std::set< GLSLConstant > & osg_material_manager::YamlSP::getConstants ( ) const
virtual

Returns the set of constants created by this shader.

Implements osg_material_manager::IShaderProvider.

Definition at line 50 of file YamlSP.cpp.

◆ getDependencies()

const vector< pair< string, string > > osg_material_manager::YamlSP::getDependencies ( ) const
virtual

Returns this shaders dependencies.

Implements osg_material_manager::IShaderProvider.

Definition at line 130 of file YamlSP.cpp.

◆ getDisabledExtensions()

const set< string > & osg_material_manager::YamlSP::getDisabledExtensions ( ) const
virtual

Returns the set of extensions disabled by this shader.

Implements osg_material_manager::IShaderProvider.

Definition at line 123 of file YamlSP.cpp.

◆ getEnabledExtensions()

const set< string > & osg_material_manager::YamlSP::getEnabledExtensions ( ) const
virtual

Returns the set of extensions enabled by this shader.

Implements osg_material_manager::IShaderProvider.

Definition at line 115 of file YamlSP.cpp.

◆ getMinVersion()

int osg_material_manager::YamlSP::getMinVersion ( )
virtual

Returns the minimal glsl version needed for the generated shader.

Implements osg_material_manager::IShaderProvider.

Definition at line 29 of file YamlSP.cpp.

◆ getUniforms()

const set< GLSLUniform > & osg_material_manager::YamlSP::getUniforms ( ) const
virtual

Returns the set of uniforms needed by this shader.

Implements osg_material_manager::IShaderProvider.

Definition at line 36 of file YamlSP.cpp.

◆ getVaryings()

const set< GLSLAttribute > & osg_material_manager::YamlSP::getVaryings ( ) const
virtual

Returns the set of varyings needed/created by this shader.

Implements osg_material_manager::IShaderProvider.

Definition at line 43 of file YamlSP.cpp.

◆ setupShaderEnv()

void osg_material_manager::YamlSP::setupShaderEnv ( ShaderType  shader_type,
ConfigMap  material,
bool  has_texture,
bool  use_world_tex_coords 
)

Sets up uniforms, exports, etc in code needed by the Yaml Shader Files.

Parameters
shader_typeThe Shader Type this YamlSP is the provider for
materialThe entire material ConfigMap
has_textureBool determining if a texture is used in the shader or not
use_world_tex_coordsDetermines if to use global texture coordinates or not

Definition at line 143 of file YamlSP.cpp.

Member Data Documentation

◆ function

unique_ptr<ShaderFunc> osg_material_manager::YamlSP::function
private

Pointer to the shader function containing all necessary information to generate the shader code.

Definition at line 85 of file YamlSP.h.


The documentation for this class was generated from the following files: