ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhdobj.h
Revision: 3.1
Committed: Wed Aug 19 17:45:24 1998 UTC (25 years, 7 months ago) by gwlarson
Content type: text/plain
Branch: MAIN
Log Message:
Initial revision

File Contents

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