Rasterfarm-SDK
Loading...
Searching...
No Matches
Program Class Reference

#include <program.h>

Inheritance diagram for Program:
DynamicType Surface::Material ShadowMap::ShadowMaterial

Public Types

enum  Errors { NO_LOCATION = -1 }
 
typedef Handle AttributeLocation
 
typedef Handle VaryingLocation
 
typedef Handle UniformBinding
 
typedef UnorderedMap< AttributeLocation, AttributeBuffer * > LocationAttributeBufferMap
 
typedef UnorderedMap< UniformBinding, Uniform * > BindingUniformMap
 
typedef UnorderedMap< AttributeLocation, bool > AttributeEnabled
 
typedef UnorderedMap< String, Handle > StringLocation
 
typedef UnorderedMap< UniformBinding, intBindingIntMap
 
typedef UnorderedMap< UniformBinding, floatBindingFloatMap
 
typedef UnorderedMap< UniformBinding, intBindingIntPointerMap
 
typedef UnorderedMap< UniformBinding, floatBindingFloatPointerMap
 
typedef UnorderedMap< UniformBinding, Vector2fArrayBindingVector2fArrayMap
 
typedef UnorderedMap< UniformBinding, Vector3fArrayBindingVector3fArrayMap
 
typedef UnorderedMap< UniformBinding, Vector4fArrayBindingVector4fArrayMap
 
typedef UnorderedMap< UniformBinding, HeapArray< Matrix3f > > BindingMatrix3fArrayMap
 
typedef UnorderedMap< UniformBinding, HeapArray< Matrix4f > > BindingMatrix4fArrayMap
 
typedef UnorderedMap< UniformBinding, UniformDescriptorTypeBindingDescriptorTypeMap
 

Public Member Functions

 Program ()
 
virtual ~Program ()
 
virtual void init ()
 
void update ()
 
DrawPrimitive getDrawPrimitive () const
 
void setDrawPrimitive (DrawPrimitive drawPrimitive)
 
void setElementBufferUsage (const DrawUsageHint usage)
 
bool hasUniformBuffer (UniformBinding binding)
 
void addUniformMatrix3f (UniformBinding binding, Matrix3f *pMatrix=nullptr, uint count=1)
 
void addUniformMatrix4f (UniformBinding binding, Matrix4f *pMatrix=nullptr, uint count=1)
 
void setUniformMatrix4f (UniformBinding binding, Matrix4f *pMatrix)
 
void addUniformValue1i (UniformBinding binding, int value)
 
void addUniformSampler2D (UniformBinding binding, Texture *pTexture, TextureType textureType=QUAD_MAP)
 
void addUniformSampler2D (UniformBinding binding, TextureUnit textureUnit, TextureType textureType=QUAD_MAP)
 
void addUniformValue1f (UniformBinding binding, float value)
 
void updateUniformValue1i (UniformBinding binding, int value)
 
void updateUniformValue1f (UniformBinding binding, float value)
 
void addUniformBuffer1i (UniformBinding binding, int *pValue, uint count=1)
 
void addUniformBuffer1f (UniformBinding binding, float *pValue, uint count=1)
 
void addUniformBuffer2f (UniformBinding binding, float *pArray, uint count=1)
 
void addUniformBuffer3f (UniformBinding binding, float *pArray, uint count=1)
 
void addUniformBuffer4f (UniformBinding binding, float *pArray, uint count=1)
 
void setUniformBuffer2f (UniformBinding binding, float *pArray)
 
void setUniformBuffer3f (UniformBinding binding, float *pArray)
 
void setUniformBuffer4f (UniformBinding binding, float *pArray)
 
ProgramHandle getHandle ()
 
void create (const HeapArray< Shader * > &pShader)
 
void addGlobalAttribute (const String &typeString, const String &location)
 
void addGlobalUniform (const String &typeString, const String &binding, ShaderType type)
 
void addGlobalSampler (const String &typeString, const String &binding)
 
