KudanAR - iOS  1.6.0
ARMesh Class Reference

#import <ARMesh.h>

Inherits NSObject.

Instance Methods

(instancetype) - initWithVertexData:indexData:hasNormals:hasUVs:
 
(instancetype) - initWithVertexData:indexData:hasNormals:hasUVs:hasUVs2:hasTangents:maxBones:
 
(instancetype) - initWithVertexData:indexData:hasNormals:hasUVs:maxBones:
 
(instancetype) - initWithVertices:normals:UVs:indices:
 
(NSData *) - createVertexDataWithVertices:UVs:indices:
 
(instancetype) - initWithEmpty
 
(void) - setVertexData:
 
(instancetype) - initWithTestMeshWithUV:height:
 
(instancetype) - initWithTestMeshWithUV:height:u:v:
 
(void) - prepareRenderer:meshNode:
 

Class Methods

(id) + testMesh
 
(id) + testMeshWithUV
 
(instancetype) + texturedMeshWidth:height:
 
(instancetype) + meshWithWidth:height:
 

Properties

ARVertexBuffervertexBuffer
 
GLuint indexBuffer
 
NSUInteger numberOfIndices
 
unsigned numberOfVertices
 
unsigned vertexStride
 
BOOL hasNormals
 
BOOL hasTangents
 
BOOL hasUVs
 
BOOL hasBones
 
NSMutableArray * bones
 
BOOL hasBlendShapes
 

Detailed Description

An ARMesh is a class representing the geometry and mapping of a mesh. It is a collection of vertices, edges and faces that define the shape of an object. It also specifies the data of this mesh, including the vertex data, bones and texture data.

Method Documentation

◆ createVertexDataWithVertices:UVs:indices:

- (NSData *) createVertexDataWithVertices: (NSData *)  vertices
UVs: (NSData *)  UVs
indices: (NSData *)  indices 

Creates vertex data from verticies, UVs and indicies.

Parameters
verticesMesh vertices.
UVsMesh UV map.
indicesMesh indicies.
Returns
NSData

◆ initWithEmpty

- (instancetype) initWithEmpty

Initialises mesh with empty vertex buffer.

Returns
ARMesh

◆ initWithTestMeshWithUV:height:

- (instancetype) initWithTestMeshWithUV: (float)  width
height: (float)  height 

Initialises flat mesh with UV map with coordinates in range(0..1,0..1).

Parameters
widthMesh width.
heightMesh height.

◆ initWithTestMeshWithUV:height:u:v:

- (instancetype) initWithTestMeshWithUV: (float)  width
height: (float)  height
u: (float)  u
v: (float)  v 

Initialises flat mesh with UV map with coordinates in range(0..u,0...v).

Parameters
widthMesh width.
heightMesh height.
uUV map width.
vUV map height.

◆ initWithVertexData:indexData:hasNormals:hasUVs:

- (instancetype) initWithVertexData: (NSData *)  vertexData
indexData: (NSData *)  indexData
hasNormals: (BOOL)  hasNormals
hasUVs: (BOOL)  hasUVs 

Initialises mesh from vertex and index data. Also sets mesh parameters.

Parameters
vertexDataMesh vertex data.
indexDataMesh indicies.
hasNormalsIf the mesh has vertex normals in its vertex data.
hasUVsIf the mesh has a UVs in its vertex data.
Returns
ARMesh.

◆ initWithVertexData:indexData:hasNormals:hasUVs:hasUVs2:hasTangents:maxBones:

- (instancetype) initWithVertexData: (NSData *)  vertexData
indexData: (NSData *)  indexData
hasNormals: (BOOL)  hasNormals
hasUVs: (BOOL)  hasUVs
hasUVs2: (BOOL)  hasUVs2
hasTangents: (BOOL)  hasTangents
maxBones: (unsigned)  maxBones 

Initialises mesh from vertex and index data. Also sets mesh parameters.

Parameters
vertexDataMesh vertex data.
indexDataMesh index data.
hasNormalsIf the mesh has vertex normals.
hasUVsIf the mesh has a UVs in its vertex data.
hasUVs2If the mesh has a two sets of UVs in its vertex data.
hasTangentsIf the mesh has vertex tangents in its vertex data.
maxBonesThe maximum number of bones in the mesh.
Returns
ARMesh

