Home | API | File List | Examples | Download

API


Detailed Description

lib3ds public API.


Data Structures

struct  Lib3dsIo
struct  Lib3dsAtmosphere
struct  Lib3dsBackground
struct  Lib3dsShadow
 Shadow settings. More...
struct  Lib3dsView
struct  Lib3dsViewport
struct  Lib3dsTextureMap
struct  Lib3dsMaterial
 Material. More...
struct  Lib3dsCamera
 Camera object. More...
struct  Lib3dsLight
 Light object. More...
struct  Lib3dsFace
struct  Lib3dsMesh
struct  Lib3dsNode
struct  Lib3dsKey
struct  Lib3dsTrack
struct  Lib3dsAmbientColorNode
struct  Lib3dsMeshInstanceNode
struct  Lib3dsCameraNode
struct  Lib3dsTargetNode
struct  Lib3dsOmnilightNode
struct  Lib3dsSpotlightNode
struct  Lib3dsFile

Defines

#define LIB3DS_LAYOUT_MAX_VIEWS

Enumerations

enum  Lib3dsIoSeek {
  LIB3DS_SEEK_SET,
  LIB3DS_SEEK_CUR,
  LIB3DS_SEEK_END
}
enum  Lib3dsLogLevel {
  LIB3DS_LOG_ERROR,
  LIB3DS_LOG_WARN,
  LIB3DS_LOG_INFO,
  LIB3DS_LOG_DEBUG
}
enum  Lib3dsViewType {
  LIB3DS_VIEW_NOT_USED,
  LIB3DS_VIEW_TOP,
  LIB3DS_VIEW_BOTTOM,
  LIB3DS_VIEW_LEFT,
  LIB3DS_VIEW_RIGHT,
  LIB3DS_VIEW_FRONT,
  LIB3DS_VIEW_BACK,
  LIB3DS_VIEW_USER,
  LIB3DS_VIEW_SPOTLIGHT,
  LIB3DS_VIEW_CAMERA
}
enum  Lib3dsLayoutStyle {
  LIB3DS_LAYOUT_SINGLE,
  LIB3DS_LAYOUT_TWO_PANE_VERT_SPLIT,
  LIB3DS_LAYOUT_TWO_PANE_HORIZ_SPLIT,
  LIB3DS_LAYOUT_FOUR_PANE,
  LIB3DS_LAYOUT_THREE_PANE_LEFT_SPLIT,
  LIB3DS_LAYOUT_THREE_PANE_BOTTOM_SPLIT,
  LIB3DS_LAYOUT_THREE_PANE_RIGHT_SPLIT,
  LIB3DS_LAYOUT_THREE_PANE_TOP_SPLIT,
  LIB3DS_LAYOUT_THREE_PANE_VERT_SPLIT,
  LIB3DS_LAYOUT_THREE_PANE_HORIZ_SPLIT,
  LIB3DS_LAYOUT_FOUR_PANE_LEFT_SPLIT,
  LIB3DS_LAYOUT_FOUR_PANE_RIGHT_SPLIT
}
enum  Lib3dsTextureMapFlags {
  LIB3DS_TEXTURE_DECALE,
  LIB3DS_TEXTURE_MIRROR,
  LIB3DS_TEXTURE_NEGATE,
  LIB3DS_TEXTURE_NO_TILE,
  LIB3DS_TEXTURE_SUMMED_AREA,
  LIB3DS_TEXTURE_ALPHA_SOURCE,
  LIB3DS_TEXTURE_TINT,
  LIB3DS_TEXTURE_IGNORE_ALPHA,
  LIB3DS_TEXTURE_RGB_TINT
}
enum  Lib3dsAutoReflMapFlags {
  LIB3DS_AUTOREFL_USE,
  LIB3DS_AUTOREFL_READ_FIRST_FRAME_ONLY,
  LIB3DS_AUTOREFL_FLAT_MIRROR
}
enum  Lib3dsShading {
  LIB3DS_SHADING_WIRE_FRAME,
  LIB3DS_SHADING_FLAT,
  LIB3DS_SHADING_GOURAUD,
  LIB3DS_SHADING_PHONG,
  LIB3DS_SHADING_METAL
}
enum  Lib3dsObjectFlags {
  LIB3DS_OBJECT_HIDDEN,
  LIB3DS_OBJECT_VIS_LOFTER,
  LIB3DS_OBJECT_DOESNT_CAST,
  LIB3DS_OBJECT_MATTE,
  LIB3DS_OBJECT_DONT_RCVSHADOW,
  LIB3DS_OBJECT_FAST,
  LIB3DS_OBJECT_FROZEN
}
 Object flags for cameras, lights and meshes.
