libgpac
Documentation of the core library of GPAC
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 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

void compositor_get_srdmap_size (const GF_PropertyValue *srd_map, u32 *width, u32 *height, u32 *min_x, u32 *min_y)
 
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 GFINLINE 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, GF_MeshSphereAngles *sphere_angles)
 
void mesh_new_sphere (GF_Mesh *mesh, Fixed radius, Bool low_res, GF_MeshSphereAngles *sphere_angles)
 
void mesh_new_spherical_srd (GF_Mesh *mesh, Fixed radius, const GF_PropertyValue *srd_map, const GF_PropertyValue *srd_ref)
 
void mesh_new_rectangle_ex (GF_Mesh *mesh, SFVec2f size, SFVec2f *orig, u32 flip, u32 rotate)
 
void mesh_new_rectangle (GF_Mesh *mesh, SFVec2f size, SFVec2f *orig, Bool flip)
 
void mesh_new_planar_srd (GF_Mesh *mesh, SFVec2f size, u32 flip, u32 rotate, const GF_PropertyValue *srd_map, const GF_PropertyValue *srd_ref)
 
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 GFINLINE 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

◆ face_info

struct face_info
Data Fields
SFVec3f nor
u32 idx_alloc
u32 idx_count
u32 * idx

◆ pt_info

struct pt_info
Data Fields
u32 face_alloc
u32 face_count
u32 * faces

◆ SCP

struct SCP
Data Fields
SFVec3f yaxis
SFVec3f zaxis
SFVec3f xaxis

◆ SCPInfo

struct SCPInfo
Data Fields
SFVec3f pt
SFVec3f yaxis
SFVec3f zaxis
SFVec3f xaxis
u32 max_idx

Macro Definition Documentation

◆ HIGH_SPEED_RATIO

#define HIGH_SPEED_RATIO   2

◆ MESH_CHECK_VERTEX

#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:158
Definition: mesh.h:75

◆ MESH_CHECK_IDX

#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); \
} \
#define IDX_TYPE
Definition: mesh.h:143

◆ CYLINDER_SUBDIV

#define CYLINDER_SUBDIV   24

◆ CONE_SUBDIV

#define CONE_SUBDIV   24

◆ ELLIPSE_SUBDIV

#define ELLIPSE_SUBDIV   32

◆ COL_TO_RGBA

#define COL_TO_RGBA (   res,
  col 
)    { res.red = col.red; res.green = col.green; res.blue = col.blue; res.alpha = FIX_ONE; }

◆ MESH_GET_COL

#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:326
#define COL_TO_RGBA(res, col)
Definition: mesh.c:1114

◆ GET_IDX

#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; \

◆ REGISTER_POINT_FACE

#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); \
} \
} \

◆ NEAR_ZERO

#define NEAR_ZERO (   __x)    (ABS(__x)<=FIX_EPSILON)

Function Documentation

◆ compositor_get_srdmap_size()

void compositor_get_srdmap_size ( const GF_PropertyValue *  srd_map,
u32 width,
u32 height,
u32 min_x,
u32 min_y 
)
+ Here is the caller graph for this function:

◆ del_aabb_node()

static void del_aabb_node ( AABBNode node)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mesh_reset()

void mesh_reset ( GF_Mesh mesh)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mesh_free()

void mesh_free ( GF_Mesh mesh)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ new_mesh()

GF_Mesh* new_mesh ( )
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mesh_fit_alloc()

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:

◆ mesh_update_bounds()

void mesh_update_bounds ( GF_Mesh mesh)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mesh_clone()

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:

◆ set_vertex()

static GFINLINE 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:

◆ mesh_set_vertex()

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:

◆ mesh_set_vertex_v()

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:

◆ mesh_set_vertex_vx()

void mesh_set_vertex_vx ( GF_Mesh mesh,
GF_Vertex vx 
)
+ Here is the caller graph for this function:

◆ mesh_set_point()

void mesh_set_point ( GF_Mesh mesh,
Fixed  x,
Fixed  y,
Fixed  z,
SFColorRGBA  col 
)
+ Here is the caller graph for this function:

◆ mesh_set_index()

void mesh_set_index ( GF_Mesh mesh,
u32  idx 
)
+ Here is the caller graph for this function:

◆ mesh_set_triangle()

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:

◆ mesh_set_line()

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:

◆ mesh_recompute_normals()

void mesh_recompute_normals ( GF_Mesh mesh)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mesh_generate_tex_coords()

void mesh_generate_tex_coords ( GF_Mesh mesh,
GF_Node __texCoords 
)
+ Here is the caller graph for this function:

◆ mesh_new_box()

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:

◆ mesh_new_unit_bbox()

void mesh_new_unit_bbox ( GF_Mesh mesh)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compute_cylinder()

static void compute_cylinder ( Fixed  height,
Fixed  radius,
s32  numFacets,
SFVec3f coords,
SFVec2f texcoords 
)
static
+ Here is the caller graph for this function:

◆ mesh_new_cylinder()

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:

◆ mesh_new_cone()

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:

◆ compute_sphere()

void compute_sphere ( Fixed  radius,
SFVec3f coords,
SFVec2f texcoords,
u32  num_steps,
GF_MeshSphereAngles sphere_angles 
)
+ Here is the caller graph for this function:

◆ mesh_new_sphere()

void mesh_new_sphere ( GF_Mesh mesh,
Fixed  radius,
Bool  low_res,
GF_MeshSphereAngles sphere_angles 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mesh_new_spherical_srd()

void mesh_new_spherical_srd ( GF_Mesh mesh,
Fixed  radius,
const GF_PropertyValue *  srd_map,
const GF_PropertyValue *  srd_ref 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mesh_new_rectangle_ex()

void mesh_new_rectangle_ex ( GF_Mesh mesh,
SFVec2f  size,
SFVec2f orig,
u32  flip,
u32  rotate 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mesh_new_rectangle()

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:

◆ mesh_new_planar_srd()

void mesh_new_planar_srd ( GF_Mesh mesh,
SFVec2f  size,
u32  flip,
u32  rotate,
const GF_PropertyValue *  srd_map,
const GF_PropertyValue *  srd_ref 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mesh_new_ellipse()

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:

◆ mesh_from_path_intern()

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:

◆ mesh_from_path()

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:

◆ mesh_get_outline()

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:

◆ mesh_new_ils()

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:

◆ mesh_new_ps()

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:

◆ register_point_in_face()

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:

◆ register_face_in_point()

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:

◆ smooth_face_normals()

static GFINLINE 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:

◆ mesh_new_ifs_intern()

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:

◆ mesh_new_ifs2d()

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:

◆ mesh_new_ifs()

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:

◆ mesh_new_elevation_grid()

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:

◆ mesh_extrude_path_intern()

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:

◆ mesh_extrude_path_ext()

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:

◆ mesh_extrude_path()

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:

◆ mesh_new_extrusion()

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: