Inherits from CC3GLSLVariable : NSObject
Declared in CC3GLSLVariable.h

Overview

Represents a uniform variable used in a GLSL shader program.

The value of the uniform in the GL engine is tracked and is only set within the GL engine if the value has changed from its current value.

Properties

type

Returns a symbolic constant indicating the type of content held by this variable.

@property (nonatomic, readonly) GLenum type

Discussion

The returned value will be one of the following symbolic constants: – GL_FLOAT, GL_FLOAT_VEC2, GL_FLOAT_VEC3, GL_FLOAT_VEC4, – GL_INT, GL_INT_VEC2, GL_INT_VEC3, GL_INT_VEC4, – GL_BOOL, GL_BOOL_VEC2, GL_BOOL_VEC3, GL_BOOL_VEC4, – GL_FLOAT_MAT2, GL_FLOAT_MAT3, GL_FLOAT_MAT4, – GL_SAMPLER_2D, GL_SAMPLER_CUBE

Declared In

CC3GLSLVariable.h

Instance Methods

setBoolean:

Sets the value of this uniform to the specified value.

- (void)setBoolean:(BOOL)value

Discussion

If this uniform has been declared as an array, this method sets the value of the first element in the array.

The type property of this instance can be any value other than one of matrix types. If the type property indicates a float type, the boolean is converted to a float. If the type property indicates a vector type with more than one component, the remaining components are set to zero.

Declared In

CC3GLSLVariable.h

setBoolean:at:

Sets the element at the specified index in this uniform to the specified value.

- (void)setBoolean:(BOOL)value at:(GLuint)index

Discussion

The specified index must be less than the value of the size property. This method may still be used when this uniform has not been declared as an array. In this case, the value of the size property will be one, and so the specified index must be zero.

The type property of this instance can be any value other than one of matrix types. If the type property indicates a float type, the boolean is converted to a float. If the type property indicates a vector type with more than one component, the remaining components are set to zero.

Declared In

CC3GLSLVariable.h

setBooleanVectorX:andY:

Sets the value of this boolean vector uniform to the specified value.

- (void)setBooleanVectorX:(BOOL)bX andY:(BOOL)bY

Discussion

If this uniform has been declared as an array, this method sets the value of the first element in the array.

The type property of this instance can be any value other than one of matrix types. If the type property indicates a float type, the booleans are converted to floats. If the type property indicates a scalar, the X component is used. If the type property indicates a vector type with more than two components, the remaining components are set to zero.

Declared In

CC3GLSLVariable.h

setBooleanVectorX:andY:andZ:

Sets the value of this boolean vector uniform to the specified value.

- (void)setBooleanVectorX:(BOOL)bX andY:(BOOL)bY andZ:(BOOL)bZ

Discussion

If this uniform has been declared as an array, this method sets the value of the first element in the array.

The type property of this instance can be any value other than one of matrix types. If the type property indicates a float type, the booleans are converted to floats. If the type property indicates a scalar, the X component is used. If the type property indicates a vector type with fewer than three components, the X & Y components will be used. If the type property indicates a vector type with more than three components, fourth component is set to zero.

Declared In

CC3GLSLVariable.h

setBooleanVectorX:andY:andZ:andW:

Sets the value of this boolean vector uniform to the specified value.

- (void)setBooleanVectorX:(BOOL)bX andY:(BOOL)bY andZ:(BOOL)bZ andW:(BOOL)bW

Discussion

If this uniform has been declared as an array, this method sets the value of the first element in the array.

The type property of this instance can be any value other than one of matrix types. If the type property indicates a float type, the booleans are converted to floats. If the type property indicates a scalar, the X component is used. If the type property indicates a vector type with fewer than four components, the X & Y, or X, Y & Z components are used.

Declared In

CC3GLSLVariable.h

setBooleanVectorX:andY:andZ:andW:at:

Sets the element at the specified index of this boolean vector uniform to the specified value.

- (void)setBooleanVectorX:(BOOL)bX andY:(BOOL)bY andZ:(BOOL)bZ andW:(BOOL)bW at:(GLuint)index

Discussion

The specified index must be less than the value of the size property. This method may still be used when this uniform has not been declared as an array. In this case, the value of the size property will be one, and so the specified index must be zero.

