Inherits from NSObject
Conforms to NGLIterator
Declared in NGLSLVariables.h

Overview

Encapsulates and hold all the variables to a specific shader program.

NGLVariables is a library to all the variables (attributes and uniforms) of a specific shader program.

As any NinevehGL library of structures, this class makes use of the iterator pattern to fast retrieve its elements. You can use iterator with the #nextIterator# and resetIterator methods.

Tasks

Instance Methods

addFromVariables:

Copies all the structure instances from other library of structures.

- (void)addFromVariables:(NGLSLVariables *)variables

Parameters

variables

A NGLSLVariables instance to copy the instances from.

Discussion

Copies all the structure instances from other library of structures.

All the values will be copied and a new memory block will be allocated. The original library and/or values can be deleted with no impact on these new copies.

Declared In

NGLSLVariables.h

addVariable:

Adds a new instance into this library.

- (void)addVariable:(NGLSLVariable)variable

Parameters

variable

A NGLSLVariable struct, not necessarily filled.

Discussion

Adds a new instance into this library.

The parameters/fields of the new instance don’t need to be filled all. Only the valid values will be copied and a memory block will be reserved to all the other fields.

Declared In

NGLSLVariables.h

count

Returns the number of instances in this library at the moment.

- (unsigned int)count

Return Value

An unsigned int data type.

Discussion

Returns the number of instances in this library at the moment.

Declared In

NGLSLVariables.h

removeAll

Removes all the instances inside this library.

- (void)removeAll

Discussion

Removes all the instances inside this library.

This method makes a clean up inside this library, freeing all allocated memories to the instances in it.

Declared In

NGLSLVariables.h

removeVariableWithName:

Removes a structure instance based on a Variable’s name.

- (void)removeVariableWithName:(const char *)name

Parameters

name

A C string containing the Variable’s name. It’s the same used inside the shaders.

Discussion

Removes a structure instance based on a Variable’s name.

Performs a search inside all the instances inside this library looking for the informed parameter. If the parameter is found, its instance will be removed from this library and its memory will be freed. Otherwise, nothing will happen.

Declared In

NGLSLVariables.h

variableAtIndex:

Returns a pointer to a NGLSLVariable struct based on its index.

- (NGLSLVariable *)variableAtIndex:(int)index

Parameters

index

The index of the desired variable inside this library.

Return Value

A pointer to NGLSLVariable struct. It can return NULL.

Discussion

Returns a pointer to a NGLSLVariable struct based on its index.

This method will search for an instance in the informed index inside this library. This method will return NULL if the index is out of bounds. All the changes made inside the returning pointer will affect directly the original NGLSLVariable inside this library.

Declared In

NGLSLVariables.h

variableWithName:

Returns a pointer to a NGLSLVariable struct based on a variable’s name.

- (NGLSLVariable *)variableWithName:(const char *)name

Parameters

name

A C string containing the Variable’s name. It’s the same used inside the shaders.

Return Value

A pointer to NGLSLVariable struct. It can return NULL if no result is found.

Discussion

Returns a pointer to a NGLSLVariable struct based on a variable’s name.

Performs a search inside all the variables inside this library looking for the informed variable’s name. This method will return NULL if the index is out of bounds. All the changes made inside the returning pointer will affect directly the original NGLSLVariable inside this library.

Declared In

NGLSLVariables.h