◆ initWithVertexData:indexData:hasNormals:hasUVs:maxBones:

- (instancetype) initWithVertexData: (NSData *)  vertexData
indexData: (NSData *)  index12Data
hasNormals: (BOOL)  hasNormals
hasUVs: (BOOL)  hasUVs
maxBones: (unsigned)  maxBones 

Initialises mesh from vertex and index data. Also sets mesh parameters.

Parameters
vertexDataMesh vertex data.
indexDataMesh indicies.
hasNormalsIf the mesh has vertex normals in its vertex data.
hasUVsIf the mesh has a UVs in its vertex data.
maxBonesThe maximum number of bones in the mesh.
Returns
ARMesh

◆ initWithVertices:normals:UVs:indices:

- (instancetype) initWithVertices: (NSData *)  vertices
normals: (NSData *)  normals
UVs: (NSData *)  UVs
indices: (NSData *)  indices 

Initialises mesh with indicies, normals, UVs and indicies.

Parameters
verticesMesh verticies.
normalsMesh normals.
UVsMesh's UV map.
indicesMesh vertices.
Returns
ARMesh

◆ meshWithWidth:height:

+ (instancetype) meshWithWidth: (float)  width
height: (float)  height 

Creates a flat mesh.

Parameters
widthMesh width.
heightMesh height.

◆ prepareRenderer:meshNode:

- (void) prepareRenderer: (ARRenderer *)  renderer
meshNode: (ARMeshNode *)  meshNode 

Prepares the renderer for drawing the mesh by processing the bones and blend shapes associated with this mesh, as well as activating the relevant buffers.

◆ setVertexData:

- (void) setVertexData: (NSData *)  vertexData

Set mesh vertex data.

Parameters
vertexDataMesh vertex data.

◆ testMesh

+ (instancetype) testMesh

Creates a 10x10 flat mesh.

◆ testMeshWithUV

+ (instancetype) testMeshWithUV

Creates a 100x100 flat mesh and UV map with coordinates in range(0..1,0..1).

◆ texturedMeshWidth:height:

+ (instancetype) texturedMeshWidth: (float)  width
height: (float)  height 

Creates a flat mesh with UV map with coordinates in range(0..1,0..1).

Parameters
widthMesh width.
heightMesh height.

Property Documentation

◆ bones

- (NSMutableArray*) bones
readwritenonatomicassign

The array of ARBoneNodes that are part of this mesh. There is a limit of 64 bones per mesh.

◆ hasBlendShapes

- (BOOL) hasBlendShapes
readwritenonatomicassign

Whether this mesh has blend shape deformers.

◆ hasBones

- (BOOL) hasBones
readwritenonatomicassign

Whether the mesh has bones in its vertex data.

◆ hasNormals

- (BOOL) hasNormals
readwritenonatomicassign

Whether the mesh has normals in its vertex data.

◆ hasTangents

- (BOOL) hasTangents
readwritenonatomicassign

Whether this mesh has tangents in its vertex data.

◆ hasUVs

- (BOOL) hasUVs
readwritenonatomicassign

Whether the mesh has UVs in its vertex data. If it doesn't, materials with textures shouldn't be used.

◆ indexBuffer

- (GLuint) indexBuffer
readwritenonatomicassign

The index buffer used by the mesh.

◆ numberOfIndices

- (NSUInteger) numberOfIndices
readnonatomicassign

The total number of triangles in this mesh. A good number of triangles to aim for is 100,000.

◆ numberOfVertices

- (unsigned) numberOfVertices
readwritenonatomicassign

The total number of vertices in this mesh. During the model conversion process in the Kudan AR Toolkit, any meshes exceeding 65535 (2^16 - 1) vertices will be split into multiple separate meshes.

◆ vertexBuffer

- (ARVertexBuffer*) vertexBuffer
readwritenonatomicassign

The vertex buffer used by the mesh.

◆ vertexStride

- (unsigned) vertexStride
readwritenonatomicassign

The size of each vertex in this mesh.


The documentation for this class was generated from the following files: