GPAC
Open Source Multimedia Framework. For more information, check out http://gpac.wp.mines-telecom.fr
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups
mesh.c File Reference
#include <gpac/internal/mesh.h>
#include <gpac/nodes_mpeg4.h>
#include <gpac/nodes_x3d.h>
#include <gpac/color.h>
#include "gl_inc.h"
+ Include dependency graph for mesh.c:

Data Structures

struct  face_info
 
struct  pt_info
 
struct  SCP
 
struct  SCPInfo
 

Macros

#define HIGH_SPEED_RATIO   2
 
#define MESH_CHECK_VERTEX(m)
 
#define MESH_CHECK_IDX(m)
 
#define CYLINDER_SUBDIV   24
 
#define CONE_SUBDIV   24
 
#define SPHERE_SUBDIV   12
 
#define ELLIPSE_SUBDIV   32
 
#define COL_TO_RGBA(res, col)   { res.red = col.red; res.green = col.green; res.blue = col.blue; res.alpha = FIX_ONE; }
 
#define MESH_GET_COL(thecol, index)
 
#define GET_IDX(idx, array)
 
#define REGISTER_POINT_FACE(FACE_IDX)
 
#define NEAR_ZERO(__x)   (ABS(__x)<=FIX_EPSILON)
 

Functions

static void del_aabb_node (AABBNode *node)
 
void mesh_reset (GF_Mesh *mesh)
 
void mesh_free (GF_Mesh *mesh)
 
GF_Meshnew_mesh ()
 
static void mesh_fit_alloc (GF_Mesh *m)
 
void mesh_update_bounds (GF_Mesh *mesh)
 
void mesh_clone (GF_Mesh *dest, GF_Mesh *orig)
 
static GF_Vertex set_vertex (Fixed x, Fixed y, Fixed z, Fixed nx, Fixed ny, Fixed nz, Fixed u, Fixed v)
 
void mesh_set_vertex (GF_Mesh *mesh, Fixed x, Fixed y, Fixed z, Fixed nx, Fixed ny, Fixed nz, Fixed u, Fixed v)
 
void mesh_set_vertex_v (GF_Mesh *mesh, SFVec3f pt, SFVec3f nor, SFVec2f tx, SFColorRGBA col)
 
void mesh_set_vertex_vx (GF_Mesh *mesh, GF_Vertex *vx)
 
void mesh_set_point (GF_Mesh *mesh, Fixed x, Fixed y, Fixed z, SFColorRGBA col)
 
void mesh_set_index (GF_Mesh *mesh, u32 idx)
 
void mesh_set_triangle (GF_Mesh *mesh, u32 v1_idx, u32 v2_idx, u32 v3_idx)
 
void mesh_set_line (GF_Mesh *mesh, u32 v1_idx, u32 v2_idx)
 
void mesh_recompute_normals (GF_Mesh *mesh)
 
void mesh_generate_tex_coords (GF_Mesh *mesh, GF_Node *__texCoords)
 
void mesh_new_box (GF_Mesh *mesh, SFVec3f size)
 
void mesh_new_unit_bbox (GF_Mesh *mesh)
 
static void compute_cylinder (Fixed height, Fixed radius, s32 numFacets, SFVec3f *coords, SFVec2f *texcoords)
 
void mesh_new_cylinder (GF_Mesh *mesh, Fixed height, Fixed radius, Bool bottom, Bool side, Bool top, Bool low_res)
 
void mesh_new_cone (GF_Mesh *mesh, Fixed height, Fixed radius, Bool bottom, Bool side, Bool low_res)
 
void compute_sphere (Fixed radius, SFVec3f *coords, SFVec2f *texcoords, u32 num_steps)
 
void mesh_new_sphere (GF_Mesh *mesh, Fixed radius, Bool low_res)
 
void mesh_new_rectangle (GF_Mesh *mesh, SFVec2f size, SFVec2f *orig, Bool flip)
 
void mesh_new_ellipse (GF_Mesh *mesh, Fixed a_dia, Fixed b_dia, Bool low_res)
 
