Cinder  0.9.1
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
cinder::gl::GlslProg::Format Struct Reference

#include <GlslProg.h>

Public Member Functions

 Format ()
 
Formatvertex (const DataSourceRef &dataSource)
 
Formatvertex (const std::string &vertexShader)
 
Formatfragment (const DataSourceRef &dataSource)
 
Formatfragment (const std::string &vertexShader)
 
const std::string & getVertex () const
 
const std::string & getFragment () const
 
FormatfragDataLocation (GLuint colorNumber, const std::string &name)
 
const std::map< std::string, GLuint > & getFragDataLocations () const
 
Formatattrib (geom::Attrib semantic, const std::string &attribName)
 
Formatuniform (UniformSemantic semantic, const std::string &attribName)
 
FormatattribLocation (const std::string &attribName, GLint location)
 
FormatattribLocation (geom::Attrib attr, GLint location)
 
bool isPreprocessingEnabled () const
 
void setPreprocessingEnabled (bool enable)
 
Formatpreprocess (bool enable)
 
Formatdefine (const std::string &define)
 
Formatdefine (const std::string &define, const std::string &value)
 
FormatdefineDirectives (const std::vector< std::string > &defines)
 
Formatversion (int version)
 
int getVersion () const
 
const std::vector< std::string > & getDefineDirectives () const
 
FormataddPreprocessorSearchDirectory (const fs::path &dir)
 
const std::string & getLabel () const
 
void setLabel (const std::string &label)
 
Formatlabel (const std::string &label)
 
const fs::path & getVertexPath () const
 
const fs::path & getFragmentPath () const
 
const std::vector< Uniform > & getUniforms () const
 
const std::vector< Attribute > & getAttributes () const
 
std::vector< Uniform > & getUniforms ()
 
std::vector< Attribute > & getAttributes ()
 

Protected Member Functions

void setShaderSource (const DataSourceRef &dataSource, std::string *shaderSourceDest, fs::path *shaderPathDest)
 
void setShaderSource (const std::string &source, std::string *shaderSourceDest, fs::path *shaderPathDest)
 

Protected Attributes

std::string mVertexShader
 
std::string mFragmentShader
 
fs::path mVertexShaderPath
 
fs::path mFragmentShaderPath
 
std::vector< AttributemAttributes
 
std::vector< UniformmUniforms
 
std::vector< std::string > mDefineDirectives
 
int mVersion
 
bool mPreprocessingEnabled
 
std::string mLabel
 
std::vector< fs::path > mPreprocessorSearchDirectories
 

Friends

class GlslProg
 

Constructor & Destructor Documentation

cinder::gl::GlslProg::Format::Format ( )

Defaults to specifying location 0 for the geom::Attrib::POSITION semantic.

Member Function Documentation

GlslProg::Format & cinder::gl::GlslProg::Format::vertex ( const DataSourceRef dataSource)

Supplies the GLSL source for the vertex shader.

GlslProg::Format & cinder::gl::GlslProg::Format::vertex ( const std::string &  vertexShader)

Supplies the GLSL source for the vertex shader.

GlslProg::Format & cinder::gl::GlslProg::Format::fragment ( const DataSourceRef dataSource)

Supplies the GLSL source for the fragment shader.

GlslProg::Format & cinder::gl::GlslProg::Format::fragment ( const std::string &  vertexShader)

Supplies the GLSL source for the fragment shader.

const std::string& cinder::gl::GlslProg::Format::getVertex ( ) const

Returns the GLSL source for the vertex shader. Returns an empty string if it isn't present.

const std::string& cinder::gl::GlslProg::Format::getFragment ( ) const

Returns the GLSL source for the fragment shader. Returns an empty string if it isn't present.

GlslProg::Format & cinder::gl::GlslProg::Format::fragDataLocation ( GLuint  colorNumber,
const std::string &  name 
)

Specifies a binding for a user-defined varying out variable to a fragment shader color number. Analogous to glBindFragDataLocation.

const std::map<std::string,GLuint>& cinder::gl::GlslProg::Format::getFragDataLocations ( ) const

Returns the map between output variable names and their bound color numbers.

GlslProg::Format & cinder::gl::GlslProg::Format::attrib ( geom::Attrib  semantic,
const std::string &  attribName 
)

Specifies an attribute name to map to a specific semantic.

GlslProg::Format & cinder::gl::GlslProg::Format::uniform ( UniformSemantic  semantic,
const std::string &  attribName 
)

