primitive3LIBG3D Libraryprimitive3D primitive generation functionsSynopsis
#include <g3d/primitive.h>
G3DObject* g3d_primitive_cube (G3DFloat width,
G3DFloat height,
G3DFloat depth,
G3DMaterial *material);
G3DObject* g3d_primitive_box (G3DFloat width,
G3DFloat height,
G3DFloat depth,
G3DMaterial *material);
G3DObject* g3d_primitive_box_strip_2d (guint32 vcnt,
gdouble *vdata,
gdouble height,
gdouble width,
G3DMaterial *material);
G3DObject* g3d_primitive_mesh (guint32 m,
guint32 n,
gboolean wrap_m,
gboolean wrap_n,
G3DMaterial *material);
G3DObject* g3d_primitive_cylinder (G3DFloat radius,
G3DFloat height,
guint32 sides,
gboolean top,
gboolean bottom,
G3DMaterial *material);
G3DObject* g3d_primitive_tube (G3DFloat r_in,
G3DFloat r_out,
G3DFloat height,
guint32 sides,
gboolean top,
gboolean bottom,
G3DMaterial *material);
G3DObject* g3d_primitive_sphere (G3DFloat radius,
guint32 vseg,
guint32 hseg,
G3DMaterial *material);
Description
Primitives are objects containing basic 3D geometrical structures. A
variety of them can be created using these functions.Detailsg3d_primitive_cube ()g3d_primitive_cubeG3DObject* g3d_primitive_cube (G3DFloat width,
G3DFloat height,
G3DFloat depth,
G3DMaterial *material);
Generates an object containing a box. It is deprecated and now a wrapper for
g3d_primitive_box().width : the width of the box
height : the height of the box
depth : the depth of the box
material : the material to use for all faces
Returns : the box object
g3d_primitive_box ()g3d_primitive_boxG3DObject* g3d_primitive_box (G3DFloat width,
G3DFloat height,
G3DFloat depth,
G3DMaterial *material);
Generates an object containing a box.width : the width of the box
height : the height of the box
depth : the depth of the box
material : the material to use for all faces
Returns : the box object
g3d_primitive_box_strip_2d ()g3d_primitive_box_strip_2dG3DObject* g3d_primitive_box_strip_2d (guint32 vcnt,
gdouble *vdata,
gdouble height,
gdouble width,
G3DMaterial *material);
Generates a strip of box segments defined by corner center points
using two-dimensional data (x/z plane).vcnt : number of control points
vdata : 2-dimensional control point data (2 * vcnt * gdouble)
height : height of resulting strip (y component)
width : width of strip (corner diameter)
material : material to use for faces
Returns : strip object
g3d_primitive_mesh ()g3d_primitive_meshG3DObject* g3d_primitive_mesh (guint32 m,
guint32 n,
gboolean wrap_m,
gboolean wrap_n,
G3DMaterial *material);
Generate a mesh consisting of m * n vertices. The vertex data is
initialized with (0.0, 0.0, 0.0) and has to be set to something
useful.m : number of vertices in m direction
n : number of vertices in n direction
wrap_m : wrap around in m direction
wrap_n : wrap around in n direction
material : material to use for faces
Returns : mesh object
g3d_primitive_cylinder ()g3d_primitive_cylinderG3DObject* g3d_primitive_cylinder (G3DFloat radius,
G3DFloat height,
guint32 sides,
gboolean top,
gboolean bottom,
G3DMaterial *material);
Generates an object containing a cylinder.radius : the radius of the cylinder
height : the height of the side faces
sides : number of side faces (number of circle segments)
top : add top faces
bottom : add bottom faces
material : material to use for faces
Returns : cylinder object
g3d_primitive_tube ()g3d_primitive_tubeG3DObject* g3d_primitive_tube (G3DFloat r_in,
G3DFloat r_out,
G3DFloat height,
guint32 sides,
gboolean top,
gboolean bottom,
G3DMaterial *material);
Generates an object containing a tube (a cylinder with a hole).r_in : inner radius
r_out : outer radius
height : the height of the side faces
sides : number of side faces (number of circle segments)
top : add top faces
bottom : add bottom faces
material : material to use for faces
Returns : tube object
g3d_primitive_sphere ()g3d_primitive_sphereG3DObject* g3d_primitive_sphere (G3DFloat radius,
guint32 vseg,
guint32 hseg,
G3DMaterial *material);
Generates an object containing a sphere.radius : radius
vseg : number of vertical segments
hseg : number of horizontal segments
material : material to use for faces
Returns : sphere object