DI-Guy SDK Documentation  13.2
diguyAuthorVisualWaypoint.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2019 VT MAK
4  ** All rights reserved.
5  *********************************************************************/
6 
7 
8 #ifndef __diguyAuthorVisualWaypoint_H
9 #define __diguyAuthorVisualWaypoint_H
10 
11 #include <diguy_typedefs.h>
12 #include <declspec_diguy.h>
15 class diguyWaypoint;
16 class bdiBeadWaypoint;
17 
18 
19 /*l
20  ** Function for setting the create function for waypoint visual subclass
21  ** objects. This should be called after diguy_author_initialize(), but
22  ** before any scenario is created of loaded.
23  */
25 
26 
27 /*********************************************************************/
41 class BDI_DECLSPEC_diguy diguyAuthorVisualWaypoint
42 {
43 
44 public:
45 
46  /*l
47  ** Returns the visual material to be used for rendering this object.
48  */
49  diguyAuthorVisualMaterial* get_visual_material();
50 
51  /*l
52  ** Returns 1 if this visual should be visible, else 0.
53  */
54  int get_visible();
55 
56  /*l
57  ** Returns a pointer to the waypoint this visual is associated with.
58  ** Most of the information needed to create the visual can be retrieved
59  ** using diguyWaypoint function calls.
60  */
61  diguyWaypoint* get_waypoint();
62 
63 
64 
65 
66 /*****************************************************************************/
78  /*l
79  *b Description:
80  **
81  ** build() will be called by DI-Guy when it is time for a
82  ** renderer-specific visual object to be created. All information
83  ** necessary to build the visual should be available via the Accessor
84  ** Functions above when this function is called.
85  **
86  ** It is common for build() and update() to use the same internal,
87  ** user-written function for creating geometry.
88  **
89  ** Waypoints are typically represented by relatively complex set of
90  ** cylinders and cones. The provided reference implementation
91  ** diguyAuthorVisualWaypoint subclass should be consulted for how to
92  ** create waypoint visual components.
93  **
94  *i Immediate Mode:
95  **
96  ** Immediate mode renderers may override this function to create an
97  ** object, for example a vertex array, that may be used when draw() is
98  ** called.
99  **
100  *i Scene Graph:
101  **
102  ** Scene graph renderers almost always override this function to
103  ** create a scene graph node object that is attached to the scene
104  ** graph and updated when update() is called.
105  */
106  virtual void build();
107 
108  /*l
109  *b Description:
110  **
111  ** unbuild() will be called by DI-Guy when it is time for a
112  ** renderer-specific visual object to be destroyed.
113  **
114  ** In general this function should undo all operations and deallocate
115  ** all objects created during the build() function call.
116  */
117  virtual void unbuild();
118 
119  /*l
120  *b Description:
121  **
122  ** update() will be called by DI-Guy when this visual has changed
123  ** state and needs to be updated in some way.
124  **
125  ** The update_flags argument will be a value from the
126  ** diguyAuthorVisualUpdateFlag enumeration:
127  **
128  *i DIGUY_GRAPHICS_VISUAL_UPDATE_GEOMETRY
129  **
130  ** The overall geometry of the visual needs to be updated. This
131  ** means that polygons, lines, and whatever other graphics
132  ** primitives the visual uses need to be recreated.
133  **
134  *i DIGUY_GRAPHICS_VISUAL_UPDATE_POSITION
135  **
136  ** The position and/or orientation of the visual needs to be
137  ** updated. The overall geometry of the visual (polygons, lines,
138  ** etc.) remains unchanged, and don't need to be recreated.
139  **
140  ** If the visual can be relocated via changing the offset of a
141  ** scene graph node it can save time to not recreate a lot of
142  ** geometry.
143  **
144  ** If the visual can't be relocated in such a way, the entire set
145  ** of geometry used by the visual; essentially, doing the same
146  ** operation as for DIGUY_GRAPHICS_VISUAL_UPDATE_GEOMETRY.
147  **
148  *i DIGUY_GRAPHICS_VISUAL_UPDATE_MATERIAL
149  **
150  ** The material of the visual needs to be updated. This can include
151  ** color, fill options, line width, etc. The geometry and position
152  ** of the visual remain the same. The get_visual_material()
153  ** function should be called to retrieve the updated materials.
154  **
155  ** For some renderers it can make more sense to just recreate all of
156  ** the visual geometry with the updated material settings.
157  **
158  *i DIGUY_GRAPHICS_VISUAL_UPDATE_ALL
159  **
160  ** All aspects of the visual need to be updated.
161  */
162  virtual void update(int update_flags);
163 
164  /*l
165  *b Description:
166  **
167  ** draw() will be called by DI-Guy when it is time for a
168  ** renderer-specific visual object to be drawn.
169  **
170  *i Immediate Mode:
171  **
172  ** Immediate mode renderers almost always override this function, to
173  ** draw the visual.
174  **
175  *i Scene Graph:
176  **
177  ** Scene graph renderers usually do not override this function, as
178  ** draw operations are usually taken care of automatically by the
179  ** scene graph.
180  */
181  virtual void draw();
182 
183  /*l
184  *b Description:
185  **
186  ** show() will be called by DI-Guy if the visibility status of this
187  ** visual has changed to be visible.
188  */
189  virtual void show();
190 
191  /*l
192  *b Description:
193  **
194  ** hide() will be called by DI-Guy if the visibility status of this
195  ** visual has changed to be not visible.
196  */
197  virtual void hide();
198 
199 
201 /****************************************************************************/
202 /****************************************************************************/
208 protected:
209 
210  diguyAuthorVisualWaypoint(void* internal_data);
213 public:
214  static diguyAuthorVisualWaypointCreateFunc* s_create_func;
215 protected:
216 
217  bdiBeadWaypoint* m_scripted_object;
218  bdiBeadWaypoint* get_scripted_object() {return m_scripted_object;}
219 
220  diguyAuthorVisualMaterial* m_visual_material;
221 
222  virtual void internal_get_position(float* tx, float* ty, float* tz);
223  virtual void internal_get_orientation(float* rz, float* rx, float* ry);
224 
225  friend class diguyWaypoint;
226  friend class bdiBeadWaypoint;
227 };
228 
229 
230 #endif /* __diguyAuthorVisualWaypoint_H */
231 
void diguy_author_set_waypoint_visual_create_func(diguyAuthorVisualWaypointCreateFunc *func)
Function for setting the create function for waypoint visual subclass objects.
diguyAuthorVisualWaypoint * diguyAuthorVisualWaypointCreateFunc(void *internal_data)
Definition: diguy_typedefs.h:266
Definition: diguyWaypoint.h:29
Link against: libdiguy
Definition: diguyAuthorVisualWaypoint.h:37
Summary:
Definition: diguyAuthorVisualMaterial.h:22