enum  Lib3dsMapType {
  LIB3DS_MAP_NONE,
  LIB3DS_MAP_PLANAR,
  LIB3DS_MAP_CYLINDRICAL,
  LIB3DS_MAP_SPHERICAL
}
enum  Lib3dsFaceFlags {
  LIB3DS_FACE_VIS_AC,
  LIB3DS_FACE_VIS_BC,
  LIB3DS_FACE_VIS_AB,
  LIB3DS_FACE_WRAP_U,
  LIB3DS_FACE_WRAP_V,
  LIB3DS_FACE_SELECT_3,
  LIB3DS_FACE_SELECT_2,
  LIB3DS_FACE_SELECT_1
}
 Meaning of Lib3dsFace::flags. More...
enum  Lib3dsNodeType {
  LIB3DS_NODE_AMBIENT_COLOR,
  LIB3DS_NODE_MESH_INSTANCE,
  LIB3DS_NODE_CAMERA,
  LIB3DS_NODE_CAMERA_TARGET,
  LIB3DS_NODE_OMNILIGHT,
  LIB3DS_NODE_SPOTLIGHT,
  LIB3DS_NODE_SPOTLIGHT_TARGET
}
enum  Lib3dsNodeFlags {
  LIB3DS_NODE_HIDDEN,
  LIB3DS_NODE_SHOW_PATH,
  LIB3DS_NODE_SMOOTHING,
  LIB3DS_NODE_MOTION_BLUR,
  LIB3DS_NODE_MORPH_MATERIALS
}
enum  Lib3dsKeyFlags {
  LIB3DS_KEY_USE_TENS,
  LIB3DS_KEY_USE_CONT,
  LIB3DS_KEY_USE_BIAS,
  LIB3DS_KEY_USE_EASE_TO,
  LIB3DS_KEY_USE_EASE_FROM
}
enum  Lib3dsTrackType {
  LIB3DS_TRACK_BOOL,
  LIB3DS_TRACK_FLOAT,
  LIB3DS_TRACK_VECTOR,
  LIB3DS_TRACK_QUAT
}
enum  Lib3dsTrackFlags {
  LIB3DS_TRACK_REPEAT,
  LIB3DS_TRACK_SMOOTH,
  LIB3DS_TRACK_LOCK_X,
  LIB3DS_TRACK_LOCK_Y,
  LIB3DS_TRACK_LOCK_Z,
  LIB3DS_TRACK_UNLINK_X,
  LIB3DS_TRACK_UNLINK_Y,
  LIB3DS_TRACK_UNLINK_Z
}

Functions