The type property of this instance can be any value other than one of matrix types. If the type property indicates a float type, the booleans are converted to floats. If the type property indicates a scalar, the X component is used. If the type property indicates a vector type with fewer than four components, the X & Y, or X, Y & Z components are used.

Declared In

CC3GLSLVariable.h

setBooleanVectorX:andY:andZ:at:

Sets the element at the specified index of this boolean vector uniform to the specified value.

- (void)setBooleanVectorX:(BOOL)bX andY:(BOOL)bY andZ:(BOOL)bZ at:(GLuint)index

Discussion

The specified index must be less than the value of the size property. This method may still be used when this uniform has not been declared as an array. In this case, the value of the size property will be one, and so the specified index must be zero.

The type property of this instance can be any value other than one of matrix types. If the type property indicates a float type, the booleans are converted to floats. If the type property indicates a scalar, the X component is used. If the type property indicates a vector type with fewer than three components, the X & Y components will be used. If the type property indicates a vector type with more than three components, fourth component is set to zero.

Declared In

CC3GLSLVariable.h

setBooleanVectorX:andY:at:

Sets the element at the specified index of this boolean vector uniform to the specified value.

- (void)setBooleanVectorX:(BOOL)bX andY:(BOOL)bY at:(GLuint)index

Discussion

The specified index must be less than the value of the size property. This method may still be used when this uniform has not been declared as an array. In this case, the value of the size property will be one, and so the specified index must be zero.

The type property of this instance can be any value other than one of matrix types. If the type property indicates a float type, the booleans are converted to floats. If the type property indicates a scalar, the X component is used. If the type property indicates a vector type with more than two components, the remaining components are set to zero.

Declared In

CC3GLSLVariable.h

setColor4B:

Sets the value of this uniform to the specified value.

- (void)setColor4B:(ccColor4B)value

Discussion

If this uniform has been declared as an array, this method sets the value of the first element in the array.

The type property of this instance can be any value other than one of matrix types. If the type property indicates an float type, the integers are normalized to floats between 0 and 1. If the type property indicates a scalar, the R component of the specified color is used. If the type property indicates a vector type with fewer than four components, the R & G, or R, G & B components are used.

Declared In

CC3GLSLVariable.h

setColor4B:at:

Sets the element at the specified index in this uniform to the specified value.

- (void)setColor4B:(ccColor4B)value at:(GLuint)index

Discussion

The specified index must be less than the value of the size property. This method may still be used when this uniform has not been declared as an array. In this case, the value of the size property will be one, and so the specified index must be zero.

The type property of this instance can be any value other than one of matrix types. If the type property indicates an float type, the integers are normalized to floats between 0 and 1. If the type property indicates a scalar, the R component of the specified color is used. If the type property indicates a vector type with fewer than four components, the R & G, or R, G & B components are used.

Declared In

CC3GLSLVariable.h

setColor4F:

Sets the value of this uniform to the specified value.

- (void)setColor4F:(ccColor4F)value

Discussion

If this uniform has been declared as an array, this method sets the value of the first element in the array.

The type property of this instance can be any value other than one of matrix types. If the type property indicates an integer type, the floats are converted to integers in the range 0 to 255. If the type property indicates a scalar, the R component of the specified color is used. If the type property indicates a vector type with fewer than four components, the R & G, or R, G & B components are used.

Declared In

CC3GLSLVariable.h

setColor4F:at:

Sets the element at the specified index in this uniform to the specified value.

- (void)setColor4F:(ccColor4F)value at:(GLuint)index

Discussion

The specified index must be less than the value of the size property. This method may still be used when this uniform has not been declared as an array. In this case, the value of the size property will be one, and so the specified index must be zero.

The type property of this instance can be any value other than one of matrix types. If the type property indicates an integer type, the floats are converted to integers in the range 0 to 255. If the type property indicates a scalar, the R component of the specified color is used. If the type property indicates a vector type with fewer than four components, the R & G, or R, G & B components are used.

Declared In

CC3GLSLVariable.h

setFloat:

Sets the value of this uniform to the specified value.

- (void)setFloat:(GLfloat)value

Discussion

If this uniform has been declared as an array, this method sets the value of the first element in the array.

The type property of this instance can be any value other than one of matrix types. If the type property indicates an integer type, the float is converted to an integer. If the type property indicates a vector type with more than one component, the second and third components are set to zero and the fourth component is set to one.