void addGlobalVarying (const String &typeString, const String &location)
 
bool hasGlobalAttribute (const String &location)
 
bool hasGlobalAttribute (const String &typeString, const String &location)
 
bool hasGlobalUniform (const String &location, ShaderType type)
 
bool hasGlobalVarying (const String &location)
 
AttributeLocation getAttributeLocation (const String &str)
 
UniformBinding getUniformBinding (const String &str)
 
ProgramHandle getProgramHandle ()
 
bool hasShader (ShaderType shaderType)
 
ShadergetShader (ShaderType shaderType)
 
HeapArray< Shader * > getShaders ()
 
bool getDepthBufferWrite ()
 
void enable ()
 
void disable ()
 
bool hasEnableState (PipelineState state)
 
void addEnableState (PipelineState state)
 
void removeEnableState (PipelineState state)
 
void setStates ()
 
bool isTransparent ()
 
void setTransparent (bool transparent=true)
 
void setStencilComparisonArgs (CompareOperation stencilTestFunction, int stencilComparisonValue, Handle stencilComparisonMask)
 
void setStencilOperationArgs (StencilOperation stencilOperationFail, StencilOperation stencilOperationDepthFail, StencilOperation stencilOperationDepthPass)
 
void setTriangleVertexOrientation (VertexOrientation orientation)
 
void setDepthTestFunction (CompareOperation function)
 
void setDepthBufferWrite (bool write=true)
 
void setLineWidth (float width)
 
void setBlendFactors (BlendFactor sBlendFactor, BlendFactor dBlendFactor)
 
void setBlend ()
 
void bindAttributeBuffers ()
 
void submit (ElementBuffer *pElementBuffer)
 
void submitUniforms ()
 
void setUniformSampler2D (UniformBinding binding, Texture *pTexture, TextureType textureType)
 
void setUniformValue1i (UniformBinding location, int value)
 
void setUniformValue1f (UniformBinding location, float value)
 
void setUniformBuffer1f (UniformBinding location, float *pBuffer)
 
void updateUniformPointer1i (UniformBinding location, int count, int *pBuffer)
 
void updateUniformPointer1f (UniformBinding location, int count, float *pBuffer)
 
void updateUniformPointer2f (UniformBinding location, int count, float *pBuffer)
 
void updateUniformPointer3f (UniformBinding location, int count, float *pBuffer)
 
void updateUniformPointer4f (UniformBinding location, int count, float *pBuffer)
 
void updateUniformMatrix3f (UniformBinding location, int count, float *pBuffer)
 
void updateUniformMatrix4f (UniformBinding location, int count, float *pBuffer)
 
- Public Member Functions inherited from DynamicType
 DynamicType ()
 
template<class C >
void addType ()
 
TypeID getDerivedTypeId () const
 
template<class C >
const bool isType () const
 
template<class C >
const C * cast () const
 
template<class C >
C * cast ()
 
template<class FROM , class TO >
TO * cast ()
 
template<class FROM , class TO >
const TO * cast () const
 

Public Attributes

HeapArray< AttributeLocationattributeLocation
 
HeapArray< VaryingLocationvaryingLocation
 
StringLocation attributeHandle
 
StringLocation uniformHandle
 
StringLocation varyingHandle
 
AttributeEnabled attributeEnabled
 

Static Public Attributes

static const String shaderVersionString
 
static const String shaderMainStartString
 
static const String fragmentColorString
 
static const String fragnentShaderHeaderString
 
static const String vertexPositionString
 
static const String texture2DSamplerString
 
static const String textureCubeSamplerString
 
static const String projectionSamplerString
 

Protected Attributes

VertexArrayHandle vao
 
UnorderedMap< ShaderType, Shader * > pShader
 
LocationAttributeBufferMap pAttributeBuffer
 
BindingUniformMap pUniform
 
String vertexShaderCode
 
String vertexShaderMainCode
 
String vertexShaderFunctionCode
 
