zenilib
0.5.3.0
|
Classes | |
struct | Lib3dsAmbientColorNode |
struct | Lib3dsAtmosphere |
struct | Lib3dsBackground |
struct | Lib3dsCamera |
struct | Lib3dsCameraNode |
struct | Lib3dsFace |
struct | Lib3dsFile |
struct | Lib3dsIo |
struct | Lib3dsKey |
struct | Lib3dsLight |
struct | Lib3dsMaterial |
struct | Lib3dsMesh |
struct | Lib3dsMeshInstanceNode |
struct | Lib3dsNode |
struct | Lib3dsOmnilightNode |
struct | Lib3dsShadow |
struct | Lib3dsSpotlightNode |
struct | Lib3dsTargetNode |
struct | Lib3dsTextureMap |
struct | Lib3dsTrack |
struct | Lib3dsView |
struct | Lib3dsViewport |
Macros | |
#define | LIB3DS_LAYOUT_MAX_VIEWS 32 |
#define LIB3DS_LAYOUT_MAX_VIEWS 32 |
Definition at line 154 of file lib3ds.h.
Referenced by lib3ds_viewport_read().
typedef struct Lib3dsAmbientColorNode Lib3dsAmbientColorNode |
typedef struct Lib3dsAtmosphere Lib3dsAtmosphere |
typedef enum Lib3dsAutoReflMapFlags Lib3dsAutoReflMapFlags |
typedef struct Lib3dsBackground Lib3dsBackground |
typedef struct Lib3dsCamera Lib3dsCamera |
Camera object
typedef struct Lib3dsCameraNode Lib3dsCameraNode |
typedef struct Lib3dsFace Lib3dsFace |
typedef enum Lib3dsFaceFlags Lib3dsFaceFlags |
Meaning of Lib3dsFace::flags. ABC are points of the current face (A: is 1st vertex, B is 2nd vertex, C is 3rd vertex)
typedef struct Lib3dsFile Lib3dsFile |
typedef enum Lib3dsIoSeek Lib3dsIoSeek |
typedef enum Lib3dsKeyFlags Lib3dsKeyFlags |
typedef enum Lib3dsLayoutStyle Lib3dsLayoutStyle |
typedef struct Lib3dsLight Lib3dsLight |
Light object
typedef enum Lib3dsLogLevel Lib3dsLogLevel |
typedef struct Lib3dsMaterial Lib3dsMaterial |
Material
typedef struct Lib3dsMesh Lib3dsMesh |
typedef struct Lib3dsMeshInstanceNode Lib3dsMeshInstanceNode |
typedef struct Lib3dsNode Lib3dsNode |
typedef enum Lib3dsNodeFlags Lib3dsNodeFlags |
typedef enum Lib3dsNodeType Lib3dsNodeType |
typedef enum Lib3dsObjectFlags Lib3dsObjectFlags |
Object flags for cameras, lights and meshes
typedef struct Lib3dsOmnilightNode Lib3dsOmnilightNode |
typedef enum Lib3dsShading Lib3dsShading |
typedef struct Lib3dsShadow Lib3dsShadow |
typedef struct Lib3dsSpotlightNode Lib3dsSpotlightNode |
typedef struct Lib3dsTargetNode Lib3dsTargetNode |
typedef struct Lib3dsTextureMap Lib3dsTextureMap |
typedef enum Lib3dsTextureMapFlags Lib3dsTextureMapFlags |
typedef struct Lib3dsTrack Lib3dsTrack |
typedef enum Lib3dsTrackType Lib3dsTrackType |
typedef struct Lib3dsView Lib3dsView |
typedef struct Lib3dsViewport Lib3dsViewport |
typedef enum Lib3dsViewType Lib3dsViewType |
enum Lib3dsFaceFlags |
Meaning of Lib3dsFace::flags. ABC are points of the current face (A: is 1st vertex, B is 2nd vertex, C is 3rd vertex)
enum Lib3dsIoSeek |
enum Lib3dsKeyFlags |
enum Lib3dsLayoutStyle |
enum Lib3dsLogLevel |
enum Lib3dsMapType |
enum Lib3dsNodeFlags |
enum Lib3dsNodeType |
enum Lib3dsObjectFlags |
enum Lib3dsShading |
enum Lib3dsTrackFlags |
enum Lib3dsTrackType |
enum Lib3dsViewType |
LIB3DSAPI void lib3ds_camera_free | ( | Lib3dsCamera * | camera | ) |
Free a Lib3dsCamera object and all of its resources.
camera | Lib3dsCamera object to be freed. |
Definition at line 54 of file lib3ds_camera.c.
Referenced by lib3ds_file_remove_camera(), and lib3ds_file_reserve_cameras().
LIB3DSAPI 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.
name | Name of this camera. Must not be NULL. Must be < 64 characters. |
Definition at line 32 of file lib3ds_camera.c.
References assert, calloc, Lib3dsCamera::fov, and Lib3dsCamera::name.
Referenced by named_object_read().
LIB3DSAPI void lib3ds_file_append_node | ( | Lib3dsFile * | file, |
Lib3dsNode * | node, | ||
Lib3dsNode * | parent | ||
) |
Definition at line 1148 of file lib3ds_file.c.
References assert, Lib3dsNode::childs, Lib3dsNode::next, Lib3dsFile::nodes, NULL, and Lib3dsNode::parent.
LIB3DSAPI 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.
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.
References file_bounding_box_of_nodes_impl(), lib3ds_matrix_copy(), lib3ds_matrix_identity(), Lib3dsNode::next, and Lib3dsFile::nodes.
LIB3DSAPI 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.
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.
References Lib3dsFile::cameras, i, lib3ds_mesh_bounding_box(), lib3ds_vector_max(), lib3ds_vector_min(), Lib3dsFile::lights, Lib3dsFile::meshes, Lib3dsFile::ncameras, Lib3dsFile::nmeshes, Lib3dsCamera::position, Lib3dsLight::position, Lib3dsLight::spot_light, Lib3dsCamera::target, and Lib3dsLight::target.
LIB3DSAPI int lib3ds_file_camera_by_name | ( | Lib3dsFile * | file, |
const char * | name | ||
) |
Definition at line 985 of file lib3ds_file.c.
References assert, Lib3dsFile::cameras, i, Lib3dsCamera::name, and Lib3dsFile::ncameras.
LIB3DSAPI void lib3ds_file_create_nodes_for_meshes | ( | Lib3dsFile * | file | ) |
Definition at line 1417 of file lib3ds_file.c.
References i, lib3ds_file_insert_node(), LIB3DS_NODE_MESH_INSTANCE, lib3ds_node_new(), Lib3dsFile::meshes, Lib3dsMesh::name, Lib3dsNode::name, Lib3dsFile::nmeshes, and NULL.
LIB3DSAPI void lib3ds_file_eval | ( | Lib3dsFile * | file, |
float | t | ||
) |
Evaluate all of the nodes in this Lib3dsFile object.
file | The Lib3dsFile object to be evaluated. |
t | time value, between 0. and file->frames |
Definition at line 214 of file lib3ds_file.c.
References lib3ds_node_eval(), Lib3dsNode::next, and Lib3dsFile::nodes.
Referenced by Zeni::Model::set_keyframe().
LIB3DSAPI void lib3ds_file_free | ( | Lib3dsFile * | file | ) |
Free a Lib3dsFile object and all of its resources.
file | The Lib3dsFile object to be freed. |
Definition at line 187 of file lib3ds_file.c.
References assert, free, lib3ds_file_reserve_cameras(), lib3ds_file_reserve_lights(), lib3ds_file_reserve_materials(), lib3ds_file_reserve_meshes(), lib3ds_node_free(), Lib3dsNode::next, Lib3dsFile::nodes, and TRUE.
Referenced by Zeni::Model::~Model().
LIB3DSAPI void lib3ds_file_insert_camera | ( | Lib3dsFile * | file, |
Lib3dsCamera * | camera, | ||
int | index | ||
) |
Definition at line 971 of file lib3ds_file.c.
References assert, Lib3dsFile::cameras, Lib3dsFile::cameras_size, lib3ds_util_insert_array(), and Lib3dsFile::ncameras.
Referenced by named_object_read().
LIB3DSAPI void lib3ds_file_insert_light | ( | Lib3dsFile * | file, |
Lib3dsLight * | light, | ||
int | index | ||
) |
Definition at line 1007 of file lib3ds_file.c.
References assert, lib3ds_util_insert_array(), Lib3dsFile::lights, Lib3dsFile::lights_size, and Lib3dsFile::nlights.
Referenced by named_object_read().
LIB3DSAPI void lib3ds_file_insert_material | ( | Lib3dsFile * | file, |
Lib3dsMaterial * | material, | ||
int | index | ||
) |
Definition at line 935 of file lib3ds_file.c.
References assert, lib3ds_util_insert_array(), Lib3dsFile::materials, Lib3dsFile::materials_size, and Lib3dsFile::nmaterials.
Referenced by mdata_read().
LIB3DSAPI void lib3ds_file_insert_mesh | ( | Lib3dsFile * | file, |
Lib3dsMesh * | mesh, | ||
int | index | ||
) |
Definition at line 1043 of file lib3ds_file.c.
References assert, lib3ds_util_insert_array(), Lib3dsFile::meshes, Lib3dsFile::meshes_size, and Lib3dsFile::nmeshes.
Referenced by named_object_read().
LIB3DSAPI void lib3ds_file_insert_node | ( | Lib3dsFile * | file, |
Lib3dsNode * | node, | ||
Lib3dsNode * | at | ||
) |
Definition at line 1172 of file lib3ds_file.c.
References assert, Lib3dsNode::childs, Lib3dsNode::next, Lib3dsFile::nodes, NULL, and Lib3dsNode::parent.
Referenced by lib3ds_file_create_nodes_for_meshes().
LIB3DSAPI int lib3ds_file_light_by_name | ( | Lib3dsFile * | file, |
const char * | name | ||
) |
Definition at line 1021 of file lib3ds_file.c.
References assert, i, Lib3dsFile::lights, Lib3dsLight::name, and Lib3dsFile::nlights.
LIB3DSAPI int lib3ds_file_material_by_name | ( | Lib3dsFile * | file, |
const char * | name | ||
) |
Definition at line 949 of file lib3ds_file.c.
References assert, i, Lib3dsFile::materials, Lib3dsMaterial::name, and Lib3dsFile::nmaterials.
Referenced by face_array_read().
LIB3DSAPI int lib3ds_file_mesh_by_name | ( | Lib3dsFile * | file, |
const char * | name | ||
) |
Definition at line 1057 of file lib3ds_file.c.
References assert, i, Lib3dsFile::meshes, Lib3dsMesh::name, and Lib3dsFile::nmeshes.
Referenced by file_bounding_box_of_nodes_impl(), lib3ds_file_mesh_for_node(), and Zeni::Model::visit_meshes().
LIB3DSAPI Lib3dsMesh* lib3ds_file_mesh_for_node | ( | Lib3dsFile * | file, |
Lib3dsNode * | node | ||
) |
Definition at line 1071 of file lib3ds_file.c.
References lib3ds_file_mesh_by_name(), LIB3DS_NODE_MESH_INSTANCE, Lib3dsFile::meshes, Lib3dsNode::name, NULL, and Lib3dsNode::type.
LIB3DSAPI void lib3ds_file_minmax_node_id | ( | Lib3dsFile * | file, |
unsigned short * | min_id, | ||
unsigned short * | max_id | ||
) |
Definition at line 1266 of file lib3ds_file.c.
References file_minmax_node_id_impl(), Lib3dsNode::next, and Lib3dsFile::nodes.
LIB3DSAPI Lib3dsFile* lib3ds_file_new | ( | ) |
Creates and returns a new, empty Lib3dsFile object.
Definition at line 160 of file lib3ds_file.c.
References calloc, Lib3dsFile::current_frame, file, Lib3dsFile::frames, Lib3dsFile::keyf_revision, Lib3dsFile::master_scale, Lib3dsFile::mesh_version, Lib3dsFile::name, Lib3dsFile::segment_from, and Lib3dsFile::segment_to.
Referenced by lib3ds_file_open().
LIB3DSAPI Lib3dsNode* lib3ds_file_node_by_id | ( | Lib3dsFile * | file, |
uint16_t | node_id | ||
) |
Return a node object by id.
This function performs a recursive search for the specified node.
file | The Lib3dsFile to be searched. |
node_id | The target node id. |
Definition at line 1130 of file lib3ds_file.c.
References assert, lib3ds_node_by_id(), Lib3dsNode::next, Lib3dsNode::node_id, and Lib3dsFile::nodes.
LIB3DSAPI 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.
file | The Lib3dsFile to be searched. |
name | The target node name. |
type | The target node type |
Definition at line 1100 of file lib3ds_file.c.
References assert, lib3ds_node_by_name(), Lib3dsNode::name, Lib3dsNode::next, Lib3dsFile::nodes, and Lib3dsNode::type.
LIB3DSAPI Lib3dsFile* lib3ds_file_open | ( | const char * | filename | ) |
Loads a .3DS file from disk into memory.
filename | The filename of the .3DS file |
Definition at line 83 of file lib3ds_file.c.
References file, fileio_read_func(), fileio_seek_func(), fileio_tell_func(), fileio_write_func(), free, lib3ds_file_new(), lib3ds_file_read(), Lib3dsIo::log_func, memset, NULL, Lib3dsIo::read_func, Lib3dsIo::seek_func, Lib3dsIo::self, Lib3dsIo::tell_func, and Lib3dsIo::write_func.
LIB3DSAPI int lib3ds_file_read | ( | Lib3dsFile * | file, |
Lib3dsIo * | io | ||
) |
Read 3ds file data into a Lib3dsFile object.
file | The Lib3dsFile object to be filled. |
io | A Lib3dsIo object previously set up by the caller. |
Definition at line 595 of file lib3ds_file.c.
References CHK_CMAGIC, CHK_KFDATA, CHK_M3D_VERSION, CHK_M3DMAGIC, CHK_MDATA, CHK_MLIBMAGIC, Lib3dsChunk::chunk, chunk, FALSE, if(), Lib3dsIo::impl, Lib3dsIoImpl::jmpbuf, kfdata_read(), lib3ds_chunk_read_end(), lib3ds_chunk_read_next(), lib3ds_chunk_read_reset(), lib3ds_chunk_read_start(), lib3ds_chunk_unknown(), lib3ds_io_cleanup(), lib3ds_io_read_dword(), lib3ds_io_setup(), mdata_read(), memset, Lib3dsFile::mesh_version, and TRUE.
Referenced by lib3ds_file_open().
LIB3DSAPI void lib3ds_file_remove_camera | ( | Lib3dsFile * | file, |
int | index | ||
) |
Definition at line 978 of file lib3ds_file.c.
References assert, Lib3dsFile::cameras, lib3ds_camera_free(), lib3ds_util_remove_array(), and Lib3dsFile::ncameras.
LIB3DSAPI void lib3ds_file_remove_light | ( | Lib3dsFile * | file, |
int | index | ||
) |
Definition at line 1014 of file lib3ds_file.c.
References assert, lib3ds_light_free(), lib3ds_util_remove_array(), Lib3dsFile::lights, and Lib3dsFile::nlights.
LIB3DSAPI void lib3ds_file_remove_material | ( | Lib3dsFile * | file, |
int | index | ||
) |
Definition at line 942 of file lib3ds_file.c.
References assert, lib3ds_material_free(), lib3ds_util_remove_array(), Lib3dsFile::materials, and Lib3dsFile::nmaterials.
LIB3DSAPI void lib3ds_file_remove_mesh | ( | Lib3dsFile * | file, |
int | index | ||
) |
Definition at line 1050 of file lib3ds_file.c.
References assert, lib3ds_mesh_free(), lib3ds_util_remove_array(), Lib3dsFile::meshes, and Lib3dsFile::nmeshes.
LIB3DSAPI void lib3ds_file_remove_node | ( | Lib3dsFile * | file, |
Lib3dsNode * | node | ||
) |
Remove a node from the a Lib3dsFile object.
file | The Lib3dsFile object to be modified. |
node | The Lib3dsNode object to be removed from file |
Definition at line 1211 of file lib3ds_file.c.
References Lib3dsNode::childs, Lib3dsNode::next, Lib3dsFile::nodes, and Lib3dsNode::parent.
LIB3DSAPI void lib3ds_file_reserve_cameras | ( | Lib3dsFile * | file, |
int | size, | ||
int | force | ||
) |
Definition at line 963 of file lib3ds_file.c.
References assert, Lib3dsFile::cameras, Lib3dsFile::cameras_size, lib3ds_camera_free(), lib3ds_util_reserve_array(), and Lib3dsFile::ncameras.
Referenced by lib3ds_file_free().
LIB3DSAPI void lib3ds_file_reserve_lights | ( | Lib3dsFile * | file, |
int | size, | ||
int | force | ||
) |
Definition at line 999 of file lib3ds_file.c.
References assert, lib3ds_light_free(), lib3ds_util_reserve_array(), Lib3dsFile::lights, Lib3dsFile::lights_size, and Lib3dsFile::nlights.
Referenced by lib3ds_file_free().
LIB3DSAPI void lib3ds_file_reserve_materials | ( | Lib3dsFile * | file, |
int | size, | ||
int | force | ||
) |
Definition at line 927 of file lib3ds_file.c.
References assert, lib3ds_material_free(), lib3ds_util_reserve_array(), Lib3dsFile::materials, Lib3dsFile::materials_size, and Lib3dsFile::nmaterials.
Referenced by lib3ds_file_free().
LIB3DSAPI void lib3ds_file_reserve_meshes | ( | Lib3dsFile * | file, |
int | size, | ||
int | force | ||
) |
Definition at line 1035 of file lib3ds_file.c.
References assert, lib3ds_mesh_free(), lib3ds_util_reserve_array(), Lib3dsFile::meshes, Lib3dsFile::meshes_size, and Lib3dsFile::nmeshes.
Referenced by lib3ds_file_free().
LIB3DSAPI int lib3ds_file_save | ( | Lib3dsFile * | file, |
const char * | filename | ||
) |
Saves a .3DS file from memory to disk.
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. |
Definition at line 129 of file lib3ds_file.c.
References FALSE, fileio_read_func(), fileio_seek_func(), fileio_tell_func(), fileio_write_func(), lib3ds_file_write(), Lib3dsIo::log_func, memset, NULL, Lib3dsIo::read_func, Lib3dsIo::seek_func, Lib3dsIo::self, Lib3dsIo::tell_func, and Lib3dsIo::write_func.
LIB3DSAPI int lib3ds_file_write | ( | Lib3dsFile * | file, |
Lib3dsIo * | io | ||
) |
Write 3ds file data from a Lib3dsFile object to a file.
file | The Lib3dsFile object to be written. |
io | A Lib3dsIo object previously set up by the caller. |
Definition at line 892 of file lib3ds_file.c.
References CHK_M3D_VERSION, CHK_M3DMAGIC, Lib3dsChunk::chunk, FALSE, if(), Lib3dsIo::impl, Lib3dsIoImpl::jmpbuf, kfdata_write(), lib3ds_chunk_write(), lib3ds_chunk_write_end(), lib3ds_chunk_write_start(), lib3ds_io_cleanup(), lib3ds_io_setup(), lib3ds_io_write_dword(), mdata_write(), memset, Lib3dsFile::mesh_version, Lib3dsChunk::size, and TRUE.
Referenced by lib3ds_file_save().
LIB3DSAPI void lib3ds_light_free | ( | Lib3dsLight * | mesh | ) |
Definition at line 38 of file lib3ds_light.c.
Referenced by lib3ds_file_remove_light(), and lib3ds_file_reserve_lights().
LIB3DSAPI Lib3dsLight* lib3ds_light_new | ( | const char * | name | ) |
Definition at line 22 of file lib3ds_light.c.
References assert, calloc, light, and Lib3dsLight::name.
Referenced by named_object_read().
LIB3DSAPI void lib3ds_material_free | ( | Lib3dsMaterial * | material | ) |
Definition at line 79 of file lib3ds_material.c.
Referenced by lib3ds_file_remove_material(), and lib3ds_file_reserve_materials().
LIB3DSAPI Lib3dsMaterial* lib3ds_material_new | ( | const char * | name | ) |
Creates and returns a new, empty Lib3dsMaterial object.
Initial value of the material is a shiny grey.
Definition at line 39 of file lib3ds_material.c.
References Lib3dsMaterial::ambient, Lib3dsMaterial::bump_map, Lib3dsMaterial::bump_mask, calloc, Lib3dsMaterial::diffuse, initialize_texture_map(), Lib3dsMaterial::name, Lib3dsMaterial::opacity_map, Lib3dsMaterial::opacity_mask, Lib3dsMaterial::reflection_map, Lib3dsMaterial::reflection_mask, Lib3dsMaterial::self_illum_map, Lib3dsMaterial::self_illum_mask, Lib3dsMaterial::shading, Lib3dsMaterial::shininess, Lib3dsMaterial::shininess_map, Lib3dsMaterial::shininess_mask, Lib3dsMaterial::specular, Lib3dsMaterial::specular_map, Lib3dsMaterial::specular_mask, Lib3dsMaterial::texture1_map, Lib3dsMaterial::texture1_mask, Lib3dsMaterial::texture2_map, Lib3dsMaterial::texture2_mask, and Lib3dsMaterial::wire_size.
Referenced by mdata_read().
LIB3DSAPI 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.
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.
References i.
Referenced by track_eval_linear().
LIB3DSAPI 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.
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.
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.
matrix | Destination matrix. |
pos | Camera position |
tgt | Camera target |
roll | Roll angle |
Definition at line 423 of file lib3ds_matrix.c.
References lib3ds_matrix_identity(), lib3ds_matrix_mult(), lib3ds_matrix_rotate(), lib3ds_matrix_translate(), lib3ds_vector_cross(), lib3ds_vector_normalize(), and lib3ds_vector_sub().
Copy a matrix.
Definition at line 56 of file lib3ds_matrix.c.
References memcpy.
Referenced by file_bounding_box_of_nodes_impl(), lib3ds_file_bounding_box_of_nodes(), lib3ds_mesh_read(), lib3ds_node_eval(), and point_array_write().
LIB3DSAPI float lib3ds_matrix_det | ( | float | m[4][4] | ) |
Find determinant of a matrix.
Definition at line 191 of file lib3ds_matrix.c.
References det3x3().
Referenced by lib3ds_mesh_read(), and point_array_write().
Set a matrix to identity.
m | Matrix to be set. |
Definition at line 42 of file lib3ds_matrix.c.
Referenced by lib3ds_file_bounding_box_of_nodes(), lib3ds_matrix_camera(), lib3ds_mesh_new(), lib3ds_mesh_read(), lib3ds_node_eval(), and lib3ds_node_new().
Invert a matrix in place.
m | Matrix to invert. |
GGemsII, K.Wu, Fast Matrix Inversion
Definition at line 229 of file lib3ds_matrix.c.
References fabs(), FALSE, i, j, k, LIB3DS_EPSILON, and TRUE.
Referenced by file_bounding_box_of_nodes_impl(), lib3ds_mesh_read(), and point_array_write().
Multiplies a matrix by a second one (m = m * n).
Definition at line 132 of file lib3ds_matrix.c.
References i, j, k, and memcpy.
Referenced by file_bounding_box_of_nodes_impl(), lib3ds_matrix_camera(), lib3ds_matrix_rotate_quat(), lib3ds_mesh_read(), lib3ds_node_eval(), and point_array_write().
Negate a matrix – all elements negated.
Definition at line 65 of file lib3ds_matrix.c.
Apply a rotation about an arbitrary axis to a matrix.
Definition at line 400 of file lib3ds_matrix.c.
References lib3ds_matrix_rotate_quat(), lib3ds_quat_axis_angle(), and lib3ds_vector_make().
Referenced by lib3ds_matrix_camera().
Apply a rotation about an arbitrary axis to a matrix.
Definition at line 356 of file lib3ds_matrix.c.
References fabs(), LIB3DS_EPSILON, lib3ds_matrix_mult(), and R.
Referenced by lib3ds_matrix_rotate(), and lib3ds_node_eval().
Multiply a matrix by a scalar.
m | Matrix to be set. |
k | Scalar. |
Definition at line 155 of file lib3ds_matrix.c.
Apply scale factors to a matrix.
Definition at line 341 of file lib3ds_matrix.c.
References i.
Referenced by lib3ds_mesh_read(), lib3ds_node_eval(), and point_array_write().
Subtract two matrices.
m | Result. |
a | Addend. |
b | Minuend. |
Definition at line 117 of file lib3ds_matrix.c.
Apply a translation to a matrix.
Definition at line 328 of file lib3ds_matrix.c.
References i.
Referenced by file_bounding_box_of_nodes_impl(), lib3ds_matrix_camera(), and lib3ds_node_eval().
Clear a matrix to all zeros.
m | Matrix to be cleared. |
Definition at line 27 of file lib3ds_matrix.c.
LIB3DSAPI void lib3ds_mesh_bounding_box | ( | Lib3dsMesh * | mesh, |
float | bmin[3], | ||
float | bmax[3] | ||
) |
Find the bounding box of a mesh object.
mesh | The mesh object |
bmin | Returned bounding box |
bmax | Returned bounding box |
Definition at line 105 of file lib3ds_mesh.c.
References i, lib3ds_vector_max(), lib3ds_vector_min(), Lib3dsMesh::nvertices, and Lib3dsMesh::vertices.
Referenced by lib3ds_file_bounding_box_of_objects().
LIB3DSAPI void lib3ds_mesh_calculate_face_normals | ( | Lib3dsMesh * | mesh, |
float(*) | face_normals[3] | ||
) |
Definition at line 118 of file lib3ds_mesh.c.
References Lib3dsMesh::faces, i, Lib3dsFace::index, lib3ds_vector_normal(), Lib3dsMesh::nfaces, and Lib3dsMesh::vertices.
LIB3DSAPI 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.
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:
To access the normal of the i-th vertex of the j-th face do the following:
Definition at line 163 of file lib3ds_mesh.c.
References assert, calloc, Lib3dsMesh::faces, free, i, Lib3dsFace::index, j, lib3ds_vector_add(), lib3ds_vector_copy(), lib3ds_vector_cross(), lib3ds_vector_dot(), lib3ds_vector_length(), lib3ds_vector_normalize(), lib3ds_vector_scalar_mul(), lib3ds_vector_sub(), lib3ds_vector_zero(), malloc, Lib3dsMesh::nfaces, Lib3dsMesh::nvertices, Lib3dsFace::smoothing_group, and Lib3dsMesh::vertices.
LIB3DSAPI void lib3ds_mesh_free | ( | Lib3dsMesh * | mesh | ) |
Free a mesh object and all of its resources.
mesh | Mesh object to be freed. |
Definition at line 57 of file lib3ds_mesh.c.
References free, lib3ds_mesh_resize_faces(), lib3ds_mesh_resize_vertices(), and memset.
Referenced by lib3ds_file_remove_mesh(), and lib3ds_file_reserve_meshes().
LIB3DSAPI 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.
name | Mesh name. Must not be NULL. Must be < 64 characters. |
Definition at line 34 of file lib3ds_mesh.c.
References assert, calloc, LIB3DS_MAP_NONE, lib3ds_matrix_identity(), Lib3dsMesh::map_type, Lib3dsMesh::matrix, and Lib3dsMesh::name.
Referenced by named_object_read().
LIB3DSAPI void lib3ds_mesh_resize_faces | ( | Lib3dsMesh * | mesh, |
int | nfaces | ||
) |
Definition at line 86 of file lib3ds_mesh.c.
References assert, Lib3dsMesh::faces, i, lib3ds_util_realloc_array(), Lib3dsFace::material, and Lib3dsMesh::nfaces.
Referenced by face_array_read(), and lib3ds_mesh_free().
LIB3DSAPI void lib3ds_mesh_resize_vertices | ( | Lib3dsMesh * | mesh, |
int | nvertices, | ||
int | use_texcos, | ||
int | use_flags | ||
) |
Definition at line 66 of file lib3ds_mesh.c.
References assert, lib3ds_util_realloc_array(), Lib3dsMesh::nvertices, Lib3dsMesh::texcos, Lib3dsMesh::vertices, and Lib3dsMesh::vflags.
Referenced by lib3ds_mesh_free(), and lib3ds_mesh_read().
LIB3DSAPI Lib3dsNode* lib3ds_node_by_id | ( | Lib3dsNode * | node, |
uint16_t | node_id | ||
) |
Return a node object by id.
This function performs a recursive search for the specified node.
node | The parent node for the search |
node_id | The target node id. |
Definition at line 518 of file lib3ds_node.c.
References Lib3dsNode::childs, lib3ds_node_by_id(), Lib3dsNode::next, and Lib3dsNode::node_id.
Referenced by lib3ds_file_node_by_id(), and lib3ds_node_by_id().
LIB3DSAPI 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.
node | The parent node for the search |
name | The target node name. |
type | The target node type |
Definition at line 491 of file lib3ds_node.c.
References Lib3dsNode::childs, lib3ds_node_by_name(), Lib3dsNode::name, Lib3dsNode::next, and Lib3dsNode::type.
Referenced by lib3ds_file_node_by_name(), and lib3ds_node_by_name().
LIB3DSAPI 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.
node | Node to be evaluated. |
t | time value, between 0. and file->frames |
Definition at line 362 of file lib3ds_node.c.
References assert, Lib3dsNode::childs, Lib3dsAmbientColorNode::color, Lib3dsOmnilightNode::color, Lib3dsSpotlightNode::color, Lib3dsAmbientColorNode::color_track, Lib3dsOmnilightNode::color_track, Lib3dsSpotlightNode::color_track, Lib3dsSpotlightNode::falloff, Lib3dsSpotlightNode::falloff_track, Lib3dsCameraNode::fov, Lib3dsCameraNode::fov_track, Lib3dsMeshInstanceNode::hide, Lib3dsMeshInstanceNode::hide_track, Lib3dsSpotlightNode::hotspot, Lib3dsSpotlightNode::hotspot_track, lib3ds_matrix_copy(), lib3ds_matrix_identity(), lib3ds_matrix_mult(), lib3ds_matrix_rotate_quat(), lib3ds_matrix_scale(), lib3ds_matrix_translate(), LIB3DS_NODE_AMBIENT_COLOR, LIB3DS_NODE_CAMERA, LIB3DS_NODE_CAMERA_TARGET, lib3ds_node_eval(), LIB3DS_NODE_MESH_INSTANCE, LIB3DS_NODE_OMNILIGHT, LIB3DS_NODE_SPOTLIGHT, LIB3DS_NODE_SPOTLIGHT_TARGET, lib3ds_track_eval_bool(), lib3ds_track_eval_float(), lib3ds_track_eval_quat(), lib3ds_track_eval_vector(), Lib3dsNode::matrix, Lib3dsNode::next, Lib3dsTrack::nkeys, Lib3dsNode::parent, Lib3dsMeshInstanceNode::pos, Lib3dsCameraNode::pos, Lib3dsTargetNode::pos, Lib3dsOmnilightNode::pos, Lib3dsSpotlightNode::pos, Lib3dsMeshInstanceNode::pos_track, Lib3dsCameraNode::pos_track, Lib3dsTargetNode::pos_track, Lib3dsOmnilightNode::pos_track, Lib3dsSpotlightNode::pos_track, Lib3dsCameraNode::roll, Lib3dsSpotlightNode::roll, Lib3dsCameraNode::roll_track, Lib3dsSpotlightNode::roll_track, Lib3dsMeshInstanceNode::rot, Lib3dsMeshInstanceNode::rot_track, Lib3dsMeshInstanceNode::scl, Lib3dsMeshInstanceNode::scl_track, and Lib3dsNode::type.
Referenced by lib3ds_file_eval(), and lib3ds_node_eval().
LIB3DSAPI void lib3ds_node_free | ( | Lib3dsNode * | node | ) |
Free a node and all of its resources.
node | Lib3dsNode object to be freed. |
Definition at line 346 of file lib3ds_node.c.
References assert, and free_node_and_childs().
Referenced by lib3ds_file_free(), and lib3ds_io_cleanup().
LIB3DSAPI 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.
Definition at line 30 of file lib3ds_node.c.
References assert, calloc, Lib3dsAmbientColorNode::color_track, Lib3dsOmnilightNode::color_track, Lib3dsSpotlightNode::color_track, Lib3dsSpotlightNode::falloff_track, Lib3dsCameraNode::fov_track, Lib3dsMeshInstanceNode::hide_track, Lib3dsSpotlightNode::hotspot_track, lib3ds_matrix_identity(), LIB3DS_NODE_AMBIENT_COLOR, LIB3DS_NODE_CAMERA, LIB3DS_NODE_CAMERA_TARGET, LIB3DS_NODE_MESH_INSTANCE, LIB3DS_NODE_OMNILIGHT, LIB3DS_NODE_SPOTLIGHT, LIB3DS_NODE_SPOTLIGHT_TARGET, LIB3DS_TRACK_BOOL, LIB3DS_TRACK_FLOAT, LIB3DS_TRACK_QUAT, LIB3DS_TRACK_VECTOR, Lib3dsNode::matrix, Lib3dsNode::name, Lib3dsNode::node_id, NULL, Lib3dsMeshInstanceNode::pos_track, Lib3dsCameraNode::pos_track, Lib3dsTargetNode::pos_track, Lib3dsOmnilightNode::pos_track, Lib3dsSpotlightNode::pos_track, Lib3dsCameraNode::roll_track, Lib3dsSpotlightNode::roll_track, Lib3dsMeshInstanceNode::rot_track, Lib3dsMeshInstanceNode::scl_track, Lib3dsNode::type, Lib3dsTrack::type, and Lib3dsNode::user_id.
Referenced by kfdata_read(), lib3ds_file_create_nodes_for_meshes(), lib3ds_node_new_ambient_color(), lib3ds_node_new_camera(), lib3ds_node_new_camera_target(), lib3ds_node_new_mesh_instance(), lib3ds_node_new_omnilight(), lib3ds_node_new_spotligf_target(), and lib3ds_node_new_spotlight().
LIB3DSAPI Lib3dsAmbientColorNode* lib3ds_node_new_ambient_color | ( | float | color0[3] | ) |
Definition at line 108 of file lib3ds_node.c.
References Lib3dsAmbientColorNode::color_track, Lib3dsTrack::keys, LIB3DS_NODE_AMBIENT_COLOR, lib3ds_node_new(), lib3ds_track_resize(), lib3ds_vector_copy(), lib3ds_vector_zero(), and Lib3dsKey::value.
LIB3DSAPI Lib3dsCameraNode* lib3ds_node_new_camera | ( | Lib3dsCamera * | camera | ) |
Definition at line 168 of file lib3ds_node.c.
References assert, Lib3dsCamera::fov, Lib3dsCameraNode::fov_track, Lib3dsTrack::keys, LIB3DS_NODE_CAMERA, lib3ds_node_new(), lib3ds_track_resize(), lib3ds_vector_copy(), Lib3dsCamera::name, Lib3dsNode::name, Lib3dsCameraNode::pos_track, Lib3dsCamera::position, Lib3dsCamera::roll, Lib3dsCameraNode::roll_track, and Lib3dsKey::value.
LIB3DSAPI Lib3dsTargetNode* lib3ds_node_new_camera_target | ( | Lib3dsCamera * | camera | ) |
Definition at line 191 of file lib3ds_node.c.
References assert, Lib3dsTrack::keys, LIB3DS_NODE_CAMERA_TARGET, lib3ds_node_new(), lib3ds_track_resize(), lib3ds_vector_copy(), Lib3dsCamera::name, Lib3dsNode::name, Lib3dsTargetNode::pos_track, Lib3dsCamera::target, and Lib3dsKey::value.
LIB3DSAPI Lib3dsMeshInstanceNode* lib3ds_node_new_mesh_instance | ( | Lib3dsMesh * | mesh, |
const char * | instance_name, | ||
float | pos0[3], | ||
float | scl0[3], | ||
float | rot0[4] | ||
) |
Definition at line 127 of file lib3ds_node.c.
References i, Lib3dsMeshInstanceNode::instance_name, Lib3dsTrack::keys, LIB3DS_NODE_MESH_INSTANCE, lib3ds_node_new(), lib3ds_track_resize(), lib3ds_vector_copy(), lib3ds_vector_make(), Lib3dsMesh::name, Lib3dsNode::name, Lib3dsMeshInstanceNode::pos_track, Lib3dsMeshInstanceNode::rot_track, Lib3dsMeshInstanceNode::scl_track, and Lib3dsKey::value.
LIB3DSAPI Lib3dsOmnilightNode* lib3ds_node_new_omnilight | ( | Lib3dsLight * | light | ) |
Definition at line 208 of file lib3ds_node.c.
References assert, Lib3dsLight::color, Lib3dsOmnilightNode::color_track, Lib3dsTrack::keys, lib3ds_node_new(), LIB3DS_NODE_OMNILIGHT, lib3ds_track_resize(), lib3ds_vector_copy(), Lib3dsLight::name, Lib3dsNode::name, Lib3dsOmnilightNode::pos_track, Lib3dsLight::position, and Lib3dsKey::value.
LIB3DSAPI Lib3dsSpotlightNode* lib3ds_node_new_spotlight | ( | Lib3dsLight * | light | ) |
Definition at line 228 of file lib3ds_node.c.
References assert, Lib3dsLight::color, Lib3dsSpotlightNode::color_track, Lib3dsLight::falloff, Lib3dsSpotlightNode::falloff_track, Lib3dsLight::hotspot, Lib3dsSpotlightNode::hotspot_track, Lib3dsTrack::keys, lib3ds_node_new(), LIB3DS_NODE_SPOTLIGHT, lib3ds_track_resize(), lib3ds_vector_copy(), Lib3dsLight::name, Lib3dsNode::name, Lib3dsSpotlightNode::pos_track, Lib3dsLight::position, Lib3dsLight::roll, Lib3dsSpotlightNode::roll_track, and Lib3dsKey::value.
LIB3DSAPI Lib3dsTargetNode* lib3ds_node_new_spotlight_target | ( | Lib3dsLight * | light | ) |
Compute a quaternion from axis and angle.
c | Computed quaternion |
axis | Rotation axis |
angle | Angle of rotation, radians. |
Definition at line 51 of file lib3ds_quat.c.
References cos(), LIB3DS_EPSILON, and sin().
Referenced by lib3ds_matrix_rotate(), lib3ds_track_eval_quat(), quat_for_index(), rot_key_setup(), and setup_segment().
Copy a quaternion.
Definition at line 35 of file lib3ds_quat.c.
References i.
Referenced by lib3ds_quat_ln_dif(), lib3ds_quat_mul(), and rot_key_setup().
LIB3DSAPI float lib3ds_quat_dot | ( | float | a[4], |
float | b[4] | ||
) |
Compute the dot-product of a quaternion.
Definition at line 170 of file lib3ds_quat.c.
Referenced by rot_key_setup().
Definition at line 214 of file lib3ds_quat.c.
References cos(), fabs(), i, LIB3DS_EPSILON, and sin().
Referenced by lib3ds_quat_tangent(), and rot_key_setup().
Set a quaternion to Identity
Definition at line 25 of file lib3ds_quat.c.
Referenced by lib3ds_track_eval_quat(), quat_for_index(), and setup_segment().
Compute the inverse of a quaternion.
Definition at line 149 of file lib3ds_quat.c.
References fabs(), LIB3DS_EPSILON, and m.
Referenced by lib3ds_quat_ln_dif().
Definition at line 182 of file lib3ds_quat.c.
References fabs(), i, and LIB3DS_EPSILON.
Referenced by lib3ds_quat_ln_dif(), and rot_key_setup().
Definition at line 203 of file lib3ds_quat.c.
References lib3ds_quat_copy(), lib3ds_quat_inv(), lib3ds_quat_ln(), and lib3ds_quat_mul().
Referenced by lib3ds_quat_tangent(), and rot_key_setup().
Multiply two quaternions.
c | Result |
a,b | Inputs |
Definition at line 101 of file lib3ds_quat.c.
References lib3ds_quat_copy().
Referenced by lib3ds_quat_ln_dif(), lib3ds_quat_tangent(), quat_for_index(), rot_key_setup(), and setup_segment().
Negate a quaternion
Definition at line 74 of file lib3ds_quat.c.
References i.
Referenced by rot_key_setup().
LIB3DSAPI float lib3ds_quat_norm | ( | float | c[4] | ) |
Definition at line 176 of file lib3ds_quat.c.
Normalize a quaternion.
Definition at line 128 of file lib3ds_quat.c.
References fabs(), i, LIB3DS_EPSILON, and m.
Multiply a quaternion by a scalar.
Definition at line 116 of file lib3ds_quat.c.
Definition at line 234 of file lib3ds_quat.c.
References fabs(), i, LIB3DS_EPSILON, and sin().
Referenced by lib3ds_quat_squad().
LIB3DSAPI void lib3ds_quat_squad | ( | float | c[4], |
float | a[4], | ||
float | p[4], | ||
float | q[4], | ||
float | b[4], | ||
float | t | ||
) |
Definition at line 264 of file lib3ds_quat.c.
References lib3ds_quat_slerp().
Referenced by lib3ds_track_eval_quat().
Definition at line 275 of file lib3ds_quat.c.
References i, lib3ds_quat_exp(), lib3ds_quat_ln_dif(), and lib3ds_quat_mul().
LIB3DSAPI void lib3ds_track_eval_bool | ( | Lib3dsTrack * | track, |
int * | b, | ||
float | t | ||
) |
Definition at line 277 of file lib3ds_track.c.
References assert, FALSE, find_index(), LIB3DS_TRACK_BOOL, Lib3dsTrack::nkeys, Lib3dsTrack::type, and u.
Referenced by lib3ds_node_eval().
LIB3DSAPI void lib3ds_track_eval_float | ( | Lib3dsTrack * | track, |
float * | f, | ||
float | t | ||
) |
Definition at line 347 of file lib3ds_track.c.
References assert, LIB3DS_TRACK_FLOAT, track_eval_linear(), and Lib3dsTrack::type.
Referenced by lib3ds_node_eval().
LIB3DSAPI void lib3ds_track_eval_quat | ( | Lib3dsTrack * | track, |
float | q[4], | ||
float | t | ||
) |
Definition at line 367 of file lib3ds_track.c.
References assert, bp, find_index(), Lib3dsKey::frame, Lib3dsTrack::keys, lib3ds_quat_axis_angle(), lib3ds_quat_identity(), lib3ds_quat_squad(), LIB3DS_TRACK_QUAT, Lib3dsTrack::nkeys, NULL, pp, quat_for_index(), rot_key_setup(), setup_segment(), Lib3dsTrack::type, u, and Lib3dsKey::value.
Referenced by lib3ds_node_eval().
LIB3DSAPI void lib3ds_track_eval_vector | ( | Lib3dsTrack * | track, |
float | v[3], | ||
float | t | ||
) |
Definition at line 357 of file lib3ds_track.c.
References assert, LIB3DS_TRACK_VECTOR, lib3ds_vector_zero(), track_eval_linear(), and Lib3dsTrack::type.
Referenced by lib3ds_node_eval().
LIB3DSAPI void lib3ds_track_free | ( | Lib3dsTrack * | track | ) |
Definition at line 31 of file lib3ds_track.c.
References assert, free, lib3ds_track_resize(), and memset.
LIB3DSAPI Lib3dsTrack* lib3ds_track_new | ( | Lib3dsTrackType | type, |
int | nkeys | ||
) |
Definition at line 22 of file lib3ds_track.c.
References calloc, lib3ds_track_resize(), and Lib3dsTrack::type.
LIB3DSAPI void lib3ds_track_resize | ( | Lib3dsTrack * | track, |
int | nkeys | ||
) |
Definition at line 40 of file lib3ds_track.c.
References assert, Lib3dsTrack::keys, memset, Lib3dsTrack::nkeys, and realloc.
Referenced by free_node_and_childs(), lib3ds_node_new_ambient_color(), lib3ds_node_new_camera(), lib3ds_node_new_camera_target(), lib3ds_node_new_mesh_instance(), lib3ds_node_new_omnilight(), lib3ds_node_new_spotligf_target(), lib3ds_node_new_spotlight(), lib3ds_track_free(), lib3ds_track_new(), and lib3ds_track_read().
Add two vectors.
c | Result. |
a | First addend. |
b | Second addend. |
Definition at line 55 of file lib3ds_vector.c.
References i.
Referenced by lib3ds_mesh_calculate_vertex_normals().
Copies all components of a vector to another vector.
dst | [out] The destination vector. |
src | [in] The source vector. |
Definition at line 39 of file lib3ds_vector.c.
References i.
Referenced by lib3ds_mesh_calculate_vertex_normals(), lib3ds_mesh_read(), lib3ds_node_new_ambient_color(), lib3ds_node_new_camera(), lib3ds_node_new_camera_target(), lib3ds_node_new_mesh_instance(), lib3ds_node_new_omnilight(), lib3ds_node_new_spotligf_target(), and lib3ds_node_new_spotlight().
Compute cross product.
c | Result. |
a | First vector. |
b | Second vector. |
Definition at line 102 of file lib3ds_vector.c.
Referenced by lib3ds_matrix_camera(), lib3ds_mesh_calculate_vertex_normals(), and lib3ds_vector_normal().
LIB3DSAPI float lib3ds_vector_dot | ( | float | a[3], |
float | b[3] | ||
) |
Compute dot product.
a | First vector. |
b | Second vector. |
Definition at line 118 of file lib3ds_vector.c.
Referenced by lib3ds_mesh_calculate_vertex_normals().
LIB3DSAPI float lib3ds_vector_length | ( | float | c[3] | ) |
Compute length of vector.
Computes |c| = sqrt(x*x + y*y + z*z)
c | Vector to compute. |
Definition at line 133 of file lib3ds_vector.c.
Referenced by lib3ds_mesh_calculate_vertex_normals().
Definition at line 22 of file lib3ds_vector.c.
Referenced by lib3ds_matrix_rotate(), and lib3ds_node_new_mesh_instance().
c[i] = max(c[i], a[i]);
Computes maximum values of x,y,z independently.
Definition at line 232 of file lib3ds_vector.c.
References i.
Referenced by file_bounding_box_of_nodes_impl(), lib3ds_file_bounding_box_of_objects(), and lib3ds_mesh_bounding_box().
c[i] = min(c[i], a[i]);
Computes minimum values of x,y,z independently.
Definition at line 216 of file lib3ds_vector.c.
References i.
Referenced by file_bounding_box_of_nodes_impl(), lib3ds_file_bounding_box_of_objects(), and lib3ds_mesh_bounding_box().
Negates all components of a vector.
c | The Pointer to the vector. |
Compute a vector normal to two line segments.
Computes the normal vector to the lines b-a and b-c.
n | Returned normal vector. |
a | Endpoint of first line. |
b | Base point of both lines. |
c | Endpoint of second line. |
Definition at line 182 of file lib3ds_vector.c.
References lib3ds_vector_cross(), lib3ds_vector_normalize(), and lib3ds_vector_sub().
Referenced by lib3ds_mesh_calculate_face_normals().
Normalize a vector.
Scales a vector so that its length is 1.0.
c | Vector to normalize. |
Definition at line 146 of file lib3ds_vector.c.
References fabs(), LIB3DS_EPSILON, and m.
Referenced by lib3ds_matrix_camera(), lib3ds_mesh_calculate_vertex_normals(), and lib3ds_vector_normal().
Multiply a vector by a scalar.
c | Vector to be multiplied. |
k | Scalar. |
Definition at line 86 of file lib3ds_vector.c.
Referenced by lib3ds_mesh_calculate_vertex_normals().
Subtract two vectors.
c | Result. |
a | Addend. |
b | Minuend. |
Definition at line 71 of file lib3ds_vector.c.
References i.
Referenced by lib3ds_matrix_camera(), lib3ds_mesh_calculate_vertex_normals(), and lib3ds_vector_normal().
Multiply a point by a transformation matrix.
Applies the given transformation matrix to the given point. With some transformation matrices, a vector may also be transformed.
c | Result. |
m | Transformation matrix. |
a | Input point. |
Definition at line 203 of file lib3ds_vector.c.
Referenced by file_bounding_box_of_nodes_impl(), lib3ds_mesh_read(), and point_array_write().
Sets all components of a vector to zero.
c | The Pointer to the vector. |
Definition at line 30 of file lib3ds_vector.c.
References i.
Referenced by file_bounding_box_of_nodes_impl(), lib3ds_mesh_calculate_vertex_normals(), lib3ds_node_new_ambient_color(), and lib3ds_track_eval_vector().