Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# mesh.c File Reference

`#include <lib3ds/mesh.h>`
`#include <lib3ds/io.h>`
`#include <lib3ds/chunk.h>`
`#include <lib3ds/vector.h>`
`#include <lib3ds/matrix.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <math.h>`

Include dependency graph for mesh.c:

## Compounds
struct | _Lib3dsFaces
## Defines
#define | LIB3DS_EXPORT
## Typedefs
typedef _Lib3dsFaces | Lib3dsFaces
## Functions
Lib3dsBool | face_array_read (Lib3dsMesh *mesh, Lib3dsIo *io)
Lib3dsMesh * | lib3ds_mesh_new (const char *name)
void | lib3ds_mesh_free (Lib3dsMesh *mesh)
Lib3dsBool | lib3ds_mesh_new_point_list (Lib3dsMesh *mesh, Lib3dsDword points)
void | lib3ds_mesh_free_point_list (Lib3dsMesh *mesh)
Lib3dsBool | lib3ds_mesh_new_flag_list (Lib3dsMesh *mesh, Lib3dsDword flags)
void | lib3ds_mesh_free_flag_list (Lib3dsMesh *mesh)
Lib3dsBool | lib3ds_mesh_new_texel_list (Lib3dsMesh *mesh, Lib3dsDword texels)
void | lib3ds_mesh_free_texel_list (Lib3dsMesh *mesh)
Lib3dsBool | lib3ds_mesh_new_face_list (Lib3dsMesh *mesh, Lib3dsDword faces)
void | lib3ds_mesh_free_face_list (Lib3dsMesh *mesh)
void | lib3ds_mesh_bounding_box (Lib3dsMesh *mesh, Lib3dsVector min, Lib3dsVector max)
void | lib3ds_mesh_calculate_normals (Lib3dsMesh *mesh, Lib3dsVector *normalL)
void | lib3ds_mesh_dump (Lib3dsMesh *mesh)
Lib3dsBool | lib3ds_mesh_read (Lib3dsMesh *mesh, Lib3dsIo *io)
Lib3dsBool | point_array_write (Lib3dsMesh *mesh, Lib3dsIo *io)
Lib3dsBool | flag_array_write (Lib3dsMesh *mesh, Lib3dsIo *io)
Lib3dsBool | face_array_write (Lib3dsMesh *mesh, Lib3dsIo *io)
Lib3dsBool | texel_array_write (Lib3dsMesh *mesh, Lib3dsIo *io)
Lib3dsBool | lib3ds_mesh_write (Lib3dsMesh *mesh, Lib3dsIo *io)

## Define Documentation

#define LIB3DS_EXPORT

## Typedef Documentation

typedef struct _Lib3dsFaces Lib3dsFaces

## Function Documentation

Lib3dsBool face_array_read | ( | Lib3dsMesh * | mesh,
|  | Lib3dsIo * | io
| ) | `[static]`

Lib3dsBool face_array_write | ( | Lib3dsMesh * | mesh,
|  | Lib3dsIo * | io
| ) | `[static]`

Lib3dsBool flag_array_write | ( | Lib3dsMesh * | mesh,
|  | Lib3dsIo * | io
| ) | `[static]`

void lib3ds_mesh_calculate_normals | ( | Lib3dsMesh * | mesh,
|  | Lib3dsVector * | normalL
| ) |

  | Calculates the vertex normals corresponding to the smoothing group settings for each face of a mesh. Parameters:
  mesh | A pointer to the mesh to calculate the normals for.
  normalL | A pointer to a buffer to store the calculated normals. The buffer must have the size: 3*sizeof(Lib3dsVector)*mesh->faces.
To allocate the normal buffer do for example the following:
      Lib3dsVector *normalL = malloc(3*sizeof(Lib3dsVector)*mesh->faces);
To access the normal of the i-th vertex of the j-th face do the following:
       normalL[3*j+i]

Lib3dsBool point_array_write | ( | Lib3dsMesh * | mesh,
|  | Lib3dsIo * | io
| ) | `[static]`

Lib3dsBool texel_array_write | ( | Lib3dsMesh * | mesh,
|  | Lib3dsIo * | io
| ) | `[static]`