Specifies a uniform name to map to a specific semantic.

GlslProg::Format & cinder::gl::GlslProg::Format::attribLocation ( const std::string &  attribName,
GLint  location 
)

Specifies a location for a specific named attribute.

GlslProg::Format & cinder::gl::GlslProg::Format::attribLocation ( geom::Attrib  attr,
GLint  location 
)

Specifies a location for a semantic.

bool cinder::gl::GlslProg::Format::isPreprocessingEnabled ( ) const

Returns whether preprocessing is enabled or not, e.g. #include statements. true.

void cinder::gl::GlslProg::Format::setPreprocessingEnabled ( bool  enable)

Sets whether preprocessing is enabled or not, e.g. #include statements.

Format& cinder::gl::GlslProg::Format::preprocess ( bool  enable)

Sets whether preprocessing is enabled or not, e.g. #include statements.

GlslProg::Format & cinder::gl::GlslProg::Format::define ( const std::string &  define)

Specifies a define directive to add to the shader sources.

GlslProg::Format & cinder::gl::GlslProg::Format::define ( const std::string &  define,
const std::string &  value 
)

Specifies a define directive to add to the shader sources.

GlslProg::Format & cinder::gl::GlslProg::Format::defineDirectives ( const std::vector< std::string > &  defines)

Specifies a series of define directives to add to the shader sources.

GlslProg::Format & cinder::gl::GlslProg::Format::version ( int  version)

Specifies the version directive to add to the shader sources.

int cinder::gl::GlslProg::Format::getVersion ( ) const

Returns the version number associated with this GlslProg, or 0 if none was speciefied.

const std::vector<std::string>& cinder::gl::GlslProg::Format::getDefineDirectives ( ) const

Returns the list of define directives.

Format& cinder::gl::GlslProg::Format::addPreprocessorSearchDirectory ( const fs::path &  dir)

Adds a custom search directory to the ShaderPreprocessor's search list.

const std::string& cinder::gl::GlslProg::Format::getLabel ( ) const

Returns the debugging label associated with the Program.

void cinder::gl::GlslProg::Format::setLabel ( const std::string &  label)

Sets the debugging label associated with the Program. Calls glObjectLabel() when available.

Format& cinder::gl::GlslProg::Format::label ( const std::string &  label)

Sets the debugging label associated with the Program. Calls glObjectLabel() when available.

const fs::path& cinder::gl::GlslProg::Format::getVertexPath ( ) const

Returns the fs::path for the vertex shader. Returns an empty fs::path if it isn't present.

const fs::path& cinder::gl::GlslProg::Format::getFragmentPath ( ) const

Returns the fs::path for the fragment shader. Returns an empty fs::path if it isn't present.

const std::vector<Uniform>& cinder::gl::GlslProg::Format::getUniforms ( ) const
const std::vector<Attribute>& cinder::gl::GlslProg::Format::getAttributes ( ) const
std::vector<Uniform>& cinder::gl::GlslProg::Format::getUniforms ( )
std::vector<Attribute>& cinder::gl::GlslProg::Format::getAttributes ( )
void cinder::gl::GlslProg::Format::setShaderSource ( const DataSourceRef dataSource,
std::string *  shaderSourceDest,
fs::path *  shaderPathDest 
)
protected
void cinder::gl::GlslProg::Format::setShaderSource ( const std::string &  source,
std::string *  shaderSourceDest,
fs::path *  shaderPathDest 
)
protected

Friends And Related Function Documentation

friend class GlslProg
friend

Member Data Documentation

std::string cinder::gl::GlslProg::Format::mVertexShader
protected
std::string cinder::gl::GlslProg::Format::mFragmentShader
protected
fs::path cinder::gl::GlslProg::Format::mVertexShaderPath
protected
fs::path cinder::gl::GlslProg::Format::mFragmentShaderPath
protected
std::vector<Attribute> cinder::gl::GlslProg::Format::mAttributes
protected
std::vector<Uniform> cinder::gl::GlslProg::Format::mUniforms
protected
std::vector<std::string> cinder::gl::GlslProg::Format::mDefineDirectives
protected
int cinder::gl::GlslProg::Format::mVersion
protected
bool cinder::gl::GlslProg::Format::mPreprocessingEnabled
protected
std::string cinder::gl::GlslProg::Format::mLabel
protected
std::vector<fs::path> cinder::gl::GlslProg::Format::mPreprocessorSearchDirectories
protected

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