ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhdobj.h
Revision: 3.5
Committed: Thu Dec 31 12:57:06 1998 UTC (25 years, 9 months ago) by gwlarson
Content type: text/plain
Branch: MAIN
Changes since 3.4: +3 -2 lines
Log Message:
fixed redrawing of local objects in OpenGL driver

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","clear","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 -1 if
48 it isn't. If it is a valid command that results in some visible
49 change, return non-zero, otherwise return 0. Error messages should
50 be printed with error(COMMAND,err).
51
52
53 double
54 dobj_trace(nm, rorg, rdir) : check for ray intersection with objects
55 char nm[]; : object name (modified)
56 FVECT rorg, rdir; : ray origin and direction
57
58 Check to see if the given ray intersects the given object,
59 returning the distance the ray traveled if it did, or FHUGE if it didn't.
60 If nm contains "*", then all visible objects are checked and the name
61 of the intersected object is returned, or "" if none. If nm is NULL,
62 then all visible objects are checked, but the name is not returned.
63
64
65 int
66 dobj_render() : render visible objects to OpenGL
67
68 Renders all display objects using OpenGL, assuming desired view has
69 been set. This routine also assumes that the tone-mapping library
70 is being used to set exposure, and it queries this information to
71 adjust light sources as necessary for illuminated objects. Returns
72 the number of objects rendered.
73
74
75 void
76 dobj_cleanup() : clean up data structures
77
78 Frees all allocated data structures and objects.
79
80
81 ++++ The following routines are usually called through dobj_command() ++++
82
83
84 int
85 dobj_load(oct, nam) : create/load an octree object
86 char *oct, *nam; : octree and object name
87
88 Load an octree for rendering as a local object, giving it the indicated name.
89 Returns 1 on success, 0 on failure (with COMMAND error message).
90
91
92 int
93 dobj_unload(nam) : free the named object
94 char *nam; : object name
95
96 Free all memory associated with the named object.
97 Returns 1 on success, 0 on failure (with COMMAND error message).
98
99
100 int
101 dobj_xform(nam, add, ac, av) : set/add transform for nam
102 char *nam; : object name
103 int add; : add to transform or create new one?
104 int ac; : transform argument count
105 char *av[]; : transform arguments
106
107 Set or add to the transform for the named object.
108 Returns 1 on success, 0 on failure (with COMMAND error message).
109
110
111 int
112 dobj_unmove() : undo last transform change
113
114 Undo the last transform change.
115 Returns 1 on success, 0 on failure (with COMMAND error message).
116
117
118 int
119 dobj_dup(oldnm, nam) : duplicate object oldnm as nam
120 char *oldnm, *nam;
121
122 Duplicate the named object and give the copy a new name.
123 Returns 1 on success, 0 on failure (with COMMAND error message).
124
125
126 int
127 dobj_lighting(nam, cn) : set up lighting for display object
128 char *nam; : object name
129 int cn; : new drawing code
130
131 Set the lighting of the named object to DO_SHOW, DO_HIDE or DO_LIGHT.
132 Change lighting of all objects if nam is "*".
133 Returns 1 on success, 0 on failure (with COMMAND error message).
134
135
136 int
137 dobj_putstats(nam, fp) : print object statistics
138 char *nam; : object name
139 FILE *fp; : output file
140
141 Print current position, size and transform for the named object,
142 or all objects if nam is "*".
143 Returns 1 on success, 0 on failure (with COMMAND error message).
144
145
146 ******************************************************************/
147
148
149 extern double dobj_trace();
150
151 extern char rhdcmd[DO_NCMDS][8];
152
153 extern int (*dobj_lightsamp)(); /* pointer to function to get lights */