gpmark

view src/engine3d.h @ 0:5019d031b485

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 05 Jun 2013 22:33:37 +0300
parents
children
line source
1 #ifndef ENGINE3D_H
2 #define ENGINE3D_H
4 #define MAXDATA 262144
6 #define POINTS 1
7 #define WIRE 2
8 #define FLAT 4
9 #define GOURAUD 8
10 #define ENVMAP 16
11 #define TEXTURE 32
13 #define ZBUFFER 256
15 #define LIGHTVIEW 0
16 #define LIGHTMOVE 1
18 #define PI 3.14151693
19 #define D2R 180.0/PI
21 typedef struct vector3d
22 {
23 int x;
24 int y;
25 int z;
26 } vector3d;
28 typedef struct point2d
29 {
30 int x;
31 int y;
32 unsigned short c;
33 } point2d;
36 typedef struct point3d
37 {
38 int x;
39 int y;
40 int z;
41 unsigned short c;
42 } point3d;
44 typedef struct tcord
45 {
46 int u, v;
47 } tcord;
49 typedef struct poly2d
50 {
51 int p0; tcord tc0;
52 int p1; tcord tc1;
53 int p2; tcord tc2;
54 int c;
55 int m;
56 } poly2d;
59 typedef struct line2d
60 {
61 int p0;
62 int p1;
63 int c;
64 }line2d;
67 typedef struct rot3d
68 {
69 float x;
70 float y;
71 float z;
72 }rot3d;
75 typedef struct pos3d
76 {
77 float x;
78 float y;
79 float z;
80 }pos3d;
83 typedef struct object3d
84 {
85 int npts, npls, nlns;
87 point3d *point;
88 poly2d *poly;
89 line2d *line;
91 vector3d *normal;
92 vector3d *pt_normal;
94 rot3d rot;
95 pos3d pos;
96 }object3d;
98 vector3d CrossProduct(vector3d v1, vector3d v2);
99 int DotProduct(vector3d v1, vector3d v2);
100 vector3d Normalize(vector3d v);
101 vector3d NegVec(vector3d v);
103 void Calc3d(object3d *obj);
105 void rotate3d (object3d *obj);
106 void translate3d (object3d *obj);
107 void project3d (object3d *obj);
109 void rotate3d_normals (object3d *obj);
110 void rotate3d_pt_normals (object3d *obj);
112 void CalcPointColor(object3d *obj);
113 void CalcPolyColor(object3d *obj);
115 void quicksort (int lo, int hi, int data[]);
117 #endif