String vertexShaderGlobalCode
 
String fragmentShaderCode
 
String fragmentShaderMainCode
 
String fragmentShaderFunctionCode
 
String fragmentShaderGlobalCode
 
StringUnorderedSet globalAttributeString
 
StringUnorderedSet vertexVaryingString
 
StringUnorderedSet fragmentVaryingString
 
StringUnorderedSet vertexGlobalUniformString
 
StringUnorderedSet fragmentGlobalUniformString
 
StateUnorderedSet stateEnable
 
DrawUsageHint elementBufferUsage
 
ElementBufferpElementBuffer
 
bool transparent
 
CullFace faceCull
 
bool depthBufferWrite
 
DrawPrimitive drawPrimitive
 
CompareOperation depthTestFunction
 
CompareOperation stencilTestFunction
 
int stencilComparisonValue
 
Handle stencilComparisonMask
 
StencilOperation stencilOperationFail
 
StencilOperation stencilOperationDepthFail
 
StencilOperation stencilOperationDepthPass
 
VertexOrientation triangleVertexOrientation
 
BlendFactor sBlendFactor
 
BlendFactor dBlendFactor
 
float lineWidth
 

Friends

class Application
 
class RenderBuffer
 
class GraphicsPipeline
 

Member Typedef Documentation

◆ AttributeEnabled

typedef UnorderedMap< AttributeLocation, bool > Program::AttributeEnabled

◆ AttributeLocation

◆ BindingDescriptorTypeMap

◆ BindingFloatMap

typedef UnorderedMap< UniformBinding, float > Program::BindingFloatMap

◆ BindingFloatPointerMap

◆ BindingIntMap

typedef UnorderedMap< UniformBinding, int > Program::BindingIntMap

◆ BindingIntPointerMap

◆ BindingMatrix3fArrayMap

typedef UnorderedMap< UniformBinding, HeapArray< Matrix3f > > Program::BindingMatrix3fArrayMap

◆ BindingMatrix4fArrayMap

typedef UnorderedMap< UniformBinding, HeapArray< Matrix4f > > Program::BindingMatrix4fArrayMap

◆ BindingUniformMap

◆ BindingVector2fArrayMap

◆ BindingVector3fArrayMap

◆ BindingVector4fArrayMap

◆ LocationAttributeBufferMap

◆ StringLocation

typedef UnorderedMap< String, Handle > Program::StringLocation

◆ UniformBinding

typedef Handle Program::UniformBinding

◆ VaryingLocation

typedef Handle Program::VaryingLocation

Member Enumeration Documentation

◆ Errors

Enumerator
NO_LOCATION 

Constructor & Destructor Documentation

◆ Program()

Program::Program ( )

◆ ~Program()

virtual Program::~Program ( )
virtual

Member Function Documentation

◆ addEnableState()

void Program::addEnableState ( PipelineState state)

◆ addGlobalAttribute()

void Program::addGlobalAttribute ( const String & typeString,
const String & location )

◆ addGlobalSampler()

void Program::addGlobalSampler ( const String & typeString,
const String & binding )

◆ addGlobalUniform()

void Program::addGlobalUniform ( const String & typeString,
const String & binding,
ShaderType type )

◆ addGlobalVarying()

void Program::addGlobalVarying ( const String & typeString,
const String & location )

◆ addUniformBuffer1f()

void Program::addUniformBuffer1f ( UniformBinding binding,
float * pValue,
uint count = 1 )

◆ addUniformBuffer1i()

void Program::addUniformBuffer1i ( UniformBinding binding,
int * pValue,
uint count = 1 )

◆ addUniformBuffer2f()

void Program::addUniformBuffer2f ( UniformBinding binding,
float * pArray,
uint count = 1 )

◆ addUniformBuffer3f()

void Program::addUniformBuffer3f ( UniformBinding binding,
float * pArray,
uint count = 1 )

◆ addUniformBuffer4f()