Declared In

CC3GLSLVariable.h

setFloat:at:

Sets the element at the specified index in this uniform to the specified value.

- (void)setFloat:(GLfloat)value at:(GLuint)index

Discussion

The specified index must be less than the value of the size property. This method may still be used when this uniform has not been declared as an array. In this case, the value of the size property will be one, and so the specified index must be zero.

The type property of this instance can be any value other than one of matrix types. If the type property indicates an integer type, the float is converted to an integer. If the type property indicates a vector type with more than one component, the second and third components are set to zero and the fourth component is set to one.

Declared In

CC3GLSLVariable.h

setIntPoint:

Sets the value of this uniform to the specified value.

- (void)setIntPoint:(CC3IntPoint)value

Discussion

If this uniform has been declared as an array, this method sets the value of the first element in the array.

The type property of this instance can be any value other than one of matrix types. If the type property indicates a float type, the integer is converted to a float. If the type property indicates a scalar, the X component of the specified point is used. If the type property indicates a vector type with more than two components, the remaining components are set to zero.

Declared In

CC3GLSLVariable.h

setIntPoint:at:

Sets the element at the specified index in this uniform to the specified value.

- (void)setIntPoint:(CC3IntPoint)value at:(GLuint)index

Discussion

The specified index must be less than the value of the size property. This method may still be used when this uniform has not been declared as an array. In this case, the value of the size property will be one, and so the specified index must be zero.

The type property of this instance can be any value other than one of matrix types. If the type property indicates a float type, the integers are converted to floats. If the type property indicates a scalar, the X component of the specified point is used. If the type property indicates a vector type with more than two components, the remaining components are set to zero.

Declared In

CC3GLSLVariable.h

setIntVector4:

Sets the value of this uniform to the specified value.

- (void)setIntVector4:(CC3IntVector4)value

Discussion

If this uniform has been declared as an array, this method sets the value of the first element in the array.

The type property of this instance can be any value other than one of matrix types. If the type property indicates a float type, the integers are converted to floats. If the type property indicates a scalar, the X component of the specified vector is used. If the type property indicates a vector type with fewer than four components, the X & Y, or X, Y & Z components are used.

Declared In

CC3GLSLVariable.h

setIntVector4:at:

Sets the element at the specified index in this uniform to the specified value.

- (void)setIntVector4:(CC3IntVector4)value at:(GLuint)index

Discussion

The specified index must be less than the value of the size property. This method may still be used when this uniform has not been declared as an array. In this case, the value of the size property will be one, and so the specified index must be zero.

The type property of this instance can be any value other than one of matrix types. If the type property indicates a float type, the integers are converted to floats. If the type property indicates a scalar, the X component of the specified vector is used. If the type property indicates a vector type with fewer than four components, the X & Y, or X, Y & Z components are used.

Declared In

CC3GLSLVariable.h

setIntVector:

Sets the value of this uniform to the specified value.

- (void)setIntVector:(CC3IntVector)value

Discussion

If this uniform has been declared as an array, this method sets the value of the first element in the array.

The type property of this instance can be any value other than one of matrix types. If the type property indicates a float type, the integers are converted to floats. If the type property indicates a scalar, the X component of the specified vector is used. If the type property indicates a vector type with fewer than three components, the X & Y components will be used. If the type property indicates a vector type with more than three components, the fourth component is set to zero.

Declared In

CC3GLSLVariable.h

setIntVector:at:

Sets the element at the specified index in this uniform to the specified value.

- (void)setIntVector:(CC3IntVector)value at:(GLuint)index

Discussion

The specified index must be less than the value of the size property. This method may still be used when this uniform has not been declared as an array. In this case, the value of the size property will be one, and so the specified index must be zero.

The type property of this instance can be any value other than one of matrix types. If the type property indicates a float type, the integers are converted to floats. If the type property indicates a scalar, the X component of the specified vector is used. If the type property indicates a vector type with fewer than three components, the X & Y components will be used. If the type property indicates a vector type with more than three components, fourth component is set to zero.

Declared In

CC3GLSLVariable.h

setInteger:

Sets the value of this uniform to the specified value.

- (void)setInteger:(GLint)value

Discussion

If this uniform has been declared as an array, this method sets the value of the first element in the array.

