Main Page | Data Structures | File List | Data Fields | Globals

3d.h File Reference

vector math and 3d graphics More...

#include "gfx.h"

Go to the source code of this file.

Functions

void create_lookup_tables ()
 create the lookup tables for cos and sin. you MUST call this before operating on vectors.
void destroy_lookup_tables ()
 deallocate the lookup tables
mesh_tmesh_new (int pcount, int tcount)
 create a new mesh with pcount points and tcount triangles
void mesh_delete (mesh_t *mesh)
 deallocate mesh
void vector_cross_product (vector_t *v1, vector_t *v2, vector_t *r)
 cross product of v1 by v2, result into r
int vector_cross_product_z (vector_t *v1, vector_t *v2)
 cross product of the z axis of v1 by v2
int vector_dot_product (vector_t *v1, vector_t *v2)
 dot product of v1 by v2
int vector_length_squared (vector_t *v)
 squared length of vector v
int vector_length (vector_t *v)
 pure length of vector v (it involves sqrt calculus, so it is expensive)
void vector_normalize (vector_t *p, vector_t *r)
 normalize vector p, result in r
void vector_scalar (vector_t *v, int s, vector_t *r)
 scale vector v by s, result in r
void vector_add (vector_t *v1, vector_t *v2, vector_t *r)
 add vector v1 with v2, result in r
void vector_subtract (vector_t *v1, vector_t *v2, vector_t *r)
 subtract vector v1 by v2, result in r
int vector_distance (vector_t *v1, vector_t *v2)
 distance between vectors v1 and v2
void vector_rotate (vector_t *p, u_char angle_x, u_char angle_y, u_char angle_z, vector_t *r)
 rotate vector p by the given angles, result in r
void object_apply_transformations (object_t *obj, vector_t *pbuffer, int x, int y)
 apply perspective transformations on object obj, centering the points around x and y
void object_render_wireframe (surface_t *s, object_t *obj, vector_t *pbuffer)
 render object obj with wireframes
void object_render_flatshading (surface_t *s, object_t *obj, vector_t *pbuffer, int *low, int *high, vector_t *light)
 render object obj with flat-shading, requires a normalized source of light

Variables

int * tcos
 lookup cosine table
int * tsin
 lookup sine table


Detailed Description

vector math and 3d graphics

Definition in file 3d.h.


Generated on Thu Mar 3 19:55:02 2005 for GFX lib by  doxygen 1.4.1