Lib3dsFile * lib3ds_file_open (const char *filename)
int lib3ds_file_save (Lib3dsFile *file, const char *filename)
Lib3dsFile * lib3ds_file_new ()
void lib3ds_file_free (Lib3dsFile *file)
void lib3ds_file_eval (Lib3dsFile *file, float t)
int lib3ds_file_read (Lib3dsFile *file, Lib3dsIo *io)
int lib3ds_file_write (Lib3dsFile *file, Lib3dsIo *io)
void lib3ds_file_reserve_materials (Lib3dsFile *file, int size, int force)
void lib3ds_file_insert_material (Lib3dsFile *file, Lib3dsMaterial *material, int index)
void lib3ds_file_remove_material (Lib3dsFile *file, int index)
int lib3ds_file_material_by_name (Lib3dsFile *file, const char *name)
void lib3ds_file_reserve_cameras (Lib3dsFile *file, int size, int force)
void lib3ds_file_insert_camera (Lib3dsFile *file, Lib3dsCamera *camera, int index)
void lib3ds_file_remove_camera (Lib3dsFile *file, int index)
int lib3ds_file_camera_by_name (Lib3dsFile *file, const char *name)
void lib3ds_file_reserve_lights (Lib3dsFile *file, int size, int force)
void lib3ds_file_insert_light (Lib3dsFile *file, Lib3dsLight *light, int index)
void lib3ds_file_remove_light (Lib3dsFile *file, int index)
int lib3ds_file_light_by_name (Lib3dsFile *file, const char *name)
void lib3ds_file_reserve_meshes (Lib3dsFile *file, int size, int force)
void lib3ds_file_insert_mesh (Lib3dsFile *file, Lib3dsMesh *mesh, int index)
void lib3ds_file_remove_mesh (Lib3dsFile *file, int index)
int lib3ds_file_mesh_by_name (Lib3dsFile *file, const char *name)
Lib3dsMesh * lib3ds_file_mesh_for_node (Lib3dsFile *file, Lib3dsNode *node)
Lib3dsNode * lib3ds_file_node_by_name (Lib3dsFile *file, const char *name, Lib3dsNodeType type)
Lib3dsNode * lib3ds_file_node_by_id (Lib3dsFile *file, unsigned short node_id)
void lib3ds_file_append_node (Lib3dsFile *file, Lib3dsNode *node, Lib3dsNode *parent)
void lib3ds_file_insert_node (Lib3dsFile *file, Lib3dsNode *node, Lib3dsNode *at)
void lib3ds_file_remove_node (Lib3dsFile *file, Lib3dsNode *node)
void lib3ds_file_minmax_node_id (Lib3dsFile *file, unsigned short *min_id, unsigned short *max_id)
void lib3ds_file_create_nodes_for_meshes (Lib3dsFile *file)
void lib3ds_file_bounding_box_of_objects (Lib3dsFile *file, int include_meshes, int include_cameras, int include_lights, float bmin[3], float bmax[3])
 This function computes the bounding box of meshes, cameras and lights defined in the 3D editor.
void lib3ds_file_bounding_box_of_nodes (Lib3dsFile *file, int include_meshes, int include_cameras, int include_lights, float bmin[3], float bmax[3], float matrix[4][4])
 This function computes the bounding box of mesh, camera and light instances defined in the Keyframer.
Lib3dsMateriallib3ds_material_new (const char *name)
void lib3ds_material_free (Lib3dsMaterial *material)
Lib3dsCameralib3ds_camera_new (const char *name)
void lib3ds_camera_free (Lib3dsCamera *mesh)
Lib3dsLightlib3ds_light_new (const char *name)
void lib3ds_light_free (Lib3dsLight *mesh)
Lib3dsMesh * lib3ds_mesh_new (const char *name)
void lib3ds_mesh_free (Lib3dsMesh *mesh)
void lib3ds_mesh_resize_vertices (Lib3dsMesh *mesh, int nvertices, int use_texcos, int use_flags)
void lib3ds_mesh_resize_faces (Lib3dsMesh *mesh, int nfaces)
void lib3ds_mesh_bounding_box (Lib3dsMesh *mesh, float bmin[3], float bmax[3])
void lib3ds_mesh_calculate_face_normals (Lib3dsMesh *mesh, float(*face_normals)[3])
void lib3ds_mesh_calculate_vertex_normals (Lib3dsMesh *mesh, float(*normals)[3])
Lib3dsNode * lib3ds_node_new (Lib3dsNodeType type)
Lib3dsAmbientColorNode * lib3ds_node_new_ambient_color (float color0[3])
Lib3dsMeshInstanceNode * lib3ds_node_new_mesh_instance (Lib3dsMesh *mesh, const char *instance_name, float pos0[3], float scl0[3], float rot0[4])
Lib3dsCameraNode * lib3ds_node_new_camera (Lib3dsCamera *camera)
Lib3dsTargetNode * lib3ds_node_new_camera_target (Lib3dsCamera *camera)
Lib3dsOmnilightNode * lib3ds_node_new_omnilight (Lib3dsLight *light)
Lib3dsSpotlightNode * lib3ds_node_new_spotlight (Lib3dsLight *light)
Lib3dsTargetNode * lib3ds_node_new_spotlight_target (Lib3dsLight *light)
void lib3ds_node_free (Lib3dsNode *node)
void lib3ds_node_eval (Lib3dsNode *node, float t)
Lib3dsNode * lib3ds_node_by_name (Lib3dsNode *node, const char *name, Lib3dsNodeType type)
Lib3dsNode * lib3ds_node_by_id (Lib3dsNode *node, unsigned short node_id)
Lib3dsTrack * lib3ds_track_new (Lib3dsTrackType type, int nkeys)
void lib3ds_track_free (Lib3dsTrack *track)
void lib3ds_track_resize (Lib3dsTrack *track, int nkeys)
void lib3ds_track_eval_bool (Lib3dsTrack *track, int *b, float t)
void lib3ds_track_eval_float (Lib3dsTrack *track, float *f, float t)
void lib3ds_track_eval_vector (Lib3dsTrack *track, float v[3], float t)
void lib3ds_track_eval_quat (Lib3dsTrack *track, float q[4], float t)
float lib3ds_math_ease (float fp, float fc, float fn, float ease_from, float ease_to)
 Calculates the ease in/out function.