The type property of this instance can be any value other than one of matrix types. If the type property indicates a float type, the integer is converted to a float. If the type property indicates a vector type with more than one component, the remaining components are set to zero.

Declared In

CC3GLSLVariable.h

setInteger:at:

Sets the element at the specified index in this uniform to the specified value.

- (void)setInteger:(GLint)value at:(GLuint)index

Discussion

The specified index must be less than the value of the size property. This method may still be used when this uniform has not been declared as an array. In this case, the value of the size property will be one, and so the specified index must be zero.

The type property of this instance can be any value other than one of matrix types. If the type property indicates a float type, the integer is converted to a float. If the type property indicates a vector type with more than one component, the remaining components are set to zero.

Declared In

CC3GLSLVariable.h

setMatrix3x3:

Sets the value of this uniform to the specified value.

- (void)setMatrix3x3:(const CC3Matrix3x3 *)value

Discussion

If this uniform has been declared as an array, this method sets the value of the first element in the array.

The type property of this instance must be GL_FLOAT_MAT3.

Declared In

CC3GLSLVariable.h

setMatrix3x3:at:

Sets the element at the specified index in this uniform to the specified value.

- (void)setMatrix3x3:(const CC3Matrix3x3 *)value at:(GLuint)index

Discussion

The specified index must be less than the value of the size property. This method may still be used when this uniform has not been declared as an array. In this case, the value of the size property will be one, and so the specified index must be zero.

The type property of this instance must be GL_FLOAT_MAT3.

Declared In

CC3GLSLVariable.h

setMatrix4x3:

Sets the 4x4 value of this uniform from the specified 4x3 value, adding the last identity row.

- (void)setMatrix4x3:(const CC3Matrix4x3 *)value

Discussion

If this uniform has been declared as an array, this method sets the value of the first element in the array.

The type property of this instance must be GL_FLOAT_MAT4.

Declared In

CC3GLSLVariable.h

setMatrix4x3:at:

Sets the 4x4 element at the specified index in this uniform to the specified 4x3 value, adding the last identity row.

- (void)setMatrix4x3:(const CC3Matrix4x3 *)value at:(GLuint)index

Discussion

The specified index must be less than the value of the size property. This method may still be used when this uniform has not been declared as an array. In this case, the value of the size property will be one, and so the specified index must be zero.

The type property of this instance must be GL_FLOAT_MAT4.

Declared In

CC3GLSLVariable.h

setMatrix4x4:

Sets the value of this uniform to the specified value.

- (void)setMatrix4x4:(const CC3Matrix4x4 *)value

Discussion

If this uniform has been declared as an array, this method sets the value of the first element in the array.

The type property of this instance must be GL_FLOAT_MAT4.

Declared In

CC3GLSLVariable.h

setMatrix4x4:at:

Sets the element at the specified index in this uniform to the specified value.

- (void)setMatrix4x4:(const CC3Matrix4x4 *)value at:(GLuint)index

Discussion

The specified index must be less than the value of the size property. This method may still be used when this uniform has not been declared as an array. In this case, the value of the size property will be one, and so the specified index must be zero.

The type property of this instance must be GL_FLOAT_MAT4.

Declared In

CC3GLSLVariable.h

setPoint:

Sets the value of this uniform to the specified value.

- (void)setPoint:(CGPoint)value

Discussion

If this uniform has been declared as an array, this method sets the value of the first element in the array.

The type property of this instance can be any value other than one of matrix types. If the type property indicates an integer type, the floats are converted to integers. If the type property indicates a scalar, the X component of the specified point is used. If the type property indicates a vector type with more than two components, the third component is set to zero and the fourth component is set to one.

Declared In

CC3GLSLVariable.h

setPoint:at:

Sets the element at the specified index in this uniform to the specified value.

- (void)setPoint:(CGPoint)value at:(GLuint)index

Discussion

The specified index must be less than the value of the size property. This method may still be used when this uniform has not been declared as an array. In this case, the value of the size property will be one, and so the specified index must be zero.

The type property of this instance can be any value other than one of matrix types. If the type property indicates an integer type, the floats are converted to integers. If the type property indicates a scalar, the X component of the specified point is used. If the type property indicates a vector type with more than two components, the third component is set to zero and the fourth component is set to one.

Declared In

CC3GLSLVariable.h