void mesh_from_path_intern (GF_Mesh *mesh, GF_Path *path, Bool make_ccw)
 
void mesh_from_path (GF_Mesh *mesh, GF_Path *path)
 
void mesh_get_outline (GF_Mesh *mesh, GF_Path *path)
 
void mesh_new_ils (GF_Mesh *mesh, GF_Node *__coord, MFInt32 *coordIndex, GF_Node *__color, MFInt32 *colorIndex, Bool colorPerVertex, Bool do_close)
 
void mesh_new_ps (GF_Mesh *mesh, GF_Node *__coord, GF_Node *__color)
 
void register_point_in_face (struct face_info *fi, u32 pt_index)
 
void register_face_in_point (struct pt_info *pi, u32 face_index)
 
static SFVec3f smooth_face_normals (struct pt_info *pts, u32 nb_pts, struct face_info *faces, u32 nb_faces, u32 pt_idx_in_face, u32 face_idx, Fixed creaseAngleCos)
 
void mesh_new_ifs_intern (GF_Mesh *mesh, GF_Node *__coord, MFInt32 *coordIndex, GF_Node *__color, MFInt32 *colorIndex, Bool colorPerVertex, GF_Node *__normal, MFInt32 *normalIndex, Bool normalPerVertex, GF_Node *__texCoords, MFInt32 *texCoordIndex, Fixed creaseAngle)
 
void mesh_new_ifs2d (GF_Mesh *mesh, GF_Node *node)
 
void mesh_new_ifs (GF_Mesh *mesh, GF_Node *node)
 
void mesh_new_elevation_grid (GF_Mesh *mesh, GF_Node *node)
 
static void mesh_extrude_path_intern (GF_Mesh *mesh, GF_Path *path, MFVec3f *thespine, Fixed creaseAngle, Fixed min_cx, Fixed min_cy, Fixed width_cx, Fixed width_cy, Bool begin_cap, Bool end_cap, MFRotation *spine_ori, MFVec2f *spine_scale, Bool tx_along_spine)
 
void mesh_extrude_path_ext (GF_Mesh *mesh, GF_Path *path, MFVec3f *thespine, Fixed creaseAngle, Fixed min_cx, Fixed min_cy, Fixed width_cx, Fixed width_cy, Bool begin_cap, Bool end_cap, MFRotation *spine_ori, MFVec2f *spine_scale, Bool tx_along_spine)
 
void mesh_extrude_path (GF_Mesh *mesh, GF_Path *path, MFVec3f *thespine, Fixed creaseAngle, Bool begin_cap, Bool end_cap, MFRotation *spine_ori, MFVec2f *spine_scale, Bool tx_along_spine)
 
void mesh_new_extrusion (GF_Mesh *mesh, GF_Node *node)
 

Data Structure Documentation

struct face_info
+ Collaboration diagram for face_info:
Data Fields
SFVec3f nor
u32 idx_alloc
u32 idx_count
u32 * idx
struct pt_info
+ Collaboration diagram for pt_info:
Data Fields
u32 face_alloc
u32 face_count
u32 * faces
struct SCP
+ Collaboration diagram for SCP:
Data Fields
SFVec3f yaxis
SFVec3f zaxis
SFVec3f xaxis
struct SCPInfo
+ Collaboration diagram for SCPInfo:
Data Fields
SFVec3f pt
SFVec3f yaxis
SFVec3f zaxis
SFVec3f xaxis
u32 max_idx

Macro Definition Documentation

