libgpac
Documentation of the core library of GPAC
mesh.h File Reference
#include <gpac/scenegraph_vrml.h>
#include <gpac/path2d.h>
#include <gpac/mediaobject.h>
+ Include dependency graph for mesh.h:
+ This graph shows which files directly or indirectly include this file:

Data Structures

struct  SFVec3f_bytes
 
struct  GF_Vertex
 
struct  GF_Mesh
 
struct  GF_MeshSphereAngles
 
struct  AABBNode
 

Macros

#define MESH_MAKE_COL(_argb)   GF_COL_ARGB(FIX2INT(255*(_argb.alpha)), FIX2INT(255*(_argb.blue)), FIX2INT(255*(_argb.green)), FIX2INT(255*(_argb.red)))
 
#define MESH_GET_COLOR(_argb, _vertex)   { _argb.alpha = INT2FIX(GF_COL_A((_vertex).color))/255; _argb.red = INT2FIX(GF_COL_R((_vertex).color))/255; _argb.green = INT2FIX(GF_COL_G((_vertex).color))/255; _argb.blue = INT2FIX(GF_COL_B((_vertex).color))/255; }
 
#define MESH_NORMAL_UNIT   1
 
#define MESH_SET_NORMAL(_vertex, _nor)   { SFVec3f_bytes __nor; __nor.x = (s8) (_nor.x*100); __nor.y = (s8) (_nor.y*100); __nor.z = (s8) (_nor.z*100); __nor.__dummy=0; _vertex.normal = __nor; }
 
#define MESH_GET_NORMAL(_nor, _vertex)   { (_nor).x = _vertex.normal.x; (_nor).y = _vertex.normal.y; (_nor).z = _vertex.normal.z; gf_vec_norm(&(_nor)); }
 
#define MESH_TEX_OFFSET   12
 
#define MESH_NORMAL_OFFSET   20
 
#define MESH_COLOR_OFFSET   24
 
#define IDX_TYPE   u32
 

Enumerations

enum  { MESH_TRIANGLES = 0 , MESH_POINTSET , MESH_LINESET }
 
enum  {
  MESH_HAS_COLOR = 1 , MESH_IS_2D = 1<<1 , MESH_NO_TEXTURE = 1<<2 , MESH_IS_CW = 1<<3 ,
  MESH_IS_SOLID = 1<<4 , MESH_IS_SMOOTHED = 1<<5 , MESH_HAS_ALPHA = 1<<6 , MESH_WAS_VISIBLE = 1<<7
}
 
enum  {
  AABB_NONE , AABB_LONGEST , AABB_BALANCED , AABB_BEST_AXIS ,
  AABB_SPLATTER , AABB_FIFTY
}
 

Functions

GF_Meshnew_mesh ()
 
void mesh_free (GF_Mesh *mesh)
 
void mesh_reset (GF_Mesh *mesh)
 
void mesh_update_bounds (GF_Mesh *mesh)
 
void mesh_set_vertex_vx (GF_Mesh *mesh, GF_Vertex *vx)
 
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_index (GF_Mesh *mesh, u32 idx)
 
void mesh_set_point (GF_Mesh *mesh, Fixed x, Fixed y, Fixed z, SFColorRGBA col)
 
void mesh_set_triangle (GF_Mesh *mesh, u32 id1, u32 id2, u32 id3)
 
void mesh_clone (GF_Mesh *dest, GF_Mesh *orig)
 
void mesh_recompute_normals (GF_Mesh *mesh)
 
void mesh_generate_tex_coords (GF_Mesh *mesh, GF_Node *__texCoords)
 
void mesh_new_unit_bbox (GF_Mesh *mesh)
 
void mesh_new_rectangle (GF_Mesh *mesh, SFVec2f size, SFVec2f *orig, Bool flip)
 
void mesh_new_rectangle_ex (GF_Mesh *mesh, SFVec2f size, SFVec2f *orig, u32 flip, u32 rotate)
 
void mesh_new_ellipse (GF_Mesh *mesh, Fixed a_dia, Fixed b_dia, Bool low_res)
 
void mesh_new_box (GF_Mesh *mesh, SFVec3f size)
 
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 mesh_new_sphere (GF_Mesh *mesh, Fixed radius, Bool low_res, GF_MeshSphereAngles *angles)
 
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_ifs2d (GF_Mesh *mesh, GF_Node *ifs2d)
 
void mesh_new_ifs (GF_Mesh *mesh, GF_Node *ifs)
 
void mesh_new_ps (GF_Mesh *mesh, GF_Node *__coord, GF_Node *__color)
 
void mesh_new_elevation_grid (GF_Mesh *mesh, GF_Node *eg)
 
void mesh_new_extrusion (GF_Mesh *mesh, GF_Node *ext)
 
void mesh_from_path (GF_Mesh *mesh, GF_Path *path)
 
void mesh_get_outline (GF_Mesh *mesh, GF_Path *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)
 
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)
 
Bool gf_mesh_intersect_ray (GF_Mesh *mesh, GF_Ray *r, SFVec3f *outPoint, SFVec3f *outNormal, SFVec2f *outTexCoords)
 
Bool gf_mesh_closest_face (GF_Mesh *mesh, SFVec3f pos, Fixed min_dist, SFVec3f *outPoint)
 
void gf_mesh_build_aabbtree (GF_Mesh *mesh)
 
void TesselateFaceMesh (GF_Mesh *mesh, GF_Mesh *face)
 

