Support Forum       G3D Web Page     
Public Types | Public Member Functions | Public Attributes | Protected Types | Static Protected Member Functions | Protected Attributes | List of all members
G3D::Args Class Reference

Arguments to use when running a Shader. More...

Inherits G3D::UniformTable.

Public Types

typedef Table< String, ArgArgTable
 

Public Member Functions

 Args ()
 Defaults: triangle primitive, 1 instance, 3 vertices per patch, computeGridDim(0,0,0), and uses G3D Args. More...
 
void append (const UniformTable &other, const String &prefix="")
 
Sets all arguments from other on this. More...
 
void append (const shared_ptr< UniformTable > &other, const String &prefix="")
 
void appendIndexStream (const IndexStream &indexStream)
 Specify an index stream to append in a multidraw call. More...
 
void appendToPreamble (const String &extra)
 
void clearAttributeAndIndexBindings ()
 
void clearAttributeArgs ()
 
void clearUniform (const String &s)
 
void clearUniformBindings ()
 
const Vector3int32computeGroupSize () const
 
void enableG3DArgs (bool enable)
 If true, G3D will set and bind its default arguments, including many matrix uniforms and macro variables. More...
 
const Vector3int32getComputeGridDim () const
 
const IndexStreamgetIndexStream () const
 
More...
 
const IndexStreamgetIndices () const
 
More...
 
bool getMacro (const String &name, String &value) const
 Get the value of the macro arg name, and return its value in value, returns true if the macro arg exists. More...
 
PrimitiveType getPrimitiveType () const
 
const Rect2DgetRect () const
 
float getRectZCoord () const
 
const Rect2DgetTexCoordRect () const
 
const GPUAttributeTablegpuAttributeTable () const
 
bool hasComputeGrid () const
 True if there is a nonzero compute grid set. More...
 
bool hasGPUIndexStream () const
 If this is true, it is invalid to set any CPU index streams, an indirect buffer, or a compute grid. More...
 
bool hasIndirectBuffer () const
 If this is true, it is invalid to set any index streams or a compute grid. More...
 
bool hasPreambleOrMacros () const
 
bool hasRect () const
 
bool hasStreamArgs () const
 If this is true, it is invalid to set a compute grid or and cpu attribute arrays/indexstreams. More...
 
bool hasUniform (const String &s) const
 
const Array< int > & indexCountArray () const
 
const Array< int > & indexOffsetArray () const
 
const IndexStreamindexStream () const
 
const Array< IndexStream > & indexStreamArray () const
 
const shared_ptr< GLPixelTransferBuffer > & indirectBuffer () const
 
size_t indirectOffset () const
 
String macro (const String &name) const
 Returns the empty string if the macro is not bound. More...
 
int numIndices () const
 If the index array has size > 0, returns its size, otherwise, returns the length of the shortest attached vertex attribute stream (0 if there are none) or the value set by an explicit call to setNumIndices. More...
 
int numInstances () const
 
String preamble () const
 
String preambleAndMacroString () const
 The preamble with macro arg definitions appended. More...
 
const Rect2Drect () const
 
void setArrayUniform (const String &name, int index, const shared_ptr< BindlessTextureHandle > &val, bool optional=false)
 
void setArrayUniform (const String &name, int index, int val, bool optional=false)
 
void setArrayUniform (const String &name, int index, float val, bool optional=false)
 
void setArrayUniform (const String &name, int index, const Vector2 &val, bool optional=false)
 
void setArrayUniform (const String &name, int index, const Vector3 &val, bool optional=false)
 
void setArrayUniform (const String &name, int index, const Vector4 &val, bool optional=false)
 
void setArrayUniform (const String &name, int index, const Color1 &val, bool optional=false)
 
void setArrayUniform (const String &name, int index, const Color3 &val, bool optional=false)
 
void setArrayUniform (const String &name, int index, const Color4 &val, bool optional=false)
 
void setArrayUniform (const String &name, int index, const Matrix2 &val, bool optional=false)
 
void setArrayUniform (const String &name, int index, const Matrix3 &val, bool optional=false)
 
void setArrayUniform (const String &name, int index, const Matrix4 &val, bool optional=false)
 
void setArrayUniform (const String &name, int index, const Matrix2x3 &val, bool optional=false)
 Becomes a GLSL mat3x2. More...
 
void setArrayUniform (const String &name, int index, const CoordinateFrame &val, bool optional=false)
 Becomes a GLSL mat4x3. More...
 
