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

#include <program.h>

Inheritance diagram for Engine::Program:
DynamicType

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, HandleStringLocation
 
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 ()
 
DrawPrimitive getDrawPrimitive () const
 
void setDrawPrimitive (DrawPrimitive drawPrimitive)
 
void setElementBufferUsage (const DrawUsageHint usage)
 
bool hasShader (ShaderType shaderType)
 
ShadergetShader (ShaderType shaderType)
 
HeapArray< Shader * > getShaders ()
 
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 addPushConstant (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 ()
 
void enable ()
 
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 setDepthTestFunction (CompareOperation function)
 
void setLineWidth (float width)
 
void setPatchControlPointSize (uint size)
 
uint getPatchControlPointSize ()
 
void setBlendFactors (BlendFactor sBlendFactor, BlendFactor dBlendFactor)
 
void setBlend ()
 
void bindAttributeBuffers ()
 
void submit (ElementBuffer *pElementBuffer)
 
void submitUniforms ()
 
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 addUniformValue1i (UniformBinding binding, int value)
 
void addUniformSampler2D (UniformBinding binding, Texture *pTexture, TextureType textureType=QUAD_MAP)
 
void addUniformSampler2D (UniformBinding binding, int textureUnit, TextureType textureType=QUAD_MAP)
 
void addUniformValue1f (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)
 
void setUniformValue1i (UniformBinding location, int value)
 
void setUniformValue1f (UniformBinding location, float value)
 
void setUniformBuffer1f (UniformBinding location, float *pBuffer)
 
void setUniformMatrix3f (UniformBinding binding, Matrix3f *pMatrix)
 
void setUniformMatrix4f (UniformBinding binding, Matrix4f *pMatrix)
 
void setUniformSampler2D (UniformBinding binding, Texture *pTexture, TextureType textureType)
 
- 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
 
HeapArray< TypeIDcomponentTypeId
 

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

UnorderedMap< ShaderType, Shader * > pShader
 
LocationAttributeBufferMap pAttributeBuffer
 
BindingUniformMap pUniform
 
StringUnorderedSet globalAttributeString
 
StringUnorderedSet vertexVaryingString
 
StringUnorderedSet fragmentVaryingString
 
StringUnorderedSet vertexGlobalUniformString
 
StringUnorderedSet fragmentGlobalUniformString
 
uint stateEnable
 
DrawUsageHint elementBufferUsage
 
CullFace faceCull
 
DrawPrimitive drawPrimitive
 
CompareOperation depthTestFunction
 
CompareOperation stencilTestFunction
 
int stencilComparisonValue
 
Handle stencilComparisonMask
 
StencilOperation stencilOperationFail
 
StencilOperation stencilOperationDepthFail
 
StencilOperation stencilOperationDepthPass
 
BlendFactor sBlendFactor
 
BlendFactor dBlendFactor
 
float lineWidth
 
uint patchControlPointSize
 

Friends

class Application
 
class RenderBuffer
 
class GraphicsPipeline
 

Member Typedef Documentation

◆ AttributeEnabled

◆ AttributeLocation

◆ BindingDescriptorTypeMap

◆ BindingFloatMap

◆ BindingFloatPointerMap

◆ BindingIntMap

◆ BindingIntPointerMap

◆ BindingMatrix3fArrayMap

◆ BindingMatrix4fArrayMap

◆ BindingUniformMap

◆ BindingVector2fArrayMap

◆ BindingVector3fArrayMap

◆ BindingVector4fArrayMap

◆ LocationAttributeBufferMap

◆ StringLocation

◆ UniformBinding

◆ VaryingLocation

Member Enumeration Documentation

◆ Errors

Enumerator
NO_LOCATION 

Constructor & Destructor Documentation

◆ Program()

Engine::Program::Program ( )

◆ ~Program()

virtual Engine::Program::~Program ( )
virtual

Member Function Documentation

◆ addEnableState()

void Engine::Program::addEnableState ( PipelineState state)

◆ addGlobalAttribute()

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

◆ addGlobalSampler()

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

◆ addGlobalUniform()

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

◆ addGlobalVarying()

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

◆ addPushConstant()

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

◆ addUniformBuffer1f()

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

◆ addUniformBuffer1i()

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

◆ addUniformBuffer2f()

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

◆ addUniformBuffer3f()

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

◆ addUniformBuffer4f()

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

◆ addUniformMatrix3f()

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

◆ addUniformMatrix4f()

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

◆ addUniformSampler2D() [1/2]

void Engine::Program::addUniformSampler2D ( UniformBinding binding,
int textureUnit,
TextureType textureType = QUAD_MAP )
inline

◆ addUniformSampler2D() [2/2]

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

◆ addUniformValue1f()

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

◆ addUniformValue1i()

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

◆ bindAttributeBuffers()

void Engine::Program::bindAttributeBuffers ( )

◆ create()

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

◆ enable()

void Engine::Program::enable ( )

Enable this program for rendering.

◆ getAttributeLocation()

AttributeLocation Engine::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.

◆ getDrawPrimitive()

DrawPrimitive Engine::Program::getDrawPrimitive ( ) const
inline

◆ getHandle()

ProgramHandle Engine::Program::getHandle ( )
inline

◆ getPatchControlPointSize()

uint Engine::Program::getPatchControlPointSize ( )
inline

◆ getProgramHandle()

ProgramHandle Engine::Program::getProgramHandle ( )
inline

Gets the gpu-program handle for this object.

Returns
The gpu-program for the object.

◆ getShader()

Shader * Engine::Program::getShader ( ShaderType shaderType)

◆ getShaders()

HeapArray< Shader * > Engine::Program::getShaders ( )

◆ getUniformBinding()

UniformBinding Engine::Program::getUniformBinding ( const String & str)

◆ hasEnableState()

bool Engine::Program::hasEnableState ( PipelineState state)

◆ hasGlobalAttribute() [1/2]

bool Engine::Program::hasGlobalAttribute ( const String & location)

◆ hasGlobalAttribute() [2/2]

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

◆ hasGlobalUniform()

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

◆ hasGlobalVarying()

bool Engine::Program::hasGlobalVarying ( const String & location)

◆ hasShader()

bool Engine::Program::hasShader ( ShaderType shaderType)

◆ hasUniformBuffer()

bool Engine::Program::hasUniformBuffer ( UniformBinding binding)

◆ init()

virtual void Engine::Program::init ( )
virtual

This can only be called 1X.

◆ isTransparent()

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

◆ removeEnableState()

void Engine::Program::removeEnableState ( PipelineState state)

◆ setBlend()

void Engine::Program::setBlend ( )

◆ setBlendFactors()

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

◆ setDepthTestFunction()

void Engine::Program::setDepthTestFunction ( CompareOperation function)
inline

◆ setDrawPrimitive()

void Engine::Program::setDrawPrimitive ( DrawPrimitive drawPrimitive)
inline

◆ setElementBufferUsage()

void Engine::Program::setElementBufferUsage ( const DrawUsageHint usage)
inline

◆ setLineWidth()

void Engine::Program::setLineWidth ( float width)
inline

◆ setPatchControlPointSize()

void Engine::Program::setPatchControlPointSize ( uint size)
Parameters
Thenumber of control-points per tessellation patch. If Tessellation is enabled, size must be > 0.

◆ setStates()

void Engine::Program::setStates ( )

◆ setStencilComparisonArgs()

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

◆ setStencilOperationArgs()

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

◆ setTransparent()

void Engine::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.

◆ setUniformBuffer1f()

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

◆ setUniformBuffer2f()

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

◆ setUniformBuffer3f()

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

◆ setUniformBuffer4f()

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

◆ setUniformMatrix3f()

void Engine::Program::setUniformMatrix3f ( UniformBinding binding,
Matrix3f * pMatrix )

◆ setUniformMatrix4f()

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

◆ setUniformSampler2D()

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

◆ setUniformValue1f()

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

◆ setUniformValue1i()

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

◆ submit()

void Engine::Program::submit ( ElementBuffer * pElementBuffer)

◆ submitUniforms()

void Engine::Program::submitUniforms ( )

Friends And Related Symbol Documentation

◆ Application

friend class Application
friend

◆ GraphicsPipeline

friend class GraphicsPipeline
friend

◆ RenderBuffer

friend class RenderBuffer
friend

Member Data Documentation

◆ attributeHandle

StringLocation Engine::Program::attributeHandle

◆ attributeLocation

HeapArray< AttributeLocation > Engine::Program::attributeLocation

◆ componentTypeId

HeapArray< TypeID > Engine::Program::componentTypeId

And ordered array of all component-types for archiving and reuse.

◆ dBlendFactor

BlendFactor Engine::Program::dBlendFactor
protected

◆ depthTestFunction

CompareOperation Engine::Program::depthTestFunction
protected

◆ drawPrimitive

DrawPrimitive Engine::Program::drawPrimitive
protected

◆ elementBufferUsage

DrawUsageHint Engine::Program::elementBufferUsage
protected

◆ faceCull

CullFace Engine::Program::faceCull
protected

◆ fragmentColorString

const String Engine::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 Engine::Program::fragmentGlobalUniformString
protected

◆ fragmentVaryingString

StringUnorderedSet Engine::Program::fragmentVaryingString
protected

◆ fragnentShaderHeaderString

const String Engine::Program::fragnentShaderHeaderString
static

◆ globalAttributeString

StringUnorderedSet Engine::Program::globalAttributeString
protected

◆ lineWidth

float Engine::Program::lineWidth
protected

◆ patchControlPointSize

uint Engine::Program::patchControlPointSize
protected

The number of control-points per tessellation patch.

◆ pAttributeBuffer

LocationAttributeBufferMap Engine::Program::pAttributeBuffer
protected

◆ projectionSamplerString

const String Engine::Program::projectionSamplerString
static

◆ pShader

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

◆ pUniform

BindingUniformMap Engine::Program::pUniform
protected

◆ sBlendFactor

BlendFactor Engine::Program::sBlendFactor
protected

◆ shaderMainStartString

const String Engine::Program::shaderMainStartString
static

◆ shaderVersionString

const String Engine::Program::shaderVersionString
static

◆ stateEnable

uint Engine::Program::stateEnable
protected

◆ stencilComparisonMask

Handle Engine::Program::stencilComparisonMask
protected

◆ stencilComparisonValue

int Engine::Program::stencilComparisonValue
protected

◆ stencilOperationDepthFail

StencilOperation Engine::Program::stencilOperationDepthFail
protected

◆ stencilOperationDepthPass

StencilOperation Engine::Program::stencilOperationDepthPass
protected

◆ stencilOperationFail

StencilOperation Engine::Program::stencilOperationFail
protected

◆ stencilTestFunction

CompareOperation Engine::Program::stencilTestFunction
protected

◆ texture2DSamplerString

const String Engine::Program::texture2DSamplerString
static

◆ textureCubeSamplerString

const String Engine::Program::textureCubeSamplerString
static

◆ uniformHandle

StringLocation Engine::Program::uniformHandle

◆ varyingHandle

StringLocation Engine::Program::varyingHandle

◆ varyingLocation

HeapArray< VaryingLocation > Engine::Program::varyingLocation

◆ vertexGlobalUniformString

StringUnorderedSet Engine::Program::vertexGlobalUniformString
protected

◆ vertexPositionString

const String Engine::Program::vertexPositionString
static

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

◆ vertexVaryingString

StringUnorderedSet Engine::Program::vertexVaryingString
protected

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