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

#include <program.h>

Inheritance diagram for Engine::Program:
DynamicType

Classes

struct  Attribute
 
struct  Uniform
 
struct  Varying
 

Public Types

enum  Direction : bool {
  IN = false ,
  OUT = true
}
 
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 addVertexAttribute (const String &typeString, const String &str)
 
void addUniformBuffer (const String &typeString, const String &binding, ShaderType type, uint size=1)
 
void addUniformSampler (const String &typeString, const String &binding, ShaderType type, uint size=1)
 
void addPushConstant (const String &typeString, const String &binding, ShaderType type)
 
void addVarying (ShaderType type, const Varying &varying, VaryingLocation location)
 
void addVarying (const String &typeString, const String &str, ShaderType type, bool out, uint size=1)
 
bool hasVertexAttribute (const String &str)
 
bool hasVertexAttribute (const char *str)
 
bool hasUniform (const String &str, ShaderType type)
 
bool hasVarying (const String &str, ShaderType type)
 
bool hasVarying (ShaderType type)
 
VaryingLocation getVaryingLocation (const Varying &varying)
 
const HeapArray< Varying > & getVarying (ShaderType type)
 
const AttributegetAttribute (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 hasUniform (UniformBinding binding)
 
void addUniformSampler2D (UniformBinding binding, Texture *pTexture, TextureType textureType=QUAD_MAP)
 
void addUniformSampler2D (UniformBinding binding, int textureUnit, TextureType textureType=QUAD_MAP)
 
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 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

UnorderedMap< String, Attributeattribute
 
StringLocation varyingLocation
 
StringLocation uniformBinding
 
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
 
UnorderedMap< ShaderType, HeapArray< Varying > > varying
 
UnorderedMap< ShaderType, StringUnorderedSetvaryingString
 
UnorderedMap< ShaderType, HeapArray< Uniform > > uniform
 
UnorderedMap< ShaderType, StringUnorderedSetglobalUniformString
 
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

◆ Direction

Enumerator
IN 
OUT 

◆ 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)

◆ addPushConstant()

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

◆ addUniformBuffer()

void Engine::Program::addUniformBuffer ( const String & typeString,
const String & binding,
ShaderType type,
uint size = 1 )

◆ 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 )

◆ addUniformSampler()

void Engine::Program::addUniformSampler ( const String & typeString,
const String & binding,
ShaderType type,
uint size = 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 )

◆ addVarying() [1/2]

void Engine::Program::addVarying ( const String & typeString,
const String & str,
ShaderType type,
bool out,
uint size = 1 )

◆ addVarying() [2/2]

void Engine::Program::addVarying ( ShaderType type,
const Varying & varying,
VaryingLocation location )

◆ addVertexAttribute()

void Engine::Program::addVertexAttribute ( const String & typeString,
const String & str )

◆ bindAttributeBuffers()

void Engine::Program::bindAttributeBuffers ( )

◆ create()

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

◆ enable()

void Engine::Program::enable ( )

Enable this program for rendering.

◆ getAttribute()

const Attribute & Engine::Program::getAttribute ( 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)

◆ getVarying()

const HeapArray< Varying > & Engine::Program::getVarying ( ShaderType type)

◆ getVaryingLocation()

VaryingLocation Engine::Program::getVaryingLocation ( const Varying & varying)

◆ hasEnableState()

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

◆ hasShader()

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

◆ hasUniform() [1/2]

bool Engine::Program::hasUniform ( const String & str,
ShaderType type )

◆ hasUniform() [2/2]

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

◆ hasVarying() [1/2]

bool Engine::Program::hasVarying ( const String & str,
ShaderType type )

◆ hasVarying() [2/2]

bool Engine::Program::hasVarying ( ShaderType type)

◆ hasVertexAttribute() [1/2]

bool Engine::Program::hasVertexAttribute ( const char * str)
inline

◆ hasVertexAttribute() [2/2]

bool Engine::Program::hasVertexAttribute ( const String & str)

◆ 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

◆ attribute

UnorderedMap< String, Attribute > Engine::Program::attribute

◆ 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.

◆ fragnentShaderHeaderString

const String Engine::Program::fragnentShaderHeaderString
static

◆ globalAttributeString

StringUnorderedSet Engine::Program::globalAttributeString
protected

◆ globalUniformString

UnorderedMap< ShaderType, StringUnorderedSet > Engine::Program::globalUniformString
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

◆ uniform

UnorderedMap< ShaderType, HeapArray< Uniform > > Engine::Program::uniform
protected

An array of varying-data for each shader-type.

◆ uniformBinding

StringLocation Engine::Program::uniformBinding

◆ varying

UnorderedMap< ShaderType, HeapArray< Varying > > Engine::Program::varying
protected

An array of varying-data for each shader-type.

◆ varyingLocation

StringLocation Engine::Program::varyingLocation

◆ varyingString

UnorderedMap< ShaderType, StringUnorderedSet > Engine::Program::varyingString
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.


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