void lib3ds_math_cubic_interp (float *v, float *a, float *p, float *q, float *b, int n, float t)
 Computes a point on a n-dimensional cubic hermite spline.
void lib3ds_vector_make (float c[3], float x, float y, float z)
void lib3ds_vector_zero (float c[3])
 Sets all components of a vector to zero.
void lib3ds_vector_copy (float dst[3], float src[3])
 Copies all components of a vector to another vector.
void lib3ds_vector_neg (float c[3])
 Negates all components of a vector.
void lib3ds_vector_add (float c[3], float a[3], float b[3])
void lib3ds_vector_sub (float c[3], float a[3], float b[3])
void lib3ds_vector_scalar_mul (float c[3], float a[3], float k)
void lib3ds_vector_cross (float c[3], float a[3], float b[3])
float lib3ds_vector_dot (float a[3], float b[3])
float lib3ds_vector_length (float c[3])
void lib3ds_vector_normalize (float c[3])
void lib3ds_vector_normal (float n[3], float a[3], float b[3], float c[3])
void lib3ds_vector_min (float c[3], float a[3])
void lib3ds_vector_max (float c[3], float a[3])
void lib3ds_vector_transform (float c[3], float m[4][4], float a[3])
void lib3ds_quat_identity (float c[4])
void lib3ds_quat_copy (float dest[4], float src[4])
void lib3ds_quat_axis_angle (float c[4], float axis[3], float angle)
void lib3ds_quat_neg (float c[4])
void lib3ds_quat_cnj (float c[4])
void lib3ds_quat_mul (float c[4], float a[4], float b[4])
void lib3ds_quat_scalar (float c[4], float k)
void lib3ds_quat_normalize (float c[4])
void lib3ds_quat_inv (float c[4])
float lib3ds_quat_dot (float a[4], float b[4])
float lib3ds_quat_norm (float c[4])
void lib3ds_quat_ln (float c[4])
void lib3ds_quat_ln_dif (float c[4], float a[4], float b[4])
void lib3ds_quat_exp (float c[4])
void lib3ds_quat_slerp (float c[4], float a[4], float b[4], float t)
void lib3ds_quat_squad (float c[4], float a[4], float p[4], float q[4], float b[4], float t)
void lib3ds_quat_tangent (float c[4], float p[4], float q[4], float n[4])
void lib3ds_matrix_zero (float m[4][4])
void lib3ds_matrix_identity (float m[4][4])
void lib3ds_matrix_copy (float dest[4][4], float src[4][4])
void lib3ds_matrix_neg (float m[4][4])
void lib3ds_matrix_transpose (float m[4][4])
void lib3ds_matrix_add (float m[4][4], float a[4][4], float b[4][4])
void lib3ds_matrix_sub (float m[4][4], float a[4][4], float b[4][4])
void lib3ds_matrix_mult (float m[4][4], float a[4][4], float b[4][4])
void lib3ds_matrix_scalar (float m[4][4], float k)
float lib3ds_matrix_det (float m[4][4])
int lib3ds_matrix_inv (float m[4][4])
void lib3ds_matrix_translate (float m[4][4], float x, float y, float z)
void lib3ds_matrix_scale (float m[4][4], float x, float y, float z)
void lib3ds_matrix_rotate_quat (float m[4][4], float q[4])
void lib3ds_matrix_rotate (float m[4][4], float angle, float ax, float ay, float az)
void lib3ds_matrix_camera (float m[4][4], float pos[3], float tgt[3], float roll)


