primitives(3)
NAME
primitives - a collection of object primitives for SIPP.
SYNOPSIS
#include <primitives.h> [g]cc [flags] files -lsipp -lm [ libraries ]
DESCRIPTION
- SIPP gives the user access to a number of rather low level
- functions to create polygons, surfaces and objects. This manual
- describes a set of functions that use the low level functions in
- SIPP to create geometric primitives. Each primitive is a complete
- SIPP object.
- Each object primitive has a last argument that describes
- what kind of texture coordinates should be assigned to the sur
- face of the object. This texture parameter should be one of:
- NATURAL, CYLINDRICAL, SPHERICAL or WORD. See the user manual for
- a detailed description of the meaning of the different values.
PRIMITIVES
- Object *sipp_torus(bigradius, smallradius, res1, res2,
- surface, shader, texture)
- double bigradius;
double smallradius;
int res1;
int res2;
void *surface;
Shader *shader;
int texture; - sipp_torus() creates a torus centered about the
- origin and with the z-axis pointing up through the ring. NATURAL
- texture mapping is a two dimensional mapping with the x coordi
- nate going around the "small" circle and the y coordinate going
- around the "large" circle.
- Object *sipp_cone(bot_rad, ,top_rad, length, resolution,
- surface,shader, texture)
- double bot_rad;
double top_rad;
double length;
int resolution;
void *surface;
Shader *shader;
int texture; - sipp_cone() creates a, possibly truncated, cone
- centered about the origin and with the z-axis along the cones
- main axis. NATURAL texture mapping is CYLINDRICAL.
- Object *sipp_cylinder(radius, length, resolution, surface,
- shader, texture)
- double radius;
double length;
int resolution;
void *surface;
Shader *shader;
int texture; - sipp_cylinder() creates a cylinder centered about
- the origin and with the z-axis along the cylinders main axis.
- NATURAL texture mapping is CYLINDRICAL.
- Object *sipp_ellipsoid(x_rad, y_rad, z_rad, resolution,
- surface, shader, texture)
- double x_rad;
double y_rad;
double z_rad;
int resolution;
void *surface;
Shader *shader;
int texture; - sipp_ellipsoid() creates a ellipsoid centered about
- the origin. NATURAL texture mapping is SPHERICAL.
- Object *sipp_sphere(radius, resolution, surface, shader,
- texture)
- double radius;
int resolution;
void *surface;
Shader *shader;
int texture; - sipp_sphere() creates a sphere centered about the
- origin. NATURAL texture mapping is SPHERICAL.
- Object *sipp_prism(num_points, points, length, surface,
- shader, texture)
- int num_points;
Vector *points;
double length;
void *surface;
Shader *shader;
int texture; - sipp_prism() creates a prism defined by the polygon
- in points. Only the x and y values are used and the prism will
- ascend and descend equally far (length / 2.0) from the x-y plane
- along the z axis. NATURAL texture mapping is similar to
- CYLINDRICAL but the x coordinate is not taken from projection on
- a cylinder but is evenly distributed around the perimeter. An odd
- thing in all the 2D mappings for the prism is that the top face
- will have texture coordinates (0.0, 1.0) while the bottom will
- get (0.0, 0.0).
- Object *sipp_block(x_size, y_size, z_size, surface,
- shader, texture)
- double x_size;
double y_size;
double z_size;
void *surface;
Shader *shader;
int texture; - sipp_block() creates a rectangular block with the
- size defined by x_size, z_size and z_size. The block is centered
- about the origin. NATURAL texture mapping is similar to
- CYLINDRICAL but the x coordinate is not taken from projection on
- a cylinder but is evenly distributed around the perimeter. An odd
- thing in all the 2D mappings for the block is that the top face
- will have texture coordinates (0.0, 1.0) while the bottom will
- get (0.0, 0.0).
- Object *sipp_cube(side, surface, shader, texture)
- double side;
void *surface;
Shader *shader;
int texture; - sipp_cube() creates a cube with the side of length
- side. The cube is centered about the origin. NATURAL texture
- mapping is similar to CYLINDRICAL but the x coordinate is not
- taken from projection on a cylinder but is evenly distributed
- around the perimeter. An odd thing in all the 2D mappings for the
- cube is that the top face will have texture coordinates (0.0,
- 1.0) while the bottom will get (0.0, 0.0).
- Object *sipp_bezier_patch(num_vertex, vertex, num_patch,
- vx_index, res, surface, shader, texture)
- int num_vertex;
Vector vertex[];
int num_patch;
int vx_index[];
int res;
void *surface;
Shader *shader;
int texture; - This function creates one or more bezier patches.
- All created patches in a call will belong to the same surface.
- The texture coordinates are a bit special for the bezier patches.
- CYLINDRICAL and SPHERICAL coordinates are not applicable, if they
- are specified, SIPP will use NATURAL anyway. The NATURAL mapping
- is a two dimensional mapping using the surface parameters u and
- v. Note that these parameters range from 0 to 1 within each
- patch!
- Object *sipp_bezier_rotcurve(num_vertex, vertex,
- num_curve, vx_index, res, surface, shader, texture)
- int num_vertex;
Vector vertex[];
int num_curve;
int vx_index[];
int res;
void *surface;
Shader *shader;
int texture; - This function creates a surface by rotating one or
- more bezier curves about the world z-axis. The texture coordi
- nates are a bit special for these surfaces. SPHERICAL and
- CYLINDRICAL mappings are not applicable, and NATURAL mapping will
- apply to the peace of surface created by each bezier curve sepa
- rately. The NATURAL mapping uses the curve parameter u along each
- curve as x coordinate and goes from 0 to 1 around the perimeter
- of the rotational surface on the other axis
- Object *sipp_bezier_file(file, res, surface, shader,
- texture)
- FILE *file;
int res;
void *surface;
Shader *shader;
int texture; - sipp_bezier_file() reads a file containing descrip
- tions of a set of bezier patches or bezier curves. See the user
- manual for a detailed description of the format of the definition
- file. Texture coordinates are assigned in the same way as in
- sipp_bezier_patch() and sipp_bezier_rotcurve().
- Object *sipp_teapot(resolution, surface, shader, texture)
- int resolution;
void *surface;
Shader *shader;
int texture; - sipp_teapot() creates a model of the famous "Utah
- Teapot". It is built as a combined object of four subobjects:
- body, lid, handle and spout (no, there is no bottom). Each of
- these subobjects are also available as separate primitive ob
- jects. The body and lid are created as Bezier rotation curves
- while the spout and handle are created as sets Bezier patches.
- Texture coordinates are assigned in the same way as for these
- primitives (i.e. sipp_bezier_rotcurve() and sipp_bezier_patch().
- Object *sipp_teapot_body(resolution, surface, shader,
- texture)
- int resolution;
void *surface;
Shader *shader;
int texture; - Create the body of the "Utah Teapot" as a separate
- object. See sipp_teapot() for a more detailed description.
- Object *sipp_teapot_lid(resolution, surface, shader,
- texture)
- int resolution;
void *surface;
Shader *shader;
int texture; - Create the lid of the "Utah Teapot" as a separate
- object. See sipp_teapot() for a more detailed description.
- Object *sipp_teapot_handle(resolution, surface, shader,
- texture)
- int resolution;
void *surface;
Shader *shader;
int texture; - Create the handle of the "Utah Teapot" as a sepa
- rate object. See sipp_teapot() for a more detailed description.
- Object *sipp_teapot_spout(resolution, surface, shader,
- texture)
- int resolution;
void *surface;
Shader *shader;
int texture; - Create the spout of the "Utah Teapot" as a separate
- object. See sipp_teapot() for a more detailed description.
SEE ALSO
sipp(3) - simple polygon processor, a 3d-graphics library
sipp_shaders(3) - a collection of shaders for SIPP.
sipp_geometric(3) - Vector and matrix functions for SIPP.
sipp_pixmap(3) - pixmap handling code for SIPP.
sipp_bitmap(3) - bitmap handling code for SIPP.
AUTHORS
Jonas Yngvesson (jonas-y@isy.liu.se)
Inge Wallin (ingwa@isy.liu.se)
BUGS
- The format for the bezier patches and curves is pro
- hibitively ugly.
- 3 December , 1990