1 | /* |
---|
2 | |
---|
3 | Name: mcfile.h |
---|
4 | |
---|
5 | Coded: Paul Ning |
---|
6 | |
---|
7 | Modified by: Brian Curless |
---|
8 | Computer Graphics Laboratory |
---|
9 | Stanford University |
---|
10 | |
---|
11 | Comment: Include file for Marching Cubes File Package |
---|
12 | |
---|
13 | |
---|
14 | Copyright (1997) The Board of Trustees of the Leland Stanford Junior |
---|
15 | University. Except for commercial resale, lease, license or other |
---|
16 | commercial transactions, permission is hereby given to use, copy, |
---|
17 | modify this software for academic purposes only. No part of this |
---|
18 | software or any derivatives thereof may be used in the production of |
---|
19 | computer models for resale or for use in a commercial |
---|
20 | product. STANFORD MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND |
---|
21 | CONCERNING THIS SOFTWARE. No support is implied or provided. |
---|
22 | |
---|
23 | */ |
---|
24 | |
---|
25 | |
---|
26 | /* |
---|
27 | * Marching Cubes File Format |
---|
28 | * |
---|
29 | * ---------------------- |
---|
30 | * | header | |
---|
31 | * ---------------------- |
---|
32 | * | surface data | |
---|
33 | * ---------------------- |
---|
34 | */ |
---|
35 | |
---|
36 | #ifdef __cplusplus |
---|
37 | extern "C" { |
---|
38 | #endif |
---|
39 | |
---|
40 | |
---|
41 | /* |
---|
42 | * GENERAL |
---|
43 | */ |
---|
44 | |
---|
45 | typedef long Boolean; |
---|
46 | |
---|
47 | #ifndef TRUE |
---|
48 | #define TRUE 1 |
---|
49 | #endif |
---|
50 | |
---|
51 | #ifndef FALSE |
---|
52 | #define FALSE 0 |
---|
53 | #endif |
---|
54 | |
---|
55 | /* |
---|
56 | * HEADER STUFF |
---|
57 | */ |
---|
58 | |
---|
59 | typedef struct { |
---|
60 | int mc_magic; /* magic number */ |
---|
61 | int mc_type; /* type of mc file */ |
---|
62 | int mc_tmaptype; /* type of texture map */ |
---|
63 | int mc_length; /* length (in bytes) of surface data */ |
---|
64 | } mcfile; |
---|
65 | |
---|
66 | #define MC_MAGIC 0xFEDECABA |
---|
67 | |
---|
68 | /* mc_types */ |
---|
69 | #define MCT_STANDARD 0 /* list of triangles */ |
---|
70 | #define MCT_TREE 1 /* pruned tree file */ |
---|
71 | |
---|
72 | /* mc_tmaptypes */ |
---|
73 | #define MCTM_NONE 0 /* no texture map */ |
---|
74 | #define MCTM_STANDARD 1 /* one value (0-255) per vertex */ |
---|
75 | #define MCTM_DOUBLE 2 /* two values per vertex */ |
---|
76 | |
---|
77 | /* functions */ |
---|
78 | extern Boolean IsMCFile(FILE *fp); |
---|
79 | extern void MC_InitHeader(FILE *fp); |
---|
80 | extern void MC_WriteHeader(FILE *fp, mcfile header); |
---|
81 | extern mcfile MC_ReadHeader(FILE *fp); |
---|
82 | |
---|
83 | |
---|
84 | /* |
---|
85 | * SURFACE DATA STUFF |
---|
86 | */ |
---|
87 | |
---|
88 | typedef struct { |
---|
89 | float x, y, z; /* position components */ |
---|
90 | float nx, ny, nz; /* normal components */ |
---|
91 | float confidence; |
---|
92 | unsigned char tex1; /* first texture value */ |
---|
93 | unsigned char tex2; /* second texture value */ |
---|
94 | signed char ncx, ncy, ncz; /* used to ensure faces are |
---|
95 | oriented consistently */ |
---|
96 | unsigned char realData; |
---|
97 | unsigned char valid; |
---|
98 | } TriangleVertex; |
---|
99 | |
---|
100 | /* functions */ |
---|
101 | extern void MC_WriteTriangleVertex(FILE *fp,TriangleVertex vertex); |
---|
102 | extern TriangleVertex MC_ReadTriangleVertex(FILE *fp); |
---|
103 | |
---|
104 | |
---|
105 | #ifdef __cplusplus |
---|
106 | } |
---|
107 | #endif |
---|
108 | |
---|