-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbumpobj.h
92 lines (72 loc) · 1.73 KB
/
bumpobj.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef _OBJ3D_H
#define _OBJ3D_H
#include "math3d.h"
#include "texture.h"
#include "texman.h"
typedef struct
{
int s1, t1, s2, t2, s3, t3;
texture_t* texture;
} texcoord_t, mapper_t;
/*
typedef struct
{
int v1, v2, v3;
} face_t;
typedef struct
{
face_t* faces;
point3d_t *points, *rotated_points;
point2d_t* translated_points;
texcoord_t* texcoords;
texture_t* textures;
vector3d_t *point_normals, *face_normals;
float* facedepths;
int* faceorder;
int n_points, n_faces, n_textures;
float x0, y0, z0;
unsigned int ax, ay, az, adx, ady, adz;
} object3d_t;
*/
typedef struct
{
point3d_t point;
point3d_t rotated_point;
point2d_t translated_point;
vector3d_t normal;
vector3d_t rotated_normal;
float ooz, oow;
} vertexdata_t;
typedef struct
{
vector3d_t face_normal;
vector3d_t rotated_normal;
mapper_t mapper;
vertexdata_t *v1, *v2, *v3;
} facedata_t;
typedef struct
{
float depth;
facedata_t* face;
} faceorder_t;
typedef struct
{
vertexdata_t* vertices;
facedata_t* faces;
faceorder_t* faceorder;
texture_t* textures;
int numpoints, numfaces, numtextures, numvisible;
float x0, y0, z0;
unsigned int ax, ay, az, adx, ady, adz;
} object3d_t;
void sort_faces(object3d_t *, vector3d_t *);
void update_object3d(object3d_t *);
void reset_object3d(object3d_t *);
void reset_and_scale_object3d(object3d_t *, float);
int create_cube(object3d_t *, const char **, int, texturemanager_t *);
int load_object3d(object3d_t *, char *);
int load_off_object(object3d_t *, char *);
int set_envmap(object3d_t *, char *, texturemanager_t *);
void unload_object3d(object3d_t *);
void save_txt_object3d(object3d_t *, char *);
#endif // _3DOBJ_H