setQuaternion:

Sets the value of this uniform to the specified value.

- (void)setQuaternion:(CC3Quaternion)value

Discussion

If this uniform has been declared as an array, this method sets the value of the first element in the array.

The type property of this instance can be any value other than one of matrix types. If the type property indicates an integer type, the floats are converted to integers. If the type property indicates a scalar, the X component of the specified vector is used. If the type property indicates a vector type with fewer than four components, the X & Y, or X, Y & Z components are used.

Declared In

CC3GLSLVariable.h

setQuaternion:at:

Sets the element at the specified index in this uniform to the specified value.

- (void)setQuaternion:(CC3Quaternion)value at:(GLuint)index

Discussion

The specified index must be less than the value of the size property. This method may still be used when this uniform has not been declared as an array. In this case, the value of the size property will be one, and so the specified index must be zero.

The type property of this instance can be any value other than one of matrix types. If the type property indicates an integer type, the floats are converted to integers. If the type property indicates a scalar, the X component of the specified vector is used. If the type property indicates a vector type with fewer than four components, the X & Y, or X, Y & Z components are used.

Declared In

CC3GLSLVariable.h

setValueFromUniform:

Sets the value of this uniform from the value of the specified uniform.

- (void)setValueFromUniform:(CC3GLSLUniform *)uniform

Declared In

CC3GLSLVariable.h

setVector4:

Sets the value of this uniform to the specified value.

- (void)setVector4:(CC3Vector4)value

Discussion

If this uniform has been declared as an array, this method sets the value of the first element in the array.

The type property of this instance can be any value other than one of matrix types. If the type property indicates an integer type, the floats are converted to integers. If the type property indicates a scalar, the X component of the specified vector is used. If the type property indicates a vector type with fewer than four components, the X & Y, or X, Y & Z components are used.

Declared In

CC3GLSLVariable.h

setVector4:at:

Sets the element at the specified index in this uniform to the specified value.

- (void)setVector4:(CC3Vector4)value at:(GLuint)index

Discussion

The specified index must be less than the value of the size property. This method may still be used when this uniform has not been declared as an array. In this case, the value of the size property will be one, and so the specified index must be zero.

The type property of this instance can be any value other than one of matrix types. If the type property indicates an integer type, the floats are converted to integers. If the type property indicates a scalar, the X component of the specified vector is used. If the type property indicates a vector type with fewer than four components, the X & Y, or X, Y & Z components are used.

Declared In

CC3GLSLVariable.h

setVector:

Sets the value of this uniform to the specified value.

- (void)setVector:(CC3Vector)value

Discussion

If this uniform has been declared as an array, this method sets the value of the first element in the array.

The type property of this instance can be any value other than one of matrix types. If the type property indicates an integer type, the floats are converted to integers. If the type property indicates a scalar, the X component of the specified vector is used. If the type property indicates a vector type with fewer than three components, the X & Y components will be used. If the type property indicates a vector type with more than three components, fourth component is set to one.

Declared In

CC3GLSLVariable.h

setVector:at:

Sets the element at the specified index in this uniform to the specified value.

- (void)setVector:(CC3Vector)value at:(GLuint)index

Discussion

The specified index must be less than the value of the size property. This method may still be used when this uniform has not been declared as an array. In this case, the value of the size property will be one, and so the specified index must be zero.

The type property of this instance can be any value other than one of matrix types. If the type property indicates an integer type, the floats are converted to integers. If the type property indicates a scalar, the X component of the specified vector is used. If the type property indicates a vector type with fewer than three components, the X & Y components will be used. If the type property indicates a vector type with more than three components, fourth component is set to one.

Declared In

CC3GLSLVariable.h

updateGLValueWithVisitor:

Invoked during drawing, after all of the content of the variable has been set using the set… methods, in order to have the value of this variable set into the GL engine.

- (BOOL)updateGLValueWithVisitor:(CC3NodeDrawingVisitor *)visitor

Discussion

The GL engine is only updated if the content of this variable has changed. Returns whether the value has changed and was updated into the GL engine.

This method is invoked automatically during uniform population. The application normally never needs to invoke this method.

Declared In

CC3GLSLVariable.h

valueDescription

Returns a string description of the current value of this uniform.

- (NSString *)valueDescription

Declared In

CC3GLSLVariable.h