Enumeration Type Documentation

Meaning of Lib3dsFace::flags.

ABC are points of the current face (A: is 1st vertex, B is 2nd vertex, C is 3rd vertex)

Enumerator:
LIB3DS_FACE_VIS_AC  Bit 0: Edge visibility AC.
LIB3DS_FACE_VIS_BC  Bit 1: Edge visibility BC.
LIB3DS_FACE_VIS_AB  Bit 2: Edge visibility AB.
LIB3DS_FACE_WRAP_U  Bit 3: Face is at tex U wrap seam.
LIB3DS_FACE_WRAP_V  Bit 4: Face is at tex V wrap seam.
LIB3DS_FACE_SELECT_3  Bit 13: Selection of the face in selection 3.
LIB3DS_FACE_SELECT_2  Bit 14: Selection of the face in selection 2.
LIB3DS_FACE_SELECT_1  Bit 15: Selection of the face in selection 1.

Definition at line 344 of file lib3ds.h.

Definition at line 47 of file lib3ds.h.


Function Documentation

void lib3ds_camera_free ( Lib3dsCamera camera  ) 

Free a Lib3dsCamera object and all of its resources.

Parameters:
camera Lib3dsCamera object to be freed.

Definition at line 54 of file lib3ds_camera.c.

Lib3dsCamera* lib3ds_camera_new ( const char *  name  ) 

Return a new Lib3dsCamera object.

Object is initialized with the given name and fov=45. All other values are 0.

Parameters:
name Name of this camera. Must not be NULL. Must be < 64 characters.
Returns:
Lib3dsCamera object or NULL on failure.
Examples:
cube.c.

Definition at line 32 of file lib3ds_camera.c.

void lib3ds_file_bounding_box_of_nodes ( Lib3dsFile *  file,
int  include_meshes,
int  include_cameras,
int  include_lights,
float  bmin[3],
float  bmax[3],
float  matrix[4][4] 
)

This function computes the bounding box of mesh, camera and light instances defined in the Keyframer.

Parameters:
file The Lib3dsFile object to be examined.
include_meshes Include meshes in bounding box calculation.
include_cameras Include cameras in bounding box calculation.
include_lights Include lights in bounding box calculation.
bmin Returned minimum x,y,z values.
bmax Returned maximum x,y,z values.
matrix A matrix describing the coordinate system to calculate the bounding box in.

Definition at line 1394 of file lib3ds_file.c.

void lib3ds_file_bounding_box_of_objects ( Lib3dsFile *  file,
int  include_meshes,
int  include_cameras,
int  include_lights,
float  bmin[3],
float  bmax[3] 
)

This function computes the bounding box of meshes, cameras and lights defined in the 3D editor.

Parameters:
file The Lib3dsFile object to be examined.
include_meshes Include meshes in bounding box calculation.
include_cameras Include cameras in bounding box calculation.
include_lights Include lights in bounding box calculation.
bmin Returned minimum x,y,z values.
bmax Returned maximum x,y,z values.

Definition at line 1283 of file lib3ds_file.c.

void lib3ds_file_eval ( Lib3dsFile *  file,
float  t 
)

Evaluate all of the nodes in this Lib3dsFile object.

Parameters:
file The Lib3dsFile object to be evaluated.
t time value, between 0. and file->frames
See also:
lib3ds_node_eval
Examples:
3ds2obj.c.

Definition at line 214 of file lib3ds_file.c.

void lib3ds_file_free ( Lib3dsFile *  file  ) 

Free a Lib3dsFile object and all of its resources.

Parameters:
file The Lib3dsFile object to be freed.
Examples:
3ds2obj.c, 3dsdump.c, and cube.c.

Definition at line 187 of file lib3ds_file.c.

Lib3dsFile* lib3ds_file_new (  ) 

Creates and returns a new, empty Lib3dsFile object.