#define HIGH_SPEED_RATIO   2
#define MESH_CHECK_VERTEX (   m)
Value:
if (m->v_count == m->v_alloc) { \
m->v_alloc *= 2; \
m->vertices = (GF_Vertex *)gf_realloc(m->vertices, sizeof(GF_Vertex)*m->v_alloc); \
} \
void * gf_realloc(void *ptr, size_t size)
Definition: alloc.c:159
Definition: mesh.h:73
#define MESH_CHECK_IDX (   m)
Value:
if (m->i_count == m->i_alloc) { \
m->i_alloc *= 2; \
m->indices = (IDX_TYPE*)gf_realloc(m->indices, sizeof(IDX_TYPE)*m->i_alloc); \
} \
void * gf_realloc(void *ptr, size_t size)
Definition: alloc.c:159
#define IDX_TYPE
Definition: mesh.h:140
#define CYLINDER_SUBDIV   24
#define CONE_SUBDIV   24
#define SPHERE_SUBDIV   12
#define ELLIPSE_SUBDIV   32
#define COL_TO_RGBA (   res,
  col 
)    { res.red = col.red; res.green = col.green; res.blue = col.blue; res.alpha = FIX_ONE; }
#define MESH_GET_COL (   thecol,
  index 
)
Value:
{\
if (colorRGB && ((u32) index < colorRGB->color.count) ) COL_TO_RGBA(thecol, colorRGB->color.vals[index]) \
else if (colorRGBA && (u32) index < colorRGBA->color.count) thecol = colorRGBA->color.vals[index]; \
} \
uint32_t u32
Definition: setup.h:246
#define COL_TO_RGBA(res, col)
Definition: mesh.c:789
#define GET_IDX (   idx,
  array 
)
Value:
if (idx<array->count && (array->vals[idx]>=0) ) index = array->vals[idx]; \
else if (idx<c_count) index = idx; \
else index = 0; \
#define REGISTER_POINT_FACE (   FACE_IDX)
Value:
{ u32 fidx; \
fidx = FACE_IDX; \
mesh_set_vertex_vx(faces[fidx], &vx); \
if (smooth_normals) { \
register_point_in_face(&faces_info[fidx], pidx); \
register_face_in_point(&pts_info[pidx], fidx); \
} \
} \
void register_face_in_point(struct pt_info *pi, u32 face_index)
Definition: mesh.c:1016
void mesh_set_vertex_vx(GF_Mesh *mesh, GF_Vertex *vx)
Definition: mesh.c:206
void register_point_in_face(struct face_info *fi, u32 pt_index)
Definition: mesh.c:1006
uint32_t u32
Definition: setup.h:246
#define NEAR_ZERO (   __x)    (ABS(__x)<=FIX_EPSILON)

Function Documentation

