ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/object.h
Revision: 2.11
Committed: Wed Mar 12 04:59:04 2003 UTC (21 years, 8 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R5
Changes since 2.10: +1 -1 lines
Log Message:
Numerous bug fixes in new mesh code

File Contents

# User Rev Content
1 greg 2.9 /* RCSid $Id$ */
2 greg 1.1 /*
3     * object.h - header file for routines using objects and object sets.
4 greg 2.8 */
5    
6 greg 2.9 #include "copyright.h"
7 greg 1.1
8 greg 2.8 #ifndef OCTREE
9     #define OCTREE int
10     #endif
11    
12 greg 1.1 /*
13     * Object definitions require general specifications
14     * which may include a number of different argument types.
15     * The following structure aids in the storage of such
16     * argument lists.
17     */
18    
19     typedef struct {
20     short nsargs; /* # of string arguments */
21     short nfargs; /* # of real arguments */
22     char **sarg; /* string arguments */
23 greg 1.5 FLOAT *farg; /* real arguments */
24 greg 1.1 #ifdef IARGS
25     short niargs; /* # of integer arguments */
26     long *iarg; /* integer arguments */
27     #endif
28     } FUNARGS;
29    
30 greg 1.3 #define MAXSTR 128 /* maximum string length */
31 greg 1.1
32     /*
33     * An object is defined as an index into an array of
34     * structures containing the object type and specification
35     * and the modifier index.
36     */
37    
38 greg 1.4 #ifndef OBJECT
39     #ifdef BIGMEM
40 gwlarson 2.5 #define OBJECT int4 /* index to object array */
41 greg 1.4 #else
42 gwlarson 2.5 #define OBJECT int2 /* index to object array */
43 greg 1.4 #endif
44     #endif
45 greg 1.1
46     typedef struct {
47     OBJECT omod; /* modifier number */
48     short otype; /* object type number */
49     char *oname; /* object name */
50     FUNARGS oargs; /* object specification */
51     char *os; /* object structure */
52     } OBJREC;
53    
54 greg 1.4 #ifndef MAXOBJBLK
55     #ifdef BIGMEM
56 gwlarson 2.5 #define MAXOBJBLK 65535 /* maximum number of object blocks */
57 greg 1.4 #else
58 gwlarson 2.7 #define MAXOBJBLK 63 /* maximum number of object blocks */
59 greg 1.4 #endif
60     #endif
61 greg 1.1
62     extern OBJREC *objblock[MAXOBJBLK]; /* the object blocks */
63 greg 1.2 extern OBJECT nobjects; /* # of objects */
64 greg 1.1
65 gwlarson 2.6 #define OBJBLKSHFT 9
66     #define OBJBLKSIZ (1<<OBJBLKSHFT) /* object block size */
67     #define objptr(obj) (objblock[(obj)>>OBJBLKSHFT]+((obj)&(OBJBLKSIZ-1)))
68 greg 1.1
69     #define OVOID (-1) /* void object */
70     #define VOIDID "void" /* void identifier */
71    
72     /*
73     * Object sets begin with the number of objects and proceed with
74     * the objects in ascending order.
75     */
76    
77 greg 2.11 #define MAXSET 511 /* maximum object set size */
78 greg 2.3
79 greg 2.8 #define setfree(os) free((void *)(os))
80    
81     extern void (*addobjnotify[])(); /* people to notify of new objects */
82 greg 2.3
83 greg 2.8 #ifdef NOPROTO
84    
85 greg 2.10 extern OBJECT objndx();
86     extern OBJECT lastmod();
87     extern OBJECT modifier();
88     extern OBJECT object();
89 greg 2.8 extern void insertobject();
90     extern void clearobjndx();
91     extern void insertelem();
92     extern void deletelem();
93     extern int inset();
94     extern int setequal();
95     extern void setcopy();
96     extern OBJECT * setsave();
97     extern void setunion();
98     extern void setintersect();
99     extern OCTREE fullnode();
100     extern void objset();
101     extern int dosets();
102     extern void donesets();
103     extern int otype();
104     extern void objerror();
105     extern int readfargs();
106     extern void freefargs();
107     extern void readobj();
108     extern void getobject();
109 greg 2.10 extern OBJECT newobject();
110 greg 2.8 extern void freeobjects();
111     extern int free_os();
112    
113     #else
114     /* defined in modobject.c */
115 greg 2.10 extern OBJECT objndx(OBJREC *op);
116     extern OBJECT lastmod(OBJECT obj, char *mname);
117     extern OBJECT modifier(char *name);
118     extern OBJECT object(char *oname);
119 greg 2.8 extern void insertobject(OBJECT obj);
120     extern void clearobjndx(void);
121     /* defined in objset.c */
122     extern void insertelem(OBJECT *os, OBJECT obj);
123     extern void deletelem(OBJECT *os, OBJECT obj);
124     extern int inset(OBJECT *os, OBJECT obj);
125     extern int setequal(OBJECT *os1, OBJECT *os2);
126     extern void setcopy(OBJECT *os1, OBJECT *os2);
127     extern OBJECT * setsave(OBJECT *os);
128     extern void setunion(OBJECT *osr, OBJECT *os1, OBJECT *os2);
129     extern void setintersect(OBJECT *osr, OBJECT *os1, OBJECT *os2);
130     extern OCTREE fullnode(OBJECT *oset);
131     extern void objset(OBJECT *oset, OCTREE ot);
132     extern int dosets(int (*f)());
133     extern void donesets(void);
134    
135     /* defined in otypes.c */
136     extern int otype(char *ofname);
137     extern void objerror(OBJREC *o, int etyp, char *msg);
138     /* defined in readfargs.c */
139     extern int readfargs(FUNARGS *fa, FILE *fp);
140     extern void freefargs(FUNARGS *fa);
141     /* defined in readobj.c */
142     extern void readobj(char *inpspec);
143     extern void getobject(char *name, FILE *fp);
144 greg 2.10 extern OBJECT newobject();
145 greg 2.8 extern void freeobjects(int firstobj, int nobjs);
146     /* defined in free_os.c */
147     extern int free_os(OBJREC *op);
148    
149 greg 2.10 #endif /* NOPROTO */