void Program::addUniformBuffer4f ( UniformBinding binding,
float * pArray,
uint count = 1 )

◆ addUniformMatrix3f()

void Program::addUniformMatrix3f ( UniformBinding binding,
Matrix3f * pMatrix = nullptr,
uint count = 1 )

◆ addUniformMatrix4f()

void Program::addUniformMatrix4f ( UniformBinding binding,
Matrix4f * pMatrix = nullptr,
uint count = 1 )

◆ addUniformSampler2D() [1/2]

void Program::addUniformSampler2D ( UniformBinding binding,
Texture * pTexture,
TextureType textureType = QUAD_MAP )

◆ addUniformSampler2D() [2/2]

void Program::addUniformSampler2D ( UniformBinding binding,
TextureUnit textureUnit,
TextureType textureType = QUAD_MAP )

◆ addUniformValue1f()

void Program::addUniformValue1f ( UniformBinding binding,
float value )

◆ addUniformValue1i()

void Program::addUniformValue1i ( UniformBinding binding,
int value )

◆ bindAttributeBuffers()

void Program::bindAttributeBuffers ( )

◆ create()

void Program::create ( const HeapArray< Shader * > & pShader)

◆ disable()

void Program::disable ( )

Disable this program for rendering.

◆ enable()

void Program::enable ( )

Enable this program for rendering.

◆ getAttributeLocation()

AttributeLocation Program::getAttributeLocation ( const String & str)

Gets the shader attribute for this glsl program.

Parameters
indexThe index of the attribute. NOTE: Each index is defined by shaderenums.h
Returns
GLSL Handle to the shader attribute.

◆ getDepthBufferWrite()

bool Program::getDepthBufferWrite ( )
inline

◆ getDrawPrimitive()

DrawPrimitive Program::getDrawPrimitive ( ) const
inline

◆ getHandle()

ProgramHandle Program::getHandle ( )
inline

◆ getProgramHandle()

ProgramHandle Program::getProgramHandle ( )
inline

Gets the gpu-program handle for this object.

Returns
The gpu-program for the object.

◆ getShader()

Shader * Program::getShader ( ShaderType shaderType)

◆ getShaders()

HeapArray< Shader * > Program::getShaders ( )

◆ getUniformBinding()

UniformBinding Program::getUniformBinding ( const String & str)

◆ hasEnableState()

bool Program::hasEnableState ( PipelineState state)

◆ hasGlobalAttribute() [1/2]

bool Program::hasGlobalAttribute ( const String & location)

◆ hasGlobalAttribute() [2/2]

bool Program::hasGlobalAttribute ( const String & typeString,
const String & location )

◆ hasGlobalUniform()

bool Program::hasGlobalUniform ( const String & location,
ShaderType type )

◆ hasGlobalVarying()

bool Program::hasGlobalVarying ( const String & location)

◆ hasShader()

bool Program::hasShader ( ShaderType shaderType)

◆ hasUniformBuffer()

bool Program::hasUniformBuffer ( UniformBinding binding)

◆ init()

virtual void Program::init ( )
virtual

This can only be called 1X.

Reimplemented in ShadowMap::ShadowMaterial, and Surface::Material.

◆ isTransparent()

bool Program::isTransparent ( )
inline
Returns
True if transparency is enable for this Material.

◆ removeEnableState()

void Program::removeEnableState ( PipelineState state)

◆ setBlend()

void Program::setBlend ( )

◆ setBlendFactors()

void Program::setBlendFactors ( BlendFactor sBlendFactor,
BlendFactor dBlendFactor )

◆ setDepthBufferWrite()

void Program::setDepthBufferWrite ( bool write = true)
inline

◆ setDepthTestFunction()

void Program::setDepthTestFunction ( CompareOperation function)
inline

◆ setDrawPrimitive()

void Program::setDrawPrimitive ( DrawPrimitive drawPrimitive)
inline

◆ setElementBufferUsage()