static void del_aabb_node ( AABBNode node)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_reset ( GF_Mesh mesh)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_free ( GF_Mesh mesh)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GF_Mesh* new_mesh ( )

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void mesh_fit_alloc ( GF_Mesh m)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_update_bounds ( GF_Mesh mesh)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_clone ( GF_Mesh dest,
GF_Mesh orig 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_Vertex set_vertex ( Fixed  x,
Fixed  y,
Fixed  z,
Fixed  nx,
Fixed  ny,
Fixed  nz,
Fixed  u,
Fixed  v 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_set_vertex ( GF_Mesh mesh,
Fixed  x,
Fixed  y,
Fixed  z,
Fixed  nx,
Fixed  ny,
Fixed  nz,
Fixed  u,
Fixed  v 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_set_vertex_v ( GF_Mesh mesh,
SFVec3f  pt,
SFVec3f  nor,
SFVec2f  tx,
SFColorRGBA  col 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_set_vertex_vx ( GF_Mesh mesh,
GF_Vertex vx 
)

+ Here is the caller graph for this function:

void mesh_set_point ( GF_Mesh mesh,
Fixed  x,
Fixed  y,
Fixed  z,
SFColorRGBA  col 
)

+ Here is the caller graph for this function:

void mesh_set_index ( GF_Mesh mesh,
u32  idx 
)

+ Here is the caller graph for this function:

void mesh_set_triangle ( GF_Mesh mesh,
u32  v1_idx,
u32  v2_idx,
u32  v3_idx 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_set_line ( GF_Mesh mesh,
u32  v1_idx,
u32  v2_idx 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_recompute_normals ( GF_Mesh mesh)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_generate_tex_coords ( GF_Mesh mesh,
GF_Node __texCoords 
)

+ Here is the caller graph for this function:

void mesh_new_box ( GF_Mesh mesh,
SFVec3f  size 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_new_unit_bbox ( GF_Mesh mesh)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void compute_cylinder ( Fixed  height,
Fixed  radius,
s32  numFacets,
SFVec3f coords,
SFVec2f texcoords 
)
static

+ Here is the caller graph for this function:

void mesh_new_cylinder ( GF_Mesh mesh,
Fixed  height,
Fixed  radius,
Bool  bottom,
Bool  side,
Bool  top,
Bool  low_res 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_new_cone ( GF_Mesh mesh,
Fixed  height,
Fixed  radius,
Bool  bottom,
Bool  side,
Bool  low_res 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void compute_sphere ( Fixed  radius,
SFVec3f coords,
SFVec2f texcoords,
u32  num_steps 
)

+ Here is the caller graph for this function:

void mesh_new_sphere ( GF_Mesh mesh,
Fixed  radius,
Bool  low_res 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_new_rectangle ( GF_Mesh mesh,
SFVec2f  size,
SFVec2f orig,
Bool  flip 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_new_ellipse ( GF_Mesh mesh,
Fixed  a_dia,
Fixed  b_dia,
Bool  low_res 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_from_path_intern ( GF_Mesh mesh,
GF_Path path,
Bool  make_ccw 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_from_path ( GF_Mesh mesh,
GF_Path path 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_get_outline ( GF_Mesh mesh,
GF_Path path 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_new_ils ( GF_Mesh mesh,
GF_Node __coord,
MFInt32 coordIndex,
GF_Node __color,
MFInt32 colorIndex,
Bool  colorPerVertex,
Bool  do_close 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_new_ps ( GF_Mesh mesh,
GF_Node __coord,
GF_Node __color 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void register_point_in_face ( struct face_info fi,
u32  pt_index 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void register_face_in_point ( struct pt_info pi,
u32  face_index 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static SFVec3f smooth_face_normals ( struct pt_info pts,
u32  nb_pts,
struct face_info faces,
u32  nb_faces,
u32  pt_idx_in_face,
u32  face_idx,
Fixed  creaseAngleCos 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_new_ifs_intern ( GF_Mesh mesh,
GF_Node __coord,
MFInt32 coordIndex,
GF_Node __color,
MFInt32 colorIndex,
Bool  colorPerVertex,
GF_Node __normal,
MFInt32 normalIndex,
Bool  normalPerVertex,
GF_Node __texCoords,
MFInt32 texCoordIndex,
Fixed  creaseAngle 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_new_ifs2d ( GF_Mesh mesh,
GF_Node node 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_new_ifs ( GF_Mesh mesh,
GF_Node node 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_new_elevation_grid ( GF_Mesh mesh,
GF_Node node 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void mesh_extrude_path_intern ( GF_Mesh mesh,
GF_Path path,
MFVec3f thespine,
Fixed  creaseAngle,
Fixed  min_cx,
Fixed  min_cy,
Fixed  width_cx,
Fixed  width_cy,
Bool  begin_cap,
Bool  end_cap,
MFRotation spine_ori,
MFVec2f spine_scale,
Bool  tx_along_spine 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_extrude_path_ext ( GF_Mesh mesh,
GF_Path path,
MFVec3f thespine,
Fixed  creaseAngle,
Fixed  min_cx,
Fixed  min_cy,
Fixed  width_cx,
Fixed  width_cy,
Bool  begin_cap,
Bool  end_cap,
MFRotation spine_ori,
MFVec2f spine_scale,
Bool  tx_along_spine 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_extrude_path ( GF_Mesh mesh,
GF_Path path,
MFVec3f thespine,
Fixed  creaseAngle,
Bool  begin_cap,
Bool  end_cap,
MFRotation spine_ori,
MFVec2f spine_scale,
Bool  tx_along_spine 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mesh_new_extrusion ( GF_Mesh mesh,
GF_Node node 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: