lsb.h
4.23 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/******************************************************************************
**
** (C) Copyright 1991, 1992, 1993 Lightscape Graphics Software, Ltd.
**
** $Header: /root/leakn64/depot/rf/sw/bbplayer/tools/translator/lsb.h,v 1.1.1.2 2002/10/29 08:07:16 blythe Exp $
**
** $Log: lsb.h,v $
** Revision 1.1.1.2 2002/10/29 08:07:16 blythe
** n64os20l from nintendo
**
** Revision 1.1 1995/08/19 01:39:58 goslin
** Initial revision
**
* Revision 1.1 1995/05/31 23:18:18 goslin
* Initial revision
*
* Revision 1.5 95/03/31 13:18:55 goslin
* *** empty log message ***
*
* Revision 1.4 95/03/30 20:28:35 goslin
* *** empty log message ***
*
* Revision 1.3 95/03/30 00:17:30 goslin
* *** empty log message ***
*
* Revision 1.2 95/03/21 01:12:50 goslin
* *** empty log message ***
*
* Revision 1.1 95/02/12 22:31:05 goslin
* Initial revision
*
* Revision 1.2 94/10/12 17:40:43 weberh
* converts with single structure
*
* Revision 1.1 94/10/11 16:26:11 weberh
* Initial revision
*
**
******************************************************************************/
#ifndef __LSB_H__
#define __LSB_H__
#include "bead.H"
/* added by weberh to get rid of performer and sgi dependence */
typedef float vec4[4];
typedef float vec3[3];
typedef float vec2[2];
typedef unsigned long ulong;
#ifndef SEEK_SET
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#endif /* SEEK_SET */
#define SETVEC4(a,b,c,d,e) (a)[0]=(b);(a)[1]=(c);(a)[2]=(d);(a)[3]=(e);
#define SETVEC3(a,b,c,d) (a)[0]=(b);(a)[1]=(c);(a)[2]=(d);
#define SETVEC2(a,b,c) (a)[0]=(b);(a)[1]=(c);
#define COPYVEC4(a,b) (a)[0]=(b)[0];(a)[1]=(b)[1];\
(a)[2]=(b)[2];(a)[3]=(b)[3];
/* end of added stuff -- got rid of some performer stuff below */
#define LSB_VERSION_1 1
#define LSB_SIGNATURE "Lightscape Radiosity LSB Format"
#define LSB_BEGIN_CHAR '!'
/* PatchCluster Flags */
#define LSB_BIG_CLUSTER 0x0001
#define LSB_TEXTURED 0x0002
typedef struct lsbHeader {
short LSBversion;
short fileFlags;
ulong numPatchClusters;
ulong numTopNodes;
ulong numNodes;
ulong numTopPatchVertices;
ulong numPatchVertices;
ulong numMaterials;
ulong numLayers;
ulong numTextures;
} LSBheader;
typedef struct lsbTopPatchVertex {
float coord[3];
float color[3];
} LSBtopPatchVertex;
typedef struct lsbPatchVertex {
float color[3];
} LSBpatchVertex;
typedef struct lsbTopPatchVertexTextured {
float coord[3];
float color[3];
float uv[2];
} LSBtopPatchVertexTextured;
typedef struct lsbPatchCluster {
short flags;
vec4 plane;
ulong materialId;
ulong layerId;
ulong textureId;
ushort numTopNodes;
ushort numNodes;
ushort numTopVertices;
ushort numVertices;
} LSBpatchCluster;
typedef struct lsbPatchLeaf {
ushort vertices[4];
ushort midVertices[4];
} LSBpatchLeaf;
typedef struct lsbPatchClusterLong {
short flags;
float plane[4];
ulong materialId;
ulong layerId;
ulong textureId;
ulong numTopNodes;
ulong numNodes;
ulong numTopVertices;
ulong numVertices;
} LSBpatchClusterLong;
typedef struct lsbPatchLeafLong {
ulong vertices[4];
ulong midVertices[4];
} LSBpatchLeafLong;
#define NODE_IS_TRIANGLE(node) ((node)->vertices[3] == (LSpatchVertex *)0)
#define NODE_IS_RECT(node) ((node)->vertices[3] != (LSpatchVertex *)0)
#define ELEMENT_IS_TRIANGLE(e) NODE_IS_TRIANGLE(e->node)
#define ELEMENT_IS_RECT(e) NODE_IS_RECT(e->node)
#define NUM_NODE_VERTICES(node) (NODE_IS_TRIANGLE(node) ? 3 : 4)
#define NUM_PATCH_VERTICES(node) (PATCH_IS_TRIANGLE(node) ? 3 : 4)
#define NUM_ELEMENT_VERTICES(node) (ELEMENT_IS_TRIANGLE(node) ? 3 : 4)
typedef struct lsMaterial {
char *name;
} LSmaterial;
typedef struct lsLayer {
char *name;
} LSlayer;
typedef struct lsTexture {
char *name;
} LStexture;
typedef struct lsPatchVertex {
ushort flags;
ulong index;
} LSpatchVertex;
typedef struct lsPatchNode {
short isLeaf;
LSpatchVertex *vertices[4];
struct lsPatchNode *children[4];
} LSpatchNode;
typedef struct lsPatchCluster {
ushort flags;
float plane[4];
LSmaterial *material;
LSlayer *layer;
LStexture *texture;
} LSpatchCluster;
#endif