Inherits from NSObject
Conforms to NGLIterator
Declared in NGLMeshElements.h

Overview

A library that holds the elements for a mesh.

NGLMeshElements can hold and manage many elements (NGLElement). Each element is a tiny object holding the information necessaries to instruct the shaders about the element. There are few kind of elements:

  • Vertex Position;
  • Vertex Texture Coordinate;
  • Vertex Normal;
  • Vertex Tangent;
  • Vertex Bitangent.

NinevehGL just works with per-vertex elements to produce smooth effects on shaders. As any NinevehGL library, 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

addElement:

Adds a new instance into this library.

- (void)addElement:(NGLElement)element

Parameters

element

A NGLElement 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

NGLMeshElements.h

addFromElements:

Copies all the structure instances from other library of structures.

- (void)addFromElements:(NGLMeshElements *)elements

Parameters

elements

A NGLMeshElements 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.

See Also

Declared In

NGLMeshElements.h

count

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

- (int)count

Return Value

An int data type.

Discussion

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

Declared In

NGLMeshElements.h

elementWithComponent:

Returns a pointer to a structure instance based on a component.

- (NGLElement *)elementWithComponent:(NGLComponent)component

Parameters

component

The NGLComponent to searching for.

Return Value

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

Discussion

Returns a pointer to a structure instance based on a component.

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 instance inside this library.

Declared In

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

NGLMeshElements.h

removeElementWithComponent:

Removes a structure instance based on a component.

- (void)removeElementWithComponent:(NGLComponent)component

Parameters

component

The NGLComponent to searching for.

Discussion

Removes a structure instance based on a component.

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

NGLMeshElements.h