#include <gtcutils.h>
Go to the source code of this file.
Compounds | |
| struct | gtcSimpleMesh |
| Basic 3d mesh. More... | |
Typedefs | |
| typedef gtcReal (* | I_dont_know_all_I_need_to_know )[4][4] |
| How do you say that a function returns a pointer to an array without a typedef? | |
Functions | |
| void | gtc_put_mesh (int f[][3], gtcReal v[][3], gtcReal n[][3], int texid, gtcReal t[][2], int numf) |
| Low-level functionality without the gtcSimpleMesh structure. | |
| void | gtc_put_simple_mesh_wremap (gtcSimpleMesh *m, gtcReal(*A[])[4][4], gtcReal(*An[])[4][4]) |
| Puts a mesh with warping remap. More... | |
| void | gtc_put_simple_mesh (gtcSimpleMesh *m, gtcReal A[][4][4]) |
| Puts a mesh (with perhaps warping). More... | |
| I_dont_know_all_I_need_to_know | gtc_prep_An (int numw, gtcReal A[][4][4]) |
| Given a matrix A, which is to be applied to vertices, this computes An, to be applied to a normal vector. | |
| void | gtc_put_simple_mesh_easy (gtcSimpleMesh *m, gtcReal A[4][4]) |
| If m->numw=0 or 1, then you can use this instead of gtc_put_simple_mesh(). | |
| void | gtc_normalize_mesh (gtcReal v[][3], int numv) |
| Centers the mesh about the origin and scales it so that its radius is roughly one. | |
| void | gtc_normalize_simple_mesh (gtcSimpleMesh *m) |
| Same as gtc_normalize_mesh(), but for simple meshes. | |
| gtcSimpleMesh* | gtc_simple_mesh_new (char *name, int numf, int numv) |
| Create a new mesh, no texture, no weights. | |
| gtcSimpleMesh* | gtc_simple_mesh_tex_new (char *name, int numf, int numv) |
| Create a new mesh, texture, no weights. | |
| gtcSimpleMesh* | gtc_simple_mesh_w_new (char *name, int numf, int numv, int numw) |
| Create a new mesh, no texture, weights. | |
| gtcSimpleMesh* | gtc_simple_mesh_wtex_new (char *name, int numf, int numv, int numw) |
| Create a new mesh, texture, weights. | |
| void | gtc_simple_texcoord (gtcSimpleMesh *m) |
| Assigns debugging texture coordinates to the mesh. | |
| void | gtc_simple_mesh_free (gtcSimpleMesh *m) |
| Deallocates all memory for a gtcSimpleMesh. | |
| gtcReal | gtc_dot (gtcReal a[], gtcReal b[], int n) |
| vector dot product (n-dimensional). | |
| void | gtc_cross (gtcReal a[3], gtcReal b[3], gtcReal r[3]) |
| vector cross product. | |
| void | gtc_add (gtcReal a[], gtcReal b[], gtcReal r[], int n) |
| vector addition (n-dimensional) r=a+b. | |
| void | gtc_sub (gtcReal a[], gtcReal b[], gtcReal r[], int n) |
| vector subtraction (n-dimensional) r=a-b. | |
| gtcReal | gtc_norm (gtcReal a[], int n) |
| vector norm (n-dimensional). | |
| void | gtc_addscale (gtcReal s, gtcReal a[], gtcReal r[], int n) |
| r+=s*a (n-dimensional). | |
| void | gtc_zero (gtcReal z[], int n) |
| zero vector (n-dimensional). | |
| void | gtc_copy (gtcReal a[], gtcReal r[], int n) |
| copy vector (really thin, maybe I should remove this). | |
| void | gtc_cum_face (int f[3], gtcReal v[][3], gtcReal n[][3]) |
| Private function. | |
| void | gtc_set_normals (int f[][3], gtcReal v[][3], gtcReal n[][3], int numf, int numv) |
| Private function. | |
| void | gtc_make_face (int f[], int a, int b, int c) |
| Private function. | |
| void | gtc_tetrahedron (gtcReal v[4][3], int f[4][3]) |
| Make a tetrahedron out of the given vertices -- simple sets the output array f. | |
| void | gtc_simple_GL_setup (void) |
| Initializes OpenGL for simple use -- note that you still must use glxdemo.h or something. | |
| void | gtc_GL_setup (int normalize, int smooth, int lighting, int cull, int clear, gtcReal near, gtcReal far, gtcReal fov, gtcReal w_div_h) |
| Reasonable GL setup. More... | |
| void | gtc_GL_setupall (gtcReal w_div_h) |
| gtc_GL_setup with all reasonable flags on. | |
| void | gtc_apply (gtcReal A[4][4], gtcReal v[3], gtcReal r[3]) |
| Apply given affine transform to the vector v, getting r. | |
| void | gtc_xform_pos (gtcReal A[4][4], gtcReal v[][3], gtcReal r[][3], int numv) |
| Apply an affine transform to an array of vertices v, getting r. | |
| void | gtc_combine (gtcReal a[4][4], gtcReal b[4][4], gtcReal r[4][4]) |
| r=a*b (* is affine transform composition). | |
| void | gtc_rot (gtcReal x, gtcReal y, gtcReal z, gtcReal theta, gtcReal R[4][4]) |
| Get a rotation matrix about vector (x,y,z) of given angle (radians), result is in R. | |
| void | gtc_redress (gtcReal r[4][4]) |
| The input matrix is made into a rotation matrix. | |
| void | gtc_xlat (gtcReal x, gtcReal y, gtcReal z, gtcReal T[4][4]) |
| Translation matrix (by (x,y,z)) goes into T. | |
| void | gtc_ident (gtcReal I[4][4]) |
| Identity matrix goes into I. | |
| void | gtcaffinecopy (gtcReal A[4][4], gtcReal R[4][4]) |
| Copies A onto R. | |
| gtcReal | gtc_determinant_3 (gtcReal A[4][4]) |
| Computes the determinant of the linear part of the affine matrix. | |
| void | gtc_invert (gtcReal A[4][4], gtcReal R[4][4]) |
| Inverts the affine transform. | |
| int | gtc_check_ortho (gtcReal A[4][4], gtcReal epsilon) |
| Checks if A is orthonormal, error threshold is epsilon. | |
| int | gtc_check_rot (gtcReal A[4][4], gtcReal epsilon) |
| Checks if A is orthonormal of determinant 1 (error threshold epsilon). | |
| char* | gtc_first_tok (char *s) |
| Internal function. | |
| char* | gtc_next_tok (char *s) |
| Internal function. | |
| void | gtc_quaternion_to_matrix (gtcReal Q[4], gtcReal M[4][4]) |
| Convert a quaternion to a matrix. | |
| void | gtc_matrix_to_quaternion (gtcReal M[4][4], gtcReal Q[4]) |
| Convert a matrix to a quaternion in an error tolerant way. | |
| gtcSimpleMesh* | gtc_stars (void) |
| Make a cube to be used for texture mapped stars. | |
This file contains basic functionality for meshes and vector math, implemented on top of OpenGL (http://www.opengl.org/). A basic mesh type, gtcSimpleMesh, is included. This basic mesh type has support for many useful things, including texture mapping and deformable meshes. Also included is various functions for manipulating affine transforms. For instance, gtc_rot() will create a rotation matrix about a given rotation axis with the given angle of rotation, while gtc_xlat() will create a translation matrix with the given translation. In addition, vertices can be transformed (eg, using gtc_apply() or gtc_xform_pos()).
NOTE ON AFFINE TRANSFORMS. It is perhaps counter intuitive that A[i][j] is the ith column of the jth row of the matrix, where matrices multiply from the left.
|
|
Reasonable GL setup. Assuming you have a window open and glx is set up properly (using, eg, glxdemo.h), you can use this to set up OpenGL itself. The meaning of the parameters are as follow. normalize: use glEnable(GL_NORMALIZE) (0=false, 1=true) -- do this. smooth: use glEnable(GL_SMOOTH) (0=false, 1=true) -- Gouraud shading. lighting: turn lighting on. Do this. cull: backface culling. In most cases you want this. clear: call glClear. If you're doing something multipass, you might not want to do this. near, far: clipping planes. fov: field of view, in degrees. w_div_h: aspect ration (width/height). |
|
|
Puts a mesh (with perhaps warping). Puts the mesh to the OpenGL pipeline, using the given affine transform(s). The number of affine transforms fed should be equal to m->numw. If this is more than zero, vertices will be transformed not by OpenGL but by GTC. In that case, any geometry acceleration hardware (eg, Impact or GeForce) is useless. If, on the other hand, m->numw=0 then OpenGL is used to transform all the vertices. (The weights are assumed to be one.) |
|
|
Puts a mesh with warping remap. As gtc_put_simple_mesh() except that A and An are arrays of pointers to affine transforms, where An are the matrices to apply to the normals. |
1.2.8.1 written by Dimitri van Heesch,
© 1997-2001