object 3 LIBG3D Library object Object manipulation Synopsis #include <g3d/object.h> G3DObject; G3DTransformation; void g3d_object_free (G3DObject *object); gdouble g3d_object_radius (G3DObject *object); gboolean g3d_object_scale (G3DObject *object, G3DFloat scale); gboolean g3d_object_transform (G3DObject *object, G3DMatrix *matrix); gboolean g3d_object_transform_normals (G3DObject *object, G3DMatrix *matrix); G3DObject* g3d_object_duplicate (G3DObject *object); gboolean g3d_object_optimize (G3DObject *object); gboolean g3d_object_smooth (G3DObject *object); gboolean g3d_object_merge (G3DObject *o1, G3DObject *o2); Description Objects are parts of a model. In most file formats vertices and faces are grouped in some way into objects. Objects can be hierarchical, so what a model contains is basically an object tree. Details G3DObject G3DObjecttypedef 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; G3DVector *vertex_data; } 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 G3DVector *vertex_data; vertex vector data G3DTransformation G3DTransformationtypedef struct { G3DMatrix matrix[16]; guint32 flags; } G3DTransformation; A three-dimensional matrix transformation object. G3DMatrix matrix[16]; the transformation matrix guint32 flags; flags g3d_object_free () g3d_object_freevoid g3d_object_free (G3DObject *object); Frees all memory allocated for that object. object : the object to free g3d_object_radius () g3d_object_radiusgdouble g3d_object_radius (G3DObject *object); Calculates the radius of the object. This is the maximum from the center to a vertex. object : the object to measure Returns : the radius of the given object g3d_object_scale () g3d_object_scalegboolean g3d_object_scale (G3DObject *object, G3DFloat scale); Resizes the object by the factor scale. object : the object to scale scale : scale factor Returns : TRUE on success, FALSE else g3d_object_transform () g3d_object_transformgboolean g3d_object_transform (G3DObject *object, G3DMatrix *matrix); Multiplies all vertices of the object with the transformation matrix. object : the object to transform matrix : the transformation matrix Returns : TRUE on success, FALSE else g3d_object_transform_normals () g3d_object_transform_normalsgboolean g3d_object_transform_normals (G3DObject *object, G3DMatrix *matrix); Multiplies all normals of the object with the transformation matrix. object : the object to transform matrix : the transformation matrix Returns : TRUE on success, FALSE else g3d_object_duplicate () g3d_object_duplicateG3DObject* g3d_object_duplicate (G3DObject *object); Duplicates an object with all vertices, faces and materials. object : the object to duplicate Returns : the new clone object g3d_object_optimize () g3d_object_optimizegboolean g3d_object_optimize (G3DObject *object); Puts all vertex and face information into special arrays for faster rendering. It is deprecated and should not be used. object : the object to optimize Returns : TRUE on success, FALSE else g3d_object_smooth () g3d_object_smoothgboolean g3d_object_smooth (G3DObject *object); FIXME: unimplemented. object : the object to smooth Returns : TRUE on success, FALSE else g3d_object_merge () g3d_object_mergegboolean g3d_object_merge (G3DObject *o1, G3DObject *o2); Merges both objects into o1. FIXME: needs cleanup o1 : first and target object o2 : second object Returns : TRUE on success, FALSE else