| Libg3d Reference Manual | ||||
|---|---|---|---|---|
#define G3D_FLAG_IMG_GREYSCALE G3DImage; #define G3D_FLAG_MAT_TWOSIDE G3DMaterial; #define G3D_FLAG_FAC_NORMALS #define G3D_FLAG_FAC_TEXMAP G3DFace; G3DObject; gboolean (*G3DSetBgColorFunc) (gfloat r, gfloat g, gfloat b, gfloat a, gpointer user_data); gboolean (*G3DUpdateInterfaceFunc) (gpointer user_data); gboolean (*G3DUpdateProgressBarFunc) (gfloat percentage, gboolean show, gpointer user_data); G3DContext; G3DModel;
typedef struct {
gchar *name;
guint32 width;
guint32 height;
guint8 depth;
guint32 flags;
guint8 *pixeldata;
guint32 tex_id;
G3DTexEnv tex_env;
gfloat tex_scale_u;
gfloat tex_scale_v;
} G3DImage;
Object containing a two-dimensional pixel image.
gchar *name; |
name of image |
guint32 width; |
width of image in pixels |
guint32 height; |
height of image in pixels |
guint8 depth; |
depth of image in bits |
guint32 flags; |
flags |
guint8 *pixeldata; |
the binary image data |
guint32 tex_id; |
the OpenGL texture id, should be unique model-wide |
G3DTexEnv tex_env; |
texture environment flags |
gfloat tex_scale_u; |
factor scaling texture width, should be 1.0 for most cases |
gfloat tex_scale_v; |
factor scaling texture height, should be 1.0 for most cases |
typedef struct {
gchar *name;
gfloat r, g, b, a;
gfloat shininess;
gfloat specular[4];
guint32 flags;
G3DImage *tex_image;
} G3DMaterial;
A material object.
gchar *name; |
name of material |
gfloat r; |
red component of color |
gfloat g; |
green component of color |
gfloat b; |
blue component of color |
gfloat a; |
alpha component of color |
gfloat shininess; |
shiny color |
gfloat specular[4]; |
specular color |
guint32 flags; |
flags |
G3DImage *tex_image; |
texture image (optional, may be NULL) |
typedef struct {
guint32 vertex_count;
guint32 *vertex_indices;
G3DMaterial *material;
guint32 flags;
gfloat *normals;
G3DImage *tex_image;
guint32 tex_vertex_count;
gfloat *tex_vertex_data;
} G3DFace;
An object representing a surface.
guint32 vertex_count; |
number of vertices |
guint32 *vertex_indices; |
indices of vertices in G3DObject |
G3DMaterial *material; |
material to use for surface |
guint32 flags; |
flags |
gfloat *normals; |
optional normal array (one vector - 3 gfloat values - for each vertex) |
G3DImage *tex_image; |
optional texture image |
guint32 tex_vertex_count; |
number of texture vertices, should be 0 or match vertex_count |
gfloat *tex_vertex_data; |
array of texture vertices |
typedef struct {
gchar *name;
GSList *materials;
GSList *faces;
GSList *objects;
/* transformation, may be NULL */
G3DTransformation *transformation;
/* don't render this object */
gboolean hide;
/* vertices */
guint32 vertex_count;
gfloat *vertex_data;
/* texture stuff: temporary storage, should be in G3DFace items */
guint32 tex_vertex_count;
gfloat *tex_vertex_data;
G3DImage *tex_image;
/* some fields to speed up rendering, should not be used by plugins */
/* FIXME: remove from API (replace with user_data pointer?) */
gfloat *_normals;
G3DMaterial **_materials;
guint32 _num_faces;
guint32 *_indices;
guint32 *_flags;
guint32 *_tex_images;
gfloat *_tex_coords;
} G3DObject;
A three-dimensional object.
gchar *name; |
name of object |
GSList *materials; |
list of materials |
GSList *faces; |
list of faces |
GSList *objects; |
list of sub-objects |
G3DTransformation *transformation; |
optional transformation |
gboolean hide; |
flag to disable object rendering |
guint32 vertex_count; |
number of vertices |
gfloat *vertex_data; |
vertex vector data |
guint32 tex_vertex_count; |
|
gfloat *tex_vertex_data; |
|
G3DImage *tex_image; |
|
gfloat *_normals; |
|
G3DMaterial **_materials; |
|
guint32 _num_faces; |
|
guint32 *_indices; |
|
guint32 *_flags; |
|
guint32 *_tex_images; |
|
gfloat *_tex_coords; |
gboolean (*G3DSetBgColorFunc) (gfloat r,
gfloat g,
gfloat b,
gfloat a,
gpointer user_data);
r : |
|
g : |
|
b : |
|
a : |
|
user_data : |
|
| Returns : |
gboolean (*G3DUpdateInterfaceFunc) (gpointer user_data);
user_data : |
|
| Returns : |
gboolean (*G3DUpdateProgressBarFunc) (gfloat percentage,
gboolean show,
gpointer user_data);
percentage : |
|
show : |
|
user_data : |
|
| Returns : |
typedef struct {
GSList *plugins;
#ifdef USE_LIBMAGIC
magic_t magic_cookie;
#endif
GHashTable *exts_import;
GHashTable *exts_image;
G3DSetBgColorFunc set_bgcolor_func;
gpointer set_bgcolor_data;
G3DUpdateInterfaceFunc update_interface_func;
gpointer update_interface_data;
G3DUpdateProgressBarFunc update_progress_bar_func;
gpointer update_progress_bar_data;
} G3DContext;
Internal stuff for libg3d.