Returns:
A pointer to the Lib3dsFile structure. If the structure cannot be allocated, NULL is returned.
Examples:
3dsdump.c, and cube.c.

Definition at line 160 of file lib3ds_file.c.

Lib3dsNode* lib3ds_file_node_by_name ( Lib3dsFile *  file,
const char *  name,
Lib3dsNodeType  type 
)

Return a node object by name and type.

This function performs a recursive search for the specified node. Both name and type must match.

Parameters:
file The Lib3dsFile to be searched.
name The target node name.
type The target node type
Returns:
A pointer to the first matching node, or NULL if not found.
See also:
lib3ds_node_by_name

Definition at line 1100 of file lib3ds_file.c.

Lib3dsFile* lib3ds_file_open ( const char *  filename  ) 

Loads a .3DS file from disk into memory.

Parameters:
filename The filename of the .3DS file
Returns:
A pointer to the Lib3dsFile structure containing the data of the .3DS file. If the .3DS file can not be loaded NULL is returned.
Note:
To free the returned structure use lib3ds_free.
See also:
lib3ds_file_save, lib3ds_file_new, lib3ds_file_free
Examples:
3ds2obj.c.

Definition at line 83 of file lib3ds_file.c.

int lib3ds_file_read ( Lib3dsFile *  file,
Lib3dsIo *  io 
)

Read 3ds file data into a Lib3dsFile object.

Parameters:
file The Lib3dsFile object to be filled.
io A Lib3dsIo object previously set up by the caller.
Returns:
LIB3DS_TRUE on success, LIB3DS_FALSE on failure.
Examples:
3dsdump.c.

Definition at line 595 of file lib3ds_file.c.

void lib3ds_file_remove_node ( Lib3dsFile *  file,
Lib3dsNode *  node 
)

Remove a node from the a Lib3dsFile object.

Parameters:
file The Lib3dsFile object to be modified.
node The Lib3dsNode object to be removed from file
Returns:
LIB3DS_TRUE on success, LIB3DS_FALSE if node is not found in file

Definition at line 1211 of file lib3ds_file.c.

int lib3ds_file_save ( Lib3dsFile *  file,
const char *  filename 
)

Saves a .3DS file from memory to disk.

Parameters:
file A pointer to a Lib3dsFile structure containing the the data that should be stored.
filename The filename of the .3DS file to store the data in.
Returns:
TRUE on success, FALSE otherwise.
See also:
lib3ds_file_open
Examples:
3dsdump.c, and cube.c.

Definition at line 129 of file lib3ds_file.c.

int lib3ds_file_write ( Lib3dsFile *  file,
Lib3dsIo *  io 
)

Write 3ds file data from a Lib3dsFile object to a file.

Parameters:
file The Lib3dsFile object to be written.
io A Lib3dsIo object previously set up by the caller.
Returns:
LIB3DS_TRUE on success, LIB3DS_FALSE on failure.

Definition at line 892 of file lib3ds_file.c.

Lib3dsMaterial* lib3ds_material_new ( const char *  name  ) 

Creates and returns a new, empty Lib3dsMaterial object.

Initial value of the material is a shiny grey.

Returns:
A pointer to the Lib3dsMaterial structure. If the structure cannot be allocated, NULL is returned.
Examples:
cube.c.

Definition at line 39 of file lib3ds_material.c.

void lib3ds_math_cubic_interp ( float *  v,
float *  a,
float *  p,
float *  q,
float *  b,
int  n,
float  t 
)

Computes a point on a n-dimensional cubic hermite spline.

Parameters:
v [out] Result
a [in] First point of the spline.
p [in] Tangent at the first point of the spline.
q [in] Tangent at the second point of the spline.
b [in] Second point of the spline.
n [in] Dimension
t [in] Parameter value [0...1]

Definition at line 51 of file lib3ds_math.c.

float lib3ds_math_ease ( float  fp,
float  fc,
float  fn,
float  ease_from,
float  ease_to 
)

Calculates the ease in/out function.

See Lib3dsKey for details.

Parameters:
fp Previous frame number.
fc Current frame number.
fn Next frame number.
ease_from Ease in value [0, 1.0]
ease_to Ease out value [0, 1.0]

