HERE iOS SDK Developer's Guide

NMAFloatMesh

Class Summary

class NMAFloatMesh

Derived from: NSObject

Represents a 3D model.

Include: NMAKit.framework/headers/NMAFloatMesh.h

Inheritance Diagrams

Figure 1. Public inheritance diagram for NMAFloatMesh

[For complete information, see the section Class Details]

Instance Method Summary

Table 1. Instance Methods
Instance Method Summary

-(id) initWithVertices:(const float *) vertices vertexCount:(NSUInteger) vertexCount textureCoordinates:(const float *) textureCoordinates coorCount:(NSUInteger) coorCount triangles:(const short *) triangles triangleCount:(NSUInteger) triangleCount

Convenient initializer for creating a NMAFloatMesh with required geometry data.

-(BOOL) isValid

Checks if the current mesh data is valid.

-(void) setTextureCoordinates:(const float *) textureCoordinates withCount:(NSUInteger) count

Sets the texture coordinates of the mesh.

-(void) setTriangles:(const short *) triangles withCount:(NSUInteger) count

Sets the triangles of the mesh.

-(void) setVertices:(const float *) vertices withCount:(NSUInteger) count

Sets the vertices of the mesh.

Class Details

Represents a 3D model.

The NMAFloatMesh class encapsulates all the geometric information needed to render a 3D model. This information includes the vertices, texture coordinates, and triangles of the model.

Instance Method Details

-(id) initWithVertices:(const float *) vertices vertexCount:(NSUInteger) vertexCount textureCoordinates:(const float *) textureCoordinates coorCount:(NSUInteger) coorCount triangles:(const short *) triangles triangleCount:(NSUInteger) triangleCount

Convenient initializer for creating a NMAFloatMesh with required geometry data.

Parameters:

  • vertices

    A pointer to an array of floats representing the mesh vertices

  • vertexCount

    The number of vertices in the array

  • textureCoordinates

    A pointer to an array of floats representing the texture coordinates.

  • coorCount

    The number of texture coordinates in the array

  • triangles

    A pointer to an array of shorts representing the triangles of the mesh

  • triangleCount

    The number of triangles in the array

Returns:

an object instance of NMAFloatMesh

-(BOOL) isValid

Checks if the current mesh data is valid.

A mesh is considered valid if it has equal numbers of vertices and texture coordinates and the indices of the triangle array are all less than the number of vertices.

-(void) setTextureCoordinates:(const float *) textureCoordinates withCount:(NSUInteger) count

Sets the texture coordinates of the mesh.

Every mesh vertex must also have a texture coordinate defined, which identifies the location on the mesh texture corresponding to that vertex. Texture coordinates are defined by two float values in the range [0, 1], with a value of (0, 0) corresponding to the upper left corner of the texture and (1, 1) the lower right corner.

Parameters:

  • textureCoordinates

    A pointer to an array of floats representing the texture coordinates.

  • count

    The number of texture coordinates in the array. The length of the textureCoordinates array should be 3 * count.

-(void) setTriangles:(const short *) triangles withCount:(NSUInteger) count

Sets the triangles of the mesh.

A mesh is rendered as a collection of triangles. Each triangle is defined by specifying the indices of the three vertices which make up its corners. The indices may be specified in any order.

Parameters:

  • triangles

    A pointer to an array of shorts representing the triangles of the mesh.

  • count

    The number of triangles in the array. The length of the triangles array should be 3 * count.

-(void) setVertices:(const float *) vertices withCount:(NSUInteger) count

Sets the vertices of the mesh.

Each mesh vertex is represented by three float values representing its x, y, and z positions. Three values are always required for each vertex, so the length of the vertices array should always be a multiple of 3.

Note:

The mesh is limited to 65536 vertices.

Parameters:

  • vertices

    A pointer to an array of floats representing the mesh vertices.

  • count

    The number of vertices in the array. The length of the vertices array should be 3 * count.