void setAttributeArray (const String &name, const AttributeArray &val, int instanceDivisor=0)
 
void setComputeGridDim (const Vector3int32 &computeGridDim)
 
void setComputeGroupSize (const Vector3int32 &computeGroupSize)
 
void setImageUniform (const String &name, const shared_ptr< Texture > &val, Access access=Access::READ_WRITE, int mipLevel=0, bool optional=false)
 Uses the texture as the corresponding image type in the shader. More...
 
void setImageUniform (const String &name, const shared_ptr< BufferTexture > &val, Access access=Access::READ_WRITE, bool optional=false)
 Uses the texture as the corresponding *imageBuffer type in the shader. More...
 
void setIndexStream (const IndexStream &indStream)
 Determines the order vertex attribute streams are sent to the GPU. More...
 
void setIndirectBuffer (const shared_ptr< GLPixelTransferBuffer > &b, size_t offset=0)
 If set, perform a glDrawArraysIndirect or glDispatchComputeIndirect where the parameters for the thread launch come from another device buffer instead of the host, thus avoiding a CPU-GPU synchronization. More...
 
void setMacro (const String &name, const String &value)
 
void setMacro (const String &name, const char *value)
 
void setMacro (const String &name, bool val)
 false becomes 0 and true becomes 1 More...
 
void setMacro (const String &name, int val)
 
void setMacro (const String &name, uint32 val)
 
void setMacro (const String &name, double val)
 
void setMacro (const String &name, float val)
 
void setMacro (const String &name, const Vector2 &val)
 
void setMacro (const String &name, const Vector3 &val)
 
void setMacro (const String &name, const Vector4 &val)
 
void setMacro (const String &name, const Color1 &val)
 Becomes float in GLSL. More...
 
void setMacro (const String &name, const Color3 &val)
 
void setMacro (const String &name, const Color4 &val)
 
void setMacro (const String &name, const Vector2int32 &val)
 
void setMacro (const String &name, const Vector2uint32 &val)
 
void setMacro (const String &name, const Vector3int32 &val)
 
void setMacro (const String &name, const Vector2int16 &val)
 
void setMacro (const String &name, const Vector3int16 &val)
 
void setMacro (const String &name, const Vector4int16 &val)
 
void setMacro (const String &name, const Vector4uint16 &val)
 
void setMacro (const String &name, const Matrix2 &val)
 
void setMacro (const String &name, const Matrix3 &val)
 
void setMacro (const String &name, const Matrix4 &val)
 
void setMacro (const String &name, const CoordinateFrame &val)
 Becomes mat3x4 in GLSL. More...
 
void setMacro (const String &name, const Matrix &val)
 
void setMultiDrawArrays (const Array< int > &offsets, const Array< int > &counts)
 
void setNumIndices (int n)
 When rendering without a vertex array or index array, this forces the number of indices. More...
 
void setNumInstances (int num)
 If you change the number of instances in order to produce multiple copies of a model at different locations using a VisibleEntity subclass, then ensure that you take the following steps to produce consistent results: More...
 
void setPreamble (const String &preamble)
 Arbitrary string to append to beginning of the shader. More...
 
void setPrimitiveType (PrimitiveType type)
 
void setRect (const Rect2D &rect, float zCoord=-1, const Rect2D &texCoordRect=Rect2D(Vector2(1, 1)))
 
void setUniform (const String &name, bool val, bool optional)
 
void setUniform (const String &name, bool val)
 
void setUniform (const String &name, int val, bool optional=false)
 
void setUniform (const String &name, float val, bool optional=false)
 
void setUniform (const String &name, uint32 val, bool optional=false)
 
void setUniform (const String &name, double val, bool optional=false)
 
void setUniform (const String &name, uint64 val, bool optional=false)
 
void setUniform (const String &name, const Vector2 &val, bool optional=false)
 
void setUniform (const String &name, const Vector3 &val, bool optional=false)
 
void setUniform (const String &name, const Vector4 &val, bool optional=false)
 
void setUniform (const String &name, const Color1 &val, bool optional=false)
 Becomes float in GLSL. More...
 
void setUniform (const String &name, const Color3 &val, bool optional=false)
 
void setUniform (const String &name, const Color4 &val, bool optional=false)
 
void setUniform (const String &name, const Vector2int32 &val, bool optional=false)
 
void setUniform (const String &name, const Vector2uint32 &val, bool optional=false)
 
void setUniform (const String &name, const Vector3int32 &val, bool optional=false)
 