Data Structure Documentation

◆ SFVec3f_bytes

struct SFVec3f_bytes
Data Fields
s8 x
s8 y
s8 z
s8 __dummy

◆ GF_Vertex

struct GF_Vertex
+ Collaboration diagram for GF_Vertex:
Data Fields
SFVec3f pos
SFVec2f texcoords
SFVec3f_bytes normal
u32 color

◆ GF_Mesh

struct GF_Mesh
+ Collaboration diagram for GF_Mesh:
Data Fields
u32 v_count
u32 v_alloc
GF_Vertex * vertices
u32 i_count
u32 i_alloc
IDX_TYPE * indices
u32 mesh_type
u32 flags
GF_BBox bounds
struct __AABBNode * aabb_root
IDX_TYPE * aabb_indices
u32 vbo
u32 vbo_idx
Bool vbo_dirty
Bool vbo_dynamic

◆ GF_MeshSphereAngles

struct GF_MeshSphereAngles
Data Fields
Fixed min_phi
Fixed max_phi
Fixed min_theta
Fixed max_theta

◆ AABBNode

struct AABBNode
Data Fields
SFVec3f min
SFVec3f max
IDX_TYPE * indices
u32 nb_idx
struct __AABBNode * pos
struct __AABBNode * neg

Macro Definition Documentation

◆ MESH_MAKE_COL

#define MESH_MAKE_COL (   _argb)    GF_COL_ARGB(FIX2INT(255*(_argb.alpha)), FIX2INT(255*(_argb.blue)), FIX2INT(255*(_argb.green)), FIX2INT(255*(_argb.red)))

◆ MESH_GET_COLOR

#define MESH_GET_COLOR (   _argb,
  _vertex 
)    { _argb.alpha = INT2FIX(GF_COL_A((_vertex).color))/255; _argb.red = INT2FIX(GF_COL_R((_vertex).color))/255; _argb.green = INT2FIX(GF_COL_G((_vertex).color))/255; _argb.blue = INT2FIX(GF_COL_B((_vertex).color))/255; }

◆ MESH_NORMAL_UNIT

#define MESH_NORMAL_UNIT   1

◆ MESH_SET_NORMAL

#define MESH_SET_NORMAL (   _vertex,
  _nor 
)    { SFVec3f_bytes __nor; __nor.x = (s8) (_nor.x*100); __nor.y = (s8) (_nor.y*100); __nor.z = (s8) (_nor.z*100); __nor.__dummy=0; _vertex.normal = __nor; }

◆ MESH_GET_NORMAL

#define MESH_GET_NORMAL (   _nor,
  _vertex 
)    { (_nor).x = _vertex.normal.x; (_nor).y = _vertex.normal.y; (_nor).z = _vertex.normal.z; gf_vec_norm(&(_nor)); }

◆ MESH_TEX_OFFSET

#define MESH_TEX_OFFSET   12

◆ MESH_NORMAL_OFFSET

#define MESH_NORMAL_OFFSET   20

◆ MESH_COLOR_OFFSET

#define MESH_COLOR_OFFSET   24

◆ IDX_TYPE

#define IDX_TYPE   u32

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MESH_TRIANGLES 
MESH_POINTSET 
MESH_LINESET 

◆ anonymous enum

anonymous enum
Enumerator
MESH_HAS_COLOR 
MESH_IS_2D 
MESH_NO_TEXTURE 
MESH_IS_CW 
MESH_IS_SOLID 
MESH_IS_SMOOTHED 
MESH_HAS_ALPHA 
MESH_WAS_VISIBLE 

◆ anonymous enum

anonymous enum
Enumerator
AABB_NONE 
AABB_LONGEST 
AABB_BALANCED 
AABB_BEST_AXIS 
AABB_SPLATTER 
AABB_FIFTY 

Function Documentation

◆ new_mesh()

GF_Mesh* new_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:

◆ 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_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_set_vertex_vx()

void mesh_set_vertex_vx ( GF_Mesh mesh,
GF_Vertex vx 
)
+ 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_index()

void mesh_set_index ( GF_Mesh mesh,
u32  idx 
)
+ 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_triangle()

void mesh_set_triangle ( GF_Mesh mesh,
u32  id1,
u32  id2,
u32  id3 
)
+ 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:

◆ 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_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:

◆ 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_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_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_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_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:

◆ mesh_new_sphere()

void mesh_new_sphere ( GF_Mesh mesh,
Fixed  radius,
Bool  low_res,
GF_MeshSphereAngles angles 
)
+ 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_ifs2d()

void mesh_new_ifs2d ( GF_Mesh mesh,
GF_Node ifs2d 
)
+ 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 ifs 
)
+ 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:

◆ mesh_new_elevation_grid()

void mesh_new_elevation_grid ( GF_Mesh mesh,
GF_Node eg 
)
+ 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 ext 
)
+ 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_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_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:

◆ gf_mesh_intersect_ray()

Bool gf_mesh_intersect_ray ( GF_Mesh mesh,
GF_Ray r,
SFVec3f outPoint,
SFVec3f outNormal,
SFVec2f outTexCoords 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_mesh_closest_face()

Bool gf_mesh_closest_face ( GF_Mesh mesh,
SFVec3f  pos,
Fixed  min_dist,
SFVec3f outPoint 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_mesh_build_aabbtree()

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

◆ TesselateFaceMesh()

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