Definition at line 22 of file lib3ds_math.c.

void lib3ds_matrix_add ( float  m[4][4],
float  a[4][4],
float  b[4][4] 
)

Add two matrices.

Definition at line 102 of file lib3ds_matrix.c.

void lib3ds_matrix_camera ( float  matrix[4][4],
float  pos[3],
float  tgt[3],
float  roll 
)

Compute a camera matrix based on position, target and roll.

Generates a translate/rotate matrix that maps world coordinates to camera coordinates. Resulting matrix does not include perspective transform.

Parameters:
matrix Destination matrix.
pos Camera position
tgt Camera target
roll Roll angle

Definition at line 427 of file lib3ds_matrix.c.

void lib3ds_matrix_copy ( float  dest[4][4],
float  src[4][4] 
)

Copy a matrix.

Examples:
3ds2obj.c.

Definition at line 60 of file lib3ds_matrix.c.

float lib3ds_matrix_det ( float  m[4][4]  ) 

Find determinant of a matrix.

Definition at line 195 of file lib3ds_matrix.c.

void lib3ds_matrix_identity ( float  m[4][4]  ) 

Set a matrix to identity.

Parameters:
m Matrix to be set.

Definition at line 46 of file lib3ds_matrix.c.

int lib3ds_matrix_inv ( float  m[4][4]  ) 

Invert a matrix in place.

Parameters:
m Matrix to invert.
Returns:
LIB3DS_TRUE on success, LIB3DS_FALSE on failure.
GGemsII, K.Wu, Fast Matrix Inversion
Examples:
3ds2obj.c.

Definition at line 233 of file lib3ds_matrix.c.

void lib3ds_matrix_mult ( float  m[4][4],
float  a[4][4],
float  b[4][4] 
)

Multiplies a matrix by a second one (m = m * n).

Examples:
3ds2obj.c.

Definition at line 136 of file lib3ds_matrix.c.

void lib3ds_matrix_neg ( float  m[4][4]  ) 

Negate a matrix -- all elements negated.

Definition at line 69 of file lib3ds_matrix.c.

void lib3ds_matrix_rotate ( float  m[4][4],
float  angle,
float  ax,
float  ay,
float  az 
)

Apply a rotation about an arbitrary axis to a matrix.

Definition at line 404 of file lib3ds_matrix.c.

void lib3ds_matrix_rotate_quat ( float  m[4][4],
float  q[4] 
)

Apply a rotation about an arbitrary axis to a matrix.

Definition at line 360 of file lib3ds_matrix.c.

void lib3ds_matrix_scalar ( float  m[4][4],
float  k 
)

Multiply a matrix by a scalar.

Parameters:
m Matrix to be set.
k Scalar.

Definition at line 159 of file lib3ds_matrix.c.

void lib3ds_matrix_scale ( float  m[4][4],
float  x,
float  y,
float  z 
)

Apply scale factors to a matrix.

Definition at line 345 of file lib3ds_matrix.c.

void lib3ds_matrix_sub ( float  m[4][4],
float  a[4][4],
float  b[4][4] 
)

Subtract two matrices.

Parameters:
m Result.
a Addend.
b Minuend.

Definition at line 121 of file lib3ds_matrix.c.

void lib3ds_matrix_translate ( float  m[4][4],
float  x,
float  y,
float  z 
)

Apply a translation to a matrix.

Examples:
3ds2obj.c.

Definition at line 332 of file lib3ds_matrix.c.

void lib3ds_matrix_transpose ( float  m[4][4]  ) 

Transpose a matrix in place.

Definition at line 84 of file lib3ds_matrix.c.

void lib3ds_matrix_zero ( float  m[4][4]  ) 

Clear a matrix to all zeros.

Parameters:
m Matrix to be cleared.

Definition at line 31 of file lib3ds_matrix.c.

void lib3ds_mesh_bounding_box ( Lib3dsMesh *  mesh,
float  bmin[3],
float  bmax[3] 
)

Find the bounding box of a mesh object.

Parameters:
mesh The mesh object
bmin Returned bounding box
bmax Returned bounding box

Definition at line 105 of file lib3ds_mesh.c.

