2 |
|
/* |
3 |
|
* octree.h - header file for routines using octrees. |
4 |
|
*/ |
5 |
+ |
#ifndef _RAD_OCTREE_H_ |
6 |
+ |
#define _RAD_OCTREE_H_ |
7 |
+ |
#ifdef __cplusplus |
8 |
+ |
extern "C" { |
9 |
+ |
#endif |
10 |
|
|
6 |
– |
#include "copyright.h" |
7 |
– |
|
11 |
|
/* |
12 |
|
* An octree is expressed as an integer which is either |
13 |
|
* an index to eight other nodes, the empty tree, or an index |
39 |
|
#ifdef SMLMEM |
40 |
|
#define MAXOBLK 4095 /* maximum octree block */ |
41 |
|
#else |
42 |
< |
#define MAXOBLK 32767 /* maximum octree block */ |
42 |
> |
#define MAXOBLK 262143 /* maximum octree block */ |
43 |
|
#endif |
44 |
|
#endif |
45 |
|
|
53 |
|
*/ |
54 |
|
|
55 |
|
typedef struct { |
53 |
– |
OCTREE cutree; /* the octree for this cube */ |
56 |
|
FVECT cuorg; /* the cube origin */ |
57 |
|
double cusize; /* the cube size */ |
58 |
+ |
OCTREE cutree; /* the octree for this cube */ |
59 |
|
} CUBE; |
60 |
|
|
61 |
|
extern CUBE thescene; /* the main scene */ |
82 |
|
#define O_HIT 1 /* intersection */ |
83 |
|
#define O_IN 2 /* cube contained entirely */ |
84 |
|
|
82 |
– |
#ifdef NOPROTO |
85 |
|
|
84 |
– |
extern OCTREE octalloc(); |
85 |
– |
extern void octfree(); |
86 |
– |
extern void octdone(); |
87 |
– |
extern OCTREE combine(); |
88 |
– |
extern void culocate(); |
89 |
– |
extern void cucopy(); |
90 |
– |
extern int incube(); |
91 |
– |
extern int readoct(); |
92 |
– |
extern void readscene(); |
93 |
– |
extern void writescene(); |
94 |
– |
|
95 |
– |
#else |
96 |
– |
|
86 |
|
extern OCTREE octalloc(void); |
87 |
|
extern void octfree(OCTREE ot); |
88 |
|
extern void octdone(void); |
89 |
|
extern OCTREE combine(OCTREE ot); |
90 |
|
extern void culocate(CUBE *cu, FVECT pt); |
102 |
– |
extern void cucopy(CUBE *cu1, CUBE *cu2); |
91 |
|
extern int incube(CUBE *cu, FVECT pt); |
92 |
|
|
93 |
|
extern int readoct(char *fname, int load, CUBE *scene, char *ofn[]); |
95 |
|
extern void readscene(FILE *fp, int objsiz); |
96 |
|
extern void writescene(int firstobj, int nobjs, FILE *fp); |
97 |
|
|
98 |
+ |
|
99 |
+ |
#ifdef __cplusplus |
100 |
+ |
} |
101 |
|
#endif |
102 |
+ |
#endif /* _RAD_OCTREE_H_ */ |
103 |
+ |
|