void setUniform (const String &name, const Vector2int16 &val, bool optional=false)
 
void setUniform (const String &name, const Vector3int16 &val, bool optional=false)
 
void setUniform (const String &name, const Vector4int16 &val, bool optional=false)
 
void setUniform (const String &name, const Vector4uint16 &val, bool optional=false)
 
void setUniform (const String &name, const Matrix2 &val, bool optional=false)
 
void setUniform (const String &name, const Matrix3 &val, bool optional=false)
 
void setUniform (const String &name, const Matrix4 &val, bool optional=false)
 
void setUniform (const String &name, const Matrix2x3 &val, bool optional=false)
 Becomes a GLSL mat3x2. More...
 
void setUniform (const String &name, const Matrix &val, bool optional=false)
 
void setUniform (const String &name, const CoordinateFrame &val, bool optional=false)
 Becomes a GLSL mat4x3. More...
 
void setUniform (const String &name, const shared_ptr< Texture > &val, const Sampler &settings, bool optional=false)
 
void setUniform (const String &name, const shared_ptr< BufferTexture > &val, bool optional)
 
void setUniform (const String &name, const shared_ptr< BufferTexture > &val)
 
void setUniform (const String &name, const shared_ptr< BindlessTextureHandle > &val, bool optional=false)
 
const Rect2DtexCoordRect () const
 
String toString () const
 
const Arguniform (const String &name) const
 Returns the uniform value bound to this name or throws UnboundArgument. More...
 
const UniformTable::ArgTableuniformTable () const
 
bool useG3DArgs () const
 

Public Attributes

Vector3int32 computeGridDim
 
GLint patchVertices
 Number of vertices per patch sent to the geometry or tesselation control shader from the vertex shader. More...
 

Protected Types

typedef Table< String, GPUAttributeGPUAttributeTable
 

Static Protected Member Functions

template<class T , class ... ArgTypes>
static shared_ptr< T > createShared (ArgTypes &&... args)
 Like std::make_shared, but works for protected constructors. More...
 

Protected Attributes

SmallArray< MacroArgPair, 12 > m_macroArgs
 We use a SmallArray to avoid heap allocation for every arg instance. More...
 
String m_preamble
 
GPUAttributeTable m_streamArgs
 Must be empty if m_immediateModeArgs is non-empty. More...
 
ArgTable m_uniformArgs
 

Detailed Description

Arguments to use when running a Shader.

Many classes (including Texture, Material, UniversalSurface, and Light) provide a setArgs method that assigns a set of arguments to an Args class.

Many classes (including Framebuffer, ArticulatedModel::Pose, and LightingEnvironment) provide a UniformTable field that allows them to impose additional values on the Args used for shaders that incorporate them. See the documentation on VisibleEntity::create for information about a common case of specifying shader arguments in a file.

There are three major types of arguments stored:

Uniform Args

These correspond exactly to glsl uniform variables. They are constant throughout one shader application. These are set using the overloaded setUniform() functions. The first parameter of this function is the uniform name, the second is the value.

We currently support a subset of the types in glsl, including all floating-point vector and matrix types (vecX, matNxM), most scalar types (float, int, double, uint, bool), and sampler types (which have the CPU type G3D::Texture).

Preamble and Macro Args

