ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/octree.h
Revision: 2.4
Committed: Mon Aug 24 16:38:44 1998 UTC (25 years, 8 months ago) by gwlarson
Content type: text/plain
Branch: MAIN
Changes since 2.3: +5 -4 lines
Log Message:
changed octree block size and increased node limit to 100 million leaves

File Contents

# User Rev Content
1 greg 1.1 /* Copyright (c) 1986 Regents of the University of California */
2    
3     /* SCCSid "$SunId$ LBL" */
4    
5     /*
6     * octree.h - header file for routines using octrees.
7     *
8     * 7/28/85
9     */
10    
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
14     * to a set of objects. If the octree has a value:
15     *
16     * > -1: it is an index to eight other nodes.
17     *
18     * -1: it is empty
19     *
20     * < -1: it is an index to a set of objects
21     */
22    
23 greg 1.5 #ifndef OCTREE
24     #define OCTREE int
25     #endif
26 greg 1.1
27     #define EMPTY (-1)
28    
29     #define isempty(ot) ((ot) == EMPTY)
30     #define isfull(ot) ((ot) < EMPTY)
31     #define istree(ot) ((ot) > EMPTY)
32    
33     #define oseti(ot) (-(ot)-2) /* object set index */
34 gwlarson 2.4 #define OCTBLKSIZ 04000 /* octree block size */
35     #define octbi(ot) ((ot)>>11) /* octree block index */
36     #define octti(ot) (((ot)&03777)<<3)/* octree index in block */
37 greg 1.1
38 greg 1.5 #ifndef MAXOBLK
39     #ifdef BIGMEM
40 gwlarson 2.4 #define MAXOBLK 32767 /* maximum octree block */
41 greg 1.5 #else
42 gwlarson 2.4 #define MAXOBLK 4095 /* maximum octree block */
43 greg 1.5 #endif
44     #endif
45 greg 1.1
46     extern OCTREE *octblock[MAXOBLK]; /* octree blocks */
47    
48     #define octkid(ot,br) (octblock[octbi(ot)][octti(ot)+br])
49    
50     extern OCTREE octalloc(), combine(), fullnode();
51    
52     /*
53     * The cube structure is used to hold an octree and its cubic
54     * boundaries.
55     */
56    
57     typedef struct {
58     OCTREE cutree; /* the octree for this cube */
59     FVECT cuorg; /* the cube origin */
60     double cusize; /* the cube size */
61     } CUBE;
62    
63     extern CUBE thescene; /* the main scene */
64    
65     /* flags for reading and writing octrees */
66     #define IO_CHECK 0 /* verify file type */
67     #define IO_INFO 01 /* information header */
68     #define IO_SCENE 02 /* objects */
69     #define IO_TREE 04 /* octree */
70     #define IO_FILES 010 /* object file names */
71     #define IO_BOUNDS 020 /* octree boundary */
72     #define IO_ALL (~0) /* everything */
73 greg 1.4 /* octree format identifier */
74     #define OCTFMT "Radiance_octree"
75 greg 1.1 /* magic number for octree files */
76 greg 1.5 #define MAXOBJSIZ 8 /* maximum sizeof(OBJECT) */
77     #define OCTMAGIC ( 4 *MAXOBJSIZ+251) /* increment first value */
78 greg 1.1 /* octree node types */
79     #define OT_EMPTY 0
80     #define OT_FULL 1
81     #define OT_TREE 2
82 greg 1.2 /* return values for surface functions */
83     #define O_MISS 0 /* no intersection */
84     #define O_HIT 1 /* intersection */
85     #define O_IN 2 /* cube contained entirely */