void Program::setElementBufferUsage ( const DrawUsageHint usage)
inline

◆ setLineWidth()

void Program::setLineWidth ( float width)
inline

◆ setStates()

void Program::setStates ( )

◆ setStencilComparisonArgs()

void Program::setStencilComparisonArgs ( CompareOperation stencilTestFunction,
int stencilComparisonValue,
Handle stencilComparisonMask )

◆ setStencilOperationArgs()

void Program::setStencilOperationArgs ( StencilOperation stencilOperationFail,
StencilOperation stencilOperationDepthFail,
StencilOperation stencilOperationDepthPass )

◆ setTransparent()

void Program::setTransparent ( bool transparent = true)

Inform the engine that this object is transparent and should be handled as such. The renderer can only provide transparency for an object within the scene if both blend and depth-test functionality is enabled. NOTE: This method if set true will remove cull-facing if enabled prior and won't restore it if you set it back to false.

◆ setTriangleVertexOrientation()

void Program::setTriangleVertexOrientation ( VertexOrientation orientation)
inline

◆ setUniformBuffer1f()

void Program::setUniformBuffer1f ( UniformBinding location,
float * pBuffer )

◆ setUniformBuffer2f()

void Program::setUniformBuffer2f ( UniformBinding binding,
float * pArray )

◆ setUniformBuffer3f()

void Program::setUniformBuffer3f ( UniformBinding binding,
float * pArray )

◆ setUniformBuffer4f()

void Program::setUniformBuffer4f ( UniformBinding binding,
float * pArray )

◆ setUniformMatrix4f()

void Program::setUniformMatrix4f ( UniformBinding binding,
Matrix4f * pMatrix )

◆ setUniformSampler2D()

void Program::setUniformSampler2D ( UniformBinding binding,
Texture * pTexture,
TextureType textureType )

◆ setUniformValue1f()

void Program::setUniformValue1f ( UniformBinding location,
float value )

◆ setUniformValue1i()

void Program::setUniformValue1i ( UniformBinding location,
int value )

◆ submit()

void Program::submit ( ElementBuffer * pElementBuffer)

◆ submitUniforms()

void Program::submitUniforms ( )

◆ update()

void Program::update ( )

◆ updateUniformMatrix3f()

void Program::updateUniformMatrix3f ( UniformBinding location,
int count,
float * pBuffer )

◆ updateUniformMatrix4f()

void Program::updateUniformMatrix4f ( UniformBinding location,
int count,
float * pBuffer )

◆ updateUniformPointer1f()

void Program::updateUniformPointer1f ( UniformBinding location,
int count,
float * pBuffer )

◆ updateUniformPointer1i()

void Program::updateUniformPointer1i ( UniformBinding location,
int count,
int * pBuffer )

◆ updateUniformPointer2f()

void Program::updateUniformPointer2f ( UniformBinding location,
int count,
float * pBuffer )

◆ updateUniformPointer3f()

void Program::updateUniformPointer3f ( UniformBinding location,
int count,
float * pBuffer )

◆ updateUniformPointer4f()

void Program::updateUniformPointer4f ( UniformBinding location,
int count,
float * pBuffer )

◆ updateUniformValue1f()

void Program::updateUniformValue1f ( UniformBinding binding,
float value )

◆ updateUniformValue1i()

void Program::updateUniformValue1i ( UniformBinding binding,
int value )

Friends And Related Symbol Documentation

◆ Application

friend class Application
friend

◆ GraphicsPipeline

friend class GraphicsPipeline
friend

◆ RenderBuffer

friend class RenderBuffer
friend

Member Data Documentation

◆ attributeEnabled

AttributeEnabled Program::attributeEnabled

◆ attributeHandle

StringLocation Program::attributeHandle

◆ attributeLocation

HeapArray< AttributeLocation > Program::attributeLocation

◆ dBlendFactor

BlendFactor Program::dBlendFactor
protected

◆ depthBufferWrite

