ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhdobj.h
Revision: 3.9
Committed: Fri Jan 7 20:33:02 2005 UTC (19 years, 2 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad4R2P2, rad5R0, rad5R1, rad3R7P2, rad3R7P1, rad4R2, rad4R1, rad4R0, rad3R8, rad3R9, rad4R2P1, rad5R3, HEAD
Changes since 3.8: +2 -1 lines
Log Message:
Modernized tone-mapping routines with structure pointer r.t. stack

File Contents

# User Rev Content
1 greg 3.9 /* RCSid: $Id: rhdobj.h,v 3.8 2004/01/01 11:21:55 schorsch Exp $ */
2 gwlarson 3.1 /*
3     * Header file for object display routines for rholo drivers.
4     */
5 schorsch 3.7 #ifndef _RAD_RHDOBJ_H_
6     #define _RAD_RHDOBJ_H_
7    
8     #ifdef __cplusplus
9     extern "C" {
10     #endif
11 gwlarson 3.1
12     /* additional user commands */
13     #define DO_LOAD 0 /* load octree object */
14     #define DO_UNLOAD 1 /* unload (free) octree object */
15     #define DO_XFORM 2 /* set/print object transform */
16     #define DO_MOVE 3 /* add to object transform */
17     #define DO_UNMOVE 4 /* undo last transform change */
18     #define DO_DUP 5 /* duplicate object */
19     #define DO_SHOW 6 /* show object (low quality) */
20     #define DO_LIGHT 7 /* illuminate object (high quality) */
21     #define DO_HIDE 8 /* hide object */
22     #define DO_OBJECT 9 /* print object statistics */
23    
24     #define DO_NCMDS 10 /* number of object display commands */
25    
26     /* commands entered on stdin only */
27 gwlarson 3.3 #define DO_INIT {"load","clear","xform","move","unmove","dup",\
28 gwlarson 3.1 "show","light","hide","object"}
29    
30     /*******************************************************************
31     * The following routines are available for calling from the driver:
32    
33     int
34     (*dobj_lightsamp)(c, p, v) : apply next sample for local light sources
35     COLR c; : pixel color (RGBE)
36     FVECT p; : world intersection point
37     FVECT v; : ray direction vector
38    
39     If the pointer to the function dobj_lightsamp is non-NULL, then the
40     dev_value() driver routine should call this rather than use a
41     given sample in its own data structures. This pointer is set
42     in the dobj_lighting() function described below, which may be
43     called indirectly by the dobj_command() function.
44    
45    
46     int
47     dobj_command(cmd, args) : check/run object display command
48     char *cmd, *args; : command name and argument string
49    
50 gwlarson 3.5 Check to see if this is an object display command, and return -1 if
51     it isn't. If it is a valid command that results in some visible
52     change, return non-zero, otherwise return 0. Error messages should
53 gwlarson 3.1 be printed with error(COMMAND,err).
54    
55    
56     double
57 gwlarson 3.2 dobj_trace(nm, rorg, rdir) : check for ray intersection with objects
58     char nm[]; : object name (modified)
59 gwlarson 3.1 FVECT rorg, rdir; : ray origin and direction
60    
61 gwlarson 3.2 Check to see if the given ray intersects the given object,
62 gwlarson 3.1 returning the distance the ray traveled if it did, or FHUGE if it didn't.
63 gwlarson 3.2 If nm contains "*", then all visible objects are checked and the name
64     of the intersected object is returned, or "" if none. If nm is NULL,
65     then all visible objects are checked, but the name is not returned.
66 gwlarson 3.1
67    
68 gwlarson 3.4 int
69 gwlarson 3.1 dobj_render() : render visible objects to OpenGL
70    
71     Renders all display objects using OpenGL, assuming desired view has
72     been set. This routine also assumes that the tone-mapping library
73     is being used to set exposure, and it queries this information to
74 gwlarson 3.4 adjust light sources as necessary for illuminated objects. Returns
75     the number of objects rendered.
76 gwlarson 3.1
77    
78     void
79     dobj_cleanup() : clean up data structures
80    
81     Frees all allocated data structures and objects.
82    
83    
84     ++++ The following routines are usually called through dobj_command() ++++
85    
86    
87     int
88     dobj_load(oct, nam) : create/load an octree object
89     char *oct, *nam; : octree and object name
90    
91     Load an octree for rendering as a local object, giving it the indicated name.
92     Returns 1 on success, 0 on failure (with COMMAND error message).
93    
94    
95     int
96     dobj_unload(nam) : free the named object
97     char *nam; : object name
98    
99     Free all memory associated with the named object.
100     Returns 1 on success, 0 on failure (with COMMAND error message).
101    
102    
103     int
104     dobj_xform(nam, add, ac, av) : set/add transform for nam
105     char *nam; : object name
106     int add; : add to transform or create new one?
107     int ac; : transform argument count
108     char *av[]; : transform arguments
109    
110     Set or add to the transform for the named object.
111     Returns 1 on success, 0 on failure (with COMMAND error message).
112    
113    
114     int
115     dobj_unmove() : undo last transform change
116    
117     Undo the last transform change.
118     Returns 1 on success, 0 on failure (with COMMAND error message).
119    
120    
121     int
122     dobj_dup(oldnm, nam) : duplicate object oldnm as nam
123     char *oldnm, *nam;
124    
125     Duplicate the named object and give the copy a new name.
126     Returns 1 on success, 0 on failure (with COMMAND error message).
127    
128    
129     int
130     dobj_lighting(nam, cn) : set up lighting for display object
131     char *nam; : object name
132     int cn; : new drawing code
133    
134     Set the lighting of the named object to DO_SHOW, DO_HIDE or DO_LIGHT.
135     Change lighting of all objects if nam is "*".
136     Returns 1 on success, 0 on failure (with COMMAND error message).
137    
138    
139     int
140     dobj_putstats(nam, fp) : print object statistics
141     char *nam; : object name
142     FILE *fp; : output file
143    
144     Print current position, size and transform for the named object,
145     or all objects if nam is "*".
146     Returns 1 on success, 0 on failure (with COMMAND error message).
147    
148    
149     ******************************************************************/
150    
151 greg 3.9 extern TMstruct *tmGlobal;
152 gwlarson 3.1
153 schorsch 3.8 extern char rhdcmd[DO_NCMDS][8];
154    
155     /* pointer to function to get lights */
156     extern void (*dobj_lightsamp)(COLR clr, FVECT direc, FVECT pos);
157 gwlarson 3.1
158    
159 schorsch 3.8 extern int dobj_cleanup(void);
160     extern int dobj_command(char *cmd, register char *args);
161     extern int dobj_render(void);
162     extern double dobj_trace(char nm[], FVECT rorg, FVECT rdir);
163     extern int dobj_load(char *oct, char *nam);
164     extern int dobj_unload(char *nam);
165     extern int dobj_xform(char *nam, int rel, int ac, char **av);
166     extern int dobj_putstats(char *nam, FILE *fp);
167     extern int dobj_unmove(void);
168     extern int dobj_dup(char *oldnm, char *nam);
169     extern int dobj_lighting(char *nam, int cn);
170    
171 schorsch 3.7
172     #ifdef __cplusplus
173     }
174     #endif
175     #endif /* _RAD_RHDOBJ_H_ */
176