The preamble is an arbitrary string that is prepended to the code of all stages of the shader before compilation (before the #version string, which must be the first line of any GLSL program, is prepended). This allows for the addition of arbitrary glsl code to your shader at compile-time.

Macro Args are set using the overloaded setMacro() functions. The first parameter of this function is the uniform name, the second is the value. The values all get formatted into strings internally, and we support string types as a value of macro arguments. This in theory allows you to write arbitrary glsl code inside the value of a macro arg, but it is more sensical to put such things in the preamble if they are necessary.

Macro Args are appended to the preamble before the preamble is prepended to the shader code.

Examples:

setMacro("USE_LAMBERTIAN", 0);

becomes

"#define USE_LAMBERTIAN 0\n"

(note that we also coerce booleans into 1 or 0)

setMacro("MACRO_VECTOR", Vector4::clear()); becomes "#define MACRO_VECTOR vec4(0.0, 0.0, 0.0, 0.0)\n"

Since GLSL has a preprocessor that recognizes #defines, macro args can be used as compile-time constants.

G3D also supports a special way to include macros with newlines and preprocessor commands in them. In your shader, #includestring macroarg inserts the value of the macroarg (it does not include a file named by the macroarg). It is an error to insert such macros by name only.

NOTE: Shader, when being applied with an Args object, first checks the result preambleAndMacroString(), and uses that as a key into a cache of compiled shader program objects. If such an object is found, the compilation step is skipped, and Shader uses the program object from the cache, otherwise it is compiled and added to the cache.

The number of possible shaders to compile is exponential in the number of macro arguments, use them sparingly!

Stream Args

Steam Args correspond to GLSL vertex attributes.

We support standard OpenGL attributes using pointers into VBOs (which correspond to G3D::AttributeArray), through the setAttributeArray() function The first parameter is the name of the (generic) vertex attribute.

The second parameter is the AttributeArray to use as the data for the attribute.

Indexed rendering is used if the index stream is set with setIndexStream() before Shader application, otherwise, sequential indices are used up to the number of elements in the smallest set AttributeArray.

Note that if no vertex shader is used we provide default.vrt, which uses g3d_Vertex and g3d_TexCoord0, transforming the position by the g3d_ObjectToScreenMatrix. This is useful mostly in the context of our alternate rendering mode using setRect, to set up a screen-space shader pass (basically a compute shader masquerading as a compute shader).

See also
Shader

Member Typedef Documentation

◆ ArgTable

◆ GPUAttributeTable

Constructor & Destructor Documentation

◆ Args()

G3D::Args::Args ( )

Defaults: triangle primitive, 1 instance, 3 vertices per patch, computeGridDim(0,0,0), and uses G3D Args.

Member Function Documentation

◆ append() [1/2]

void G3D::UniformTable::append ( const UniformTable other,
const String prefix = "" 
)
inherited


Sets all arguments from other on this.

Parameters
prefixIf specified, prefix each uniform and macro name with this prefix.

Referenced by G3D::UniformTable::append(), and G3D::UniformTable::UniformTable().

◆ append() [2/2]

void G3D::UniformTable::append ( const shared_ptr< UniformTable > &  other,
const String prefix = "" 
)
inlineinherited

◆ appendIndexStream()

void G3D::Args::appendIndexStream ( const IndexStream indexStream)

Specify an index stream to append in a multidraw call.

◆ appendToPreamble()

void G3D::UniformTable::appendToPreamble ( const String extra)
inlineinherited

◆ clearAttributeAndIndexBindings()

void G3D::Args::clearAttributeAndIndexBindings ( )

Referenced by clearAttributeArgs().

◆ clearAttributeArgs()

void G3D::Args::clearAttributeArgs ( )
inline

◆ clearUniform()

void G3D::UniformTable::clearUniform ( const String s)
inlineinherited

◆ clearUniformBindings()

void G3D::UniformTable::clearUniformBindings ( )
inlineinherited

◆ computeGroupSize()

const Vector3int32& G3D::Args::computeGroupSize ( ) const
inline

Referenced by setComputeGroupSize().

◆ createShared()

template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared ( ArgTypes &&...  args)
inlinestaticprotectedinherited

Like std::make_shared, but works for protected constructors.

Call as createShared<myclass>.

◆ enableG3DArgs()

void G3D::Args::enableG3DArgs ( bool  enable)

If true, G3D will set and bind its default arguments, including many matrix uniforms and macro variables.

Default is true.

◆ getComputeGridDim()

const Vector3int32& G3D::Args::getComputeGridDim ( ) const
inline

◆ getIndexStream()

const IndexStream& G3D::Args::getIndexStream ( ) const
inline

◆ getIndices()

const IndexStream& G3D::Args::getIndices ( ) const
inline

◆ getMacro()

bool G3D::UniformTable::getMacro ( const String name,
String value 
) const
inherited

Get the value of the macro arg name, and return its value in value, returns true if the macro arg exists.

Referenced by G3D::UniformTable::macro().

◆ getPrimitiveType()

PrimitiveType G3D::Args::getPrimitiveType ( ) const
inline

◆ getRect()

const Rect2D& G3D::Args::getRect ( ) const
inline

◆ getRectZCoord()

float G3D::Args::getRectZCoord ( ) const
inline

◆ getTexCoordRect()

const Rect2D& G3D::Args::getTexCoordRect ( ) const
inline

◆ gpuAttributeTable()

const GPUAttributeTable& G3D::UniformTable::gpuAttributeTable ( ) const
inlineinherited

◆ hasComputeGrid()

bool G3D::Args::hasComputeGrid ( ) const
inline

True if there is a nonzero compute grid set.

If this is true, it is invalid to set any index streams or attribute arrays, or an indirect buffer

◆ hasGPUIndexStream()

bool G3D::Args::hasGPUIndexStream ( ) const
inline

If this is true, it is invalid to set any CPU index streams, an indirect buffer, or a compute grid.

◆ hasIndirectBuffer()

bool G3D::Args::hasIndirectBuffer ( ) const
inline

If this is true, it is invalid to set any index streams or a compute grid.

◆ hasPreambleOrMacros()

bool G3D::UniformTable::hasPreambleOrMacros ( ) const
inlineinherited

◆ hasRect()

bool G3D::Args::hasRect ( ) const
inline

◆ hasStreamArgs()

bool G3D::Args::hasStreamArgs ( ) const
inline

If this is true, it is invalid to set a compute grid or and cpu attribute arrays/indexstreams.

◆ hasUniform()

bool G3D::UniformTable::hasUniform ( const String s) const
inlineinherited

◆ indexCountArray()

const Array<int>& G3D::Args::indexCountArray ( ) const
inline

◆ indexOffsetArray()

const Array<int>& G3D::Args::indexOffsetArray ( ) const
inline

◆ indexStream()

const IndexStream& G3D::Args::indexStream ( ) const
inline

◆ indexStreamArray()

const Array<IndexStream>& G3D::Args::indexStreamArray ( ) const
inline

◆ indirectBuffer()

const shared_ptr<GLPixelTransferBuffer>& G3D::Args::indirectBuffer ( ) const
inline

◆ indirectOffset()

size_t G3D::Args::indirectOffset ( ) const
inline

◆ macro()

String G3D::UniformTable::macro ( const String name) const
inlineinherited

Returns the empty string if the macro is not bound.

See also
getMacro

◆ numIndices()

int G3D::Args::numIndices ( ) const

If the index array has size > 0, returns its size, otherwise, returns the length of the shortest attached vertex attribute stream (0 if there are none) or the value set by an explicit call to setNumIndices.

◆ numInstances()

int G3D::Args::numInstances ( ) const
inline

◆ preamble()

String G3D::UniformTable::preamble ( ) const
inlineinherited

◆ preambleAndMacroString()

String G3D::UniformTable::preambleAndMacroString ( ) const
inherited

The preamble with macro arg definitions appended.

◆ rect()

const Rect2D& G3D::Args::rect ( ) const
inline

◆ setArrayUniform() [1/14]

void G3D::UniformTable::setArrayUniform ( const String name,
int  index,
const shared_ptr< BindlessTextureHandle > &  val,
bool  optional = false 
)
inherited

◆ setArrayUniform() [2/14]

void G3D::UniformTable::setArrayUniform ( const String name,
int  index,
int  val,
bool  optional = false 
)
inherited

◆ setArrayUniform() [3/14]

void G3D::UniformTable::setArrayUniform ( const String name,
int  index,
float  val,
bool  optional = false 
)
inherited

◆ setArrayUniform() [4/14]

void G3D::UniformTable::setArrayUniform ( const String name,
int  index,
const Vector2 val,
bool  optional = false 
)
inherited

◆ setArrayUniform() [5/14]

void G3D::UniformTable::setArrayUniform ( const String name,
int  index,
const Vector3 val,
bool  optional = false 
)
inherited

◆ setArrayUniform() [6/14]

void G3D::UniformTable::setArrayUniform ( const String name,
int  index,
const Vector4 val,
bool  optional = false 
)
inherited

◆ setArrayUniform() [7/14]

void G3D::UniformTable::setArrayUniform ( const String name,
int  index,
const Color1 val,
bool  optional = false 
)
inherited

◆ setArrayUniform() [8/14]

void G3D::UniformTable::setArrayUniform ( const String name,
int  index,
const Color3 val,
bool  optional = false 
)
inherited

◆ setArrayUniform() [9/14]

void G3D::UniformTable::setArrayUniform ( const String name,
int  index,
const Color4 val,
bool  optional = false 
)
inherited

◆ setArrayUniform() [10/14]

void G3D::UniformTable::setArrayUniform ( const String name,
int  index,
const Matrix2 val,
bool  optional = false 
)
inherited

◆ setArrayUniform() [11/14]

void G3D::UniformTable::setArrayUniform ( const String name,
int  index,
const Matrix3 val,
bool  optional = false 
)
inherited

◆ setArrayUniform() [12/14]

void G3D::UniformTable::setArrayUniform ( const String name,
int  index,
const Matrix4 val,
bool  optional = false 
)
inherited

◆ setArrayUniform() [13/14]

void G3D::UniformTable::setArrayUniform ( const String name,
int  index,
const Matrix2x3 val,
bool  optional = false 
)
inherited

Becomes a GLSL mat3x2.

◆ setArrayUniform() [14/14]

void G3D::UniformTable::setArrayUniform ( const String name,
int  index,
const CoordinateFrame val,
bool  optional = false 
)
inherited

Becomes a GLSL mat4x3.

◆ setAttributeArray()

void G3D::UniformTable::setAttributeArray ( const String name,
const AttributeArray val,
int  instanceDivisor = 0 
)
inherited
Parameters
instanceDivisorSet to 0 for regular indexed rendering and 1 to increment once per instance. https://www.opengl.org/sdk/docs/man3/xhtml/glVertexAttribDivisor.xml

◆ setComputeGridDim()

void G3D::Args::setComputeGridDim ( const Vector3int32 computeGridDim)
inline

◆ setComputeGroupSize()

void G3D::Args::setComputeGroupSize ( const Vector3int32 computeGroupSize)
inline

◆ setImageUniform() [1/2]

void G3D::UniformTable::setImageUniform ( const String name,
const shared_ptr< Texture > &  val,
Access  access = Access::READ_WRITE,
int  mipLevel = 0,
bool  optional = false 
)
inherited

Uses the texture as the corresponding image type in the shader.

◆ setImageUniform() [2/2]

void G3D::UniformTable::setImageUniform ( const String name,
const shared_ptr< BufferTexture > &  val,
Access  access = Access::READ_WRITE,
bool  optional = false 
)
inherited

Uses the texture as the corresponding *imageBuffer type in the shader.

◆ setIndexStream()

void G3D::Args::setIndexStream ( const IndexStream indStream)

Determines the order vertex attribute streams are sent to the GPU.

◆ setIndirectBuffer()

void G3D::Args::setIndirectBuffer ( const shared_ptr< GLPixelTransferBuffer > &  b,
size_t  offset = 0 
)
inline

If set, perform a glDrawArraysIndirect or glDispatchComputeIndirect where the parameters for the thread launch come from another device buffer instead of the host, thus avoiding a CPU-GPU synchronization.

Parameters
offsetnumber of bytes to offset from 0 when reading the arguments.

R32UI format. For glDrawIndirect, count, primcount, first, reserveMustBeZero. For glDispatchComputeIndirect, gridx, gridy, gridz.

◆ setMacro() [1/25]

void G3D::UniformTable::setMacro ( const String name,
const String value 
)
inherited

◆ setMacro() [2/25]

void G3D::UniformTable::setMacro ( const String name,
const char *  value 
)
inlineinherited

◆ setMacro() [3/25]

void G3D::UniformTable::setMacro ( const String name,
bool  val 
)
inherited

false becomes 0 and true becomes 1

◆ setMacro() [4/25]

void G3D::UniformTable::setMacro ( const String name,
int  val 
)
inherited

◆ setMacro() [5/25]

void G3D::UniformTable::setMacro ( const String name,
uint32  val 
)
inherited

◆ setMacro() [6/25]

void G3D::UniformTable::setMacro ( const String name,
double  val 
)
inherited

◆ setMacro() [7/25]

void G3D::UniformTable::setMacro ( const String name,
float  val 
)
inherited

◆ setMacro() [8/25]

void G3D::UniformTable::setMacro ( const String name,
const Vector2 val 
)
inherited

◆ setMacro() [9/25]

void G3D::UniformTable::setMacro ( const String name,
const Vector3 val 
)
inherited

◆ setMacro() [10/25]

void G3D::UniformTable::setMacro ( const String name,
const Vector4 val 
)
inherited

◆ setMacro() [11/25]

void G3D::UniformTable::setMacro ( const String name,
const Color1 val 
)
inherited

Becomes float in GLSL.

◆ setMacro() [12/25]

void G3D::UniformTable::setMacro ( const String name,
const Color3 val 
)
inherited

◆ setMacro() [13/25]

void G3D::UniformTable::setMacro ( const String name,
const Color4 val 
)
inherited

◆ setMacro() [14/25]

void G3D::UniformTable::setMacro ( const String name,
const Vector2int32 val 
)
inherited

◆ setMacro() [15/25]

void G3D::UniformTable::setMacro ( const String name,
const Vector2uint32 val 
)
inherited

◆ setMacro() [16/25]

void G3D::UniformTable::setMacro ( const String name,
const Vector3int32 val 
)
inherited

◆ setMacro() [17/25]

void G3D::UniformTable::setMacro ( const String name,
const Vector2int16 val 
)
inherited

◆ setMacro() [18/25]

void G3D::UniformTable::setMacro ( const String name,
const Vector3int16 val 
)
inherited

◆ setMacro() [19/25]

void G3D::UniformTable::setMacro ( const String name,
const Vector4int16 val 
)
inherited

◆ setMacro() [20/25]

void G3D::UniformTable::setMacro ( const String name,
const Vector4uint16 val 
)
inherited

◆ setMacro() [21/25]

void G3D::UniformTable::setMacro ( const String name,
const Matrix2 val 
)
inherited

◆ setMacro() [22/25]

void G3D::UniformTable::setMacro ( const String name,
const Matrix3 val 
)
inherited

◆ setMacro() [23/25]

void G3D::UniformTable::setMacro ( const String name,
const Matrix4 val 
)
inherited

◆ setMacro() [24/25]

void G3D::UniformTable::setMacro ( const String name,
const CoordinateFrame val 
)
inherited

Becomes mat3x4 in GLSL.

◆ setMacro() [25/25]

void G3D::UniformTable::setMacro ( const String name,
const Matrix val 
)
inherited

◆ setMultiDrawArrays()

void G3D::Args::setMultiDrawArrays ( const Array< int > &  offsets,
const Array< int > &  counts 
)
inline

◆ setNumIndices()

void G3D::Args::setNumIndices ( int  n)
inline

When rendering without a vertex array or index array, this forces the number of indices.

◆ setNumInstances()

void G3D::Args::setNumInstances ( int  num)
inline

If you change the number of instances in order to produce multiple copies of a model at different locations using a VisibleEntity subclass, then ensure that you take the following steps to produce consistent results:

See also
G3D::ArticulatedModel::Pose::Pose, G3D::ArticulatedModel::Pose::numInstances, G3D::UniversalSurface::create

◆ setPreamble()

void G3D::UniformTable::setPreamble ( const String preamble)
inherited

Arbitrary string to append to beginning of the shader.

◆ setPrimitiveType()

void G3D::Args::setPrimitiveType ( PrimitiveType  type)

◆ setRect()

void G3D::Args::setRect ( const Rect2D rect,
float  zCoord = -1,
const Rect2D texCoordRect = Rect2D(Vector2(1, 1)) 
)

◆ setUniform() [1/30]

void G3D::UniformTable::setUniform ( const String name,
bool  val,
bool  optional 
)
inherited

◆ setUniform() [2/30]

void G3D::UniformTable::setUniform ( const String name,
bool  val 
)
inlineinherited

◆ setUniform() [3/30]

void G3D::UniformTable::setUniform ( const String name,
int  val,
bool  optional = false 
)
inherited

◆ setUniform() [4/30]

void G3D::UniformTable::setUniform ( const String name,
float  val,
bool  optional = false 
)
inherited

◆ setUniform() [5/30]

void G3D::UniformTable::setUniform ( const String name,
uint32  val,
bool  optional = false 
)
inherited

◆ setUniform() [6/30]

void G3D::UniformTable::setUniform ( const String name,
double  val,
bool  optional = false 
)
inherited

◆ setUniform() [7/30]

void G3D::UniformTable::setUniform ( const String name,
uint64  val,
bool  optional = false 
)
inherited

◆ setUniform() [8/30]

void G3D::UniformTable::setUniform ( const String name,
const Vector2 val,
bool  optional = false 
)
inherited

◆ setUniform() [9/30]

void G3D::UniformTable::setUniform ( const String name,
const Vector3 val,
bool  optional = false 
)
inherited

◆ setUniform() [10/30]

void G3D::UniformTable::setUniform ( const String name,
const Vector4 val,
bool  optional = false 
)
inherited

◆ setUniform() [11/30]

void G3D::UniformTable::setUniform ( const String name,
const Color1 val,
bool  optional = false 
)
inherited

Becomes float in GLSL.

◆ setUniform() [12/30]

void G3D::UniformTable::setUniform ( const String name,
const Color3 val,
bool  optional = false 
)
inherited

◆ setUniform() [13/30]

void G3D::UniformTable::setUniform ( const String name,
const Color4 val,
bool  optional = false 
)
inherited

◆ setUniform() [14/30]

void G3D::UniformTable::setUniform ( const String name,
const Vector2int32 val,
bool  optional = false 
)
inherited

◆ setUniform() [15/30]

void G3D::UniformTable::setUniform ( const String name,
const Vector2uint32 val,
bool  optional = false 
)
inherited

◆ setUniform() [16/30]

void G3D::UniformTable::setUniform ( const String name,
const Vector3int32 val,
bool  optional = false 
)
inherited

◆ setUniform() [17/30]

void G3D::UniformTable::setUniform ( const String name,
const Vector2int16 val,
bool  optional = false 
)
inherited

◆ setUniform() [18/30]

void G3D::UniformTable::setUniform ( const String name,
const Vector3int16 val,
bool  optional = false 
)
inherited

◆ setUniform() [19/30]

void G3D::UniformTable::setUniform ( const String name,
const Vector4int16 val,
bool  optional = false 
)
inherited

◆ setUniform() [20/30]

void G3D::UniformTable::setUniform ( const String name,
const Vector4uint16 val,
bool  optional = false 
)
inherited

◆ setUniform() [21/30]

void G3D::UniformTable::setUniform ( const String name,
const Matrix2 val,
bool  optional = false 
)
inherited

◆ setUniform() [22/30]

void G3D::UniformTable::setUniform ( const String name,
const Matrix3 val,
bool  optional = false 
)
inherited

◆ setUniform() [23/30]

void G3D::UniformTable::setUniform ( const String name,
const Matrix4 val,
bool  optional = false 
)
inherited

◆ setUniform() [24/30]

void G3D::UniformTable::setUniform ( const String name,
const Matrix2x3 val,
bool  optional = false 
)
inherited

Becomes a GLSL mat3x2.

◆ setUniform() [25/30]

void G3D::UniformTable::setUniform ( const String name,
const Matrix val,
bool  optional = false 
)
inherited

◆ setUniform() [26/30]

void G3D::UniformTable::setUniform ( const String name,
const CoordinateFrame val,
bool  optional = false 
)
inherited

Becomes a GLSL mat4x3.

◆ setUniform() [27/30]

void G3D::UniformTable::setUniform ( const String name,
const shared_ptr< Texture > &  val,
const Sampler settings,
bool  optional = false 
)
inherited

◆ setUniform() [28/30]

void G3D::UniformTable::setUniform ( const String name,
const shared_ptr< BufferTexture > &  val,
bool  optional 
)
inherited

◆ setUniform() [29/30]

void G3D::UniformTable::setUniform ( const String name,
const shared_ptr< BufferTexture > &  val 
)
inlineinherited

◆ setUniform() [30/30]

void G3D::UniformTable::setUniform ( const String name,
const shared_ptr< BindlessTextureHandle > &  val,
bool  optional = false 
)
inherited

◆ texCoordRect()

const Rect2D& G3D::Args::texCoordRect ( ) const
inline

◆ toString()

String G3D::Args::toString ( ) const

◆ uniform()

const Arg& G3D::UniformTable::uniform ( const String name) const
inherited

Returns the uniform value bound to this name or throws UnboundArgument.

◆ uniformTable()

const UniformTable::ArgTable& G3D::UniformTable::uniformTable ( ) const
inlineinherited

◆ useG3DArgs()

bool G3D::Args::useG3DArgs ( ) const
inline

Member Data Documentation

◆ computeGridDim

Vector3int32 G3D::Args::computeGridDim
Deprecated:
, use accessors instead.

Referenced by getComputeGridDim(), hasComputeGrid(), and setComputeGridDim().

◆ m_macroArgs

SmallArray<MacroArgPair, 12> G3D::UniformTable::m_macroArgs
protectedinherited

We use a SmallArray to avoid heap allocation for every arg instance.

Referenced by G3D::UniformTable::hasPreambleOrMacros().

◆ m_preamble

String G3D::UniformTable::m_preamble
protectedinherited

◆ m_streamArgs

GPUAttributeTable G3D::UniformTable::m_streamArgs
protectedinherited

Must be empty if m_immediateModeArgs is non-empty.

Referenced by G3D::UniformTable::gpuAttributeTable(), and hasStreamArgs().

◆ m_uniformArgs

ArgTable G3D::UniformTable::m_uniformArgs
protectedinherited

◆ patchVertices

GLint G3D::Args::patchVertices

Number of vertices per patch sent to the geometry or tesselation control shader from the vertex shader.

Only used if geometry input is PrimitiveType::PATCHES


documentation generated on Wed Nov 24 2021 08:01:53 using doxygen 1.8.15