libg3d Reference Manual | ||||
---|---|---|---|---|
#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);
Primitives are objects containing basic 3D geometrical structures. A variety of them can be created using these functions.
G3DObject* 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()
.
|
the width of the box |
|
the height of the box |
|
the depth of the box |
|
the material to use for all faces |
Returns : |
the box object |
G3DObject* g3d_primitive_box (G3DFloat width, G3DFloat height, G3DFloat depth, G3DMaterial *material);
Generates an object containing a box.
|
the width of the box |
|
the height of the box |
|
the depth of the box |
|
the material to use for all faces |
Returns : |
the box object |
G3DObject* 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).
|
number of control points |
|
2-dimensional control point data (2 * vcnt * gdouble) |
|
height of resulting strip (y component) |
|
width of strip (corner diameter) |
|
material to use for faces |
Returns : |
strip object |
G3DObject* 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.
|
number of vertices in m direction |
|
number of vertices in n direction |
|
wrap around in m direction |
|
wrap around in n direction |
|
material to use for faces |
Returns : |
mesh object |
G3DObject* g3d_primitive_cylinder (G3DFloat radius, G3DFloat height, guint32 sides, gboolean top, gboolean bottom, G3DMaterial *material);
Generates an object containing a cylinder.
|
the radius of the cylinder |
|
the height of the side faces |
|
number of side faces (number of circle segments) |
|
add top faces |
|
add bottom faces |
|
material to use for faces |
Returns : |
cylinder object |
G3DObject* 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).
|
inner radius |
|
outer radius |
|
the height of the side faces |
|
number of side faces (number of circle segments) |
|
add top faces |
|
add bottom faces |
|
material to use for faces |
Returns : |
tube object |
G3DObject* g3d_primitive_sphere (G3DFloat radius, guint32 vseg, guint32 hseg, G3DMaterial *material);
Generates an object containing a sphere.
|
radius |
|
number of vertical segments |
|
number of horizontal segments |
|
material to use for faces |
Returns : |
sphere object |