bool Program::depthBufferWrite
protected

◆ depthTestFunction

CompareOperation Program::depthTestFunction
protected

◆ drawPrimitive

DrawPrimitive Program::drawPrimitive
protected

◆ elementBufferUsage

DrawUsageHint Program::elementBufferUsage
protected

◆ faceCull

CullFace Program::faceCull
protected

◆ fragmentColorString

const String Program::fragmentColorString
static

This is the fragement-color binding-string for the fragment-shader output. This could either be defined by the driver, or user if multiple color-attachement binding-points exist.

◆ fragmentGlobalUniformString

StringUnorderedSet Program::fragmentGlobalUniformString
protected

◆ fragmentShaderCode

String Program::fragmentShaderCode
protected

◆ fragmentShaderFunctionCode

String Program::fragmentShaderFunctionCode
protected

◆ fragmentShaderGlobalCode

String Program::fragmentShaderGlobalCode
protected

◆ fragmentShaderMainCode

String Program::fragmentShaderMainCode
protected

◆ fragmentVaryingString

StringUnorderedSet Program::fragmentVaryingString
protected

◆ fragnentShaderHeaderString

const String Program::fragnentShaderHeaderString
static

◆ globalAttributeString

StringUnorderedSet Program::globalAttributeString
protected

◆ lineWidth

float Program::lineWidth
protected

◆ pAttributeBuffer

LocationAttributeBufferMap Program::pAttributeBuffer
protected

◆ pElementBuffer

ElementBuffer* Program::pElementBuffer
protected

◆ projectionSamplerString

const String Program::projectionSamplerString
static

◆ pShader

UnorderedMap< ShaderType, Shader * > Program::pShader
protected

◆ pUniform

BindingUniformMap Program::pUniform
protected

◆ sBlendFactor

BlendFactor Program::sBlendFactor
protected

◆ shaderMainStartString

const String Program::shaderMainStartString
static

◆ shaderVersionString

const String Program::shaderVersionString
static

◆ stateEnable

StateUnorderedSet Program::stateEnable
protected

◆ stencilComparisonMask

Handle Program::stencilComparisonMask
protected

◆ stencilComparisonValue

int Program::stencilComparisonValue
protected

◆ stencilOperationDepthFail

StencilOperation Program::stencilOperationDepthFail
protected

◆ stencilOperationDepthPass

StencilOperation Program::stencilOperationDepthPass
protected

◆ stencilOperationFail

StencilOperation Program::stencilOperationFail
protected

◆ stencilTestFunction

CompareOperation Program::stencilTestFunction
protected

◆ texture2DSamplerString

const String Program::texture2DSamplerString
static

◆ textureCubeSamplerString

const String Program::textureCubeSamplerString
static

◆ transparent

bool Program::transparent
protected

◆ triangleVertexOrientation

VertexOrientation Program::triangleVertexOrientation
protected

The order of which triangel vertices should be drawn. This is also reffered to as "triangle winding" order.

◆ uniformHandle

StringLocation Program::uniformHandle

◆ vao

VertexArrayHandle Program::vao
protected

Supported if extension is available or GLESv3 is the API.

◆ varyingHandle

StringLocation Program::varyingHandle

◆ varyingLocation

HeapArray< VaryingLocation > Program::varyingLocation

◆ vertexGlobalUniformString

StringUnorderedSet Program::vertexGlobalUniformString
protected

◆ vertexPositionString

const String Program::vertexPositionString
static

This is the binding-string for the vertex-shader input. Typically this would be defined by the driver.

◆ vertexShaderCode

String Program::vertexShaderCode
protected

◆ vertexShaderFunctionCode

String Program::vertexShaderFunctionCode
protected

◆ vertexShaderGlobalCode

String Program::vertexShaderGlobalCode
protected

◆ vertexShaderMainCode

String Program::vertexShaderMainCode
protected

◆ vertexVaryingString

StringUnorderedSet Program::vertexVaryingString
protected

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