void lib3ds_mesh_calculate_vertex_normals ( Lib3dsMesh *  mesh,
float(*)  normals[3] 
)

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.
normals A pointer to a buffer to store the calculated normals. The buffer must have the size: 3*3*sizeof(float)*mesh->nfaces.
To allocate the normal buffer do for example the following:
  Lib3dsVector *normals = malloc(3*3*sizeof(float)*mesh->nfaces);

To access the normal of the i-th vertex of the j-th face do the following:

   normals[3*j+i]
Examples:
3ds2obj.c.

Definition at line 163 of file lib3ds_mesh.c.

void lib3ds_mesh_free ( Lib3dsMesh *  mesh  ) 

Free a mesh object and all of its resources.

Parameters:
mesh Mesh object to be freed.

Definition at line 57 of file lib3ds_mesh.c.

Lib3dsMesh* lib3ds_mesh_new ( const char *  name  ) 

Create and return a new empty mesh object.

Mesh is initialized with the name and an identity matrix; all other fields are zero.

See Lib3dsFaceFlag for definitions of per-face flags.

Parameters:
name Mesh name. Must not be NULL. Must be < 64 characters.
Returns:
mesh object or NULL on error.
Examples:
cube.c.

Definition at line 34 of file lib3ds_mesh.c.

Lib3dsNode* lib3ds_node_by_name ( Lib3dsNode *  node,
const char *  name,
Lib3dsNodeType  type 
)

Return a node object by name and type.

This function performs a recursive search for the specified node. Both name and type must match.

Parameters:
node The parent node for the search
name The target node name.
type The target node type
Returns:
A pointer to the first matching node, or NULL if not found.

Definition at line 491 of file lib3ds_node.c.

void lib3ds_node_eval ( Lib3dsNode *  node,
float  t 
)

Evaluate an animation node.

Recursively sets node and its children to their appropriate values for this point in the animation.

Parameters:
node Node to be evaluated.
t time value, between 0. and file->frames

Definition at line 362 of file lib3ds_node.c.

void lib3ds_node_free ( Lib3dsNode *  node  ) 

Free a node and all of its resources.

Parameters:
node Lib3dsNode object to be freed.

Definition at line 346 of file lib3ds_node.c.

Lib3dsNode* lib3ds_node_new ( Lib3dsNodeType  type  ) 

Create and return a new node object.

The node is returned with an identity matrix. All other fields are zero.

Returns:
Lib3dsNode

Definition at line 30 of file lib3ds_node.c.

void lib3ds_quat_axis_angle ( float  c[4],
float  axis[3],
float  angle 
)

Compute a quaternion from axis and angle.

Parameters:
c Computed quaternion
axis Rotation axis
angle Angle of rotation, radians.

Definition at line 55 of file lib3ds_quat.c.

void lib3ds_quat_cnj ( float  c[4]  ) 

Compute the conjugate of a quaternion

Definition at line 90 of file lib3ds_quat.c.

void lib3ds_quat_copy ( float  dest[4],
float  src[4] 
)

Copy a quaternion.

Definition at line 39 of file lib3ds_quat.c.

float lib3ds_quat_dot ( float  a[4],
float  b[4] 
)

Compute the dot-product of a quaternion.

Definition at line 174 of file lib3ds_quat.c.

void lib3ds_quat_identity ( float  c[4]  ) 

Set a quaternion to Identity

Definition at line 29 of file lib3ds_quat.c.

void lib3ds_quat_inv ( float  c[4]  ) 

Compute the inverse of a quaternion.

Definition at line 153 of file lib3ds_quat.c.

void lib3ds_quat_mul ( float  c[4],
float  a[4],
float  b[4] 
)

Multiply two quaternions.

Parameters:
c Result
a,b Inputs

Definition at line 105 of file lib3ds_quat.c.

void lib3ds_quat_neg ( float  c[4]  ) 

Negate a quaternion

Definition at line 78 of file lib3ds_quat.c.

void lib3ds_quat_normalize ( float  c[4]  ) 

Normalize a quaternion.

Definition at line 132 of file lib3ds_quat.c.

void lib3ds_quat_scalar ( float  c[4],
float  k 
)

Multiply a quaternion by a scalar.

Definition at line 120 of file lib3ds_quat.c.