DI-Guy SDK Documentation  13.2
diguyAuthorVisualObjectHandle.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2016 VT MAK
4  ** All rights reserved.
5  *********************************************************************/
6 
7 
8 #ifndef __diguyAuthorVisualObjectHandle_H
9 #define __diguyAuthorVisualObjectHandle_H
10 
11 #include <declspec_diguy.h>
12 #include <diguy_typedefs.h>
13 #include <diguy_vector_classes.h>
16 class bdiFarPosition;
17 class bdiGeometryVisualMaterial;
18 class bdiVec3f;
19 
21 
22 
23 /*l
24  ** Function for setting the create function for object handle visual
25  ** subclass objects. This should be called after diguy_author_initialize(),
26  ** but before any scenario is created of loaded.
27  */
29 
30 
31 
32 /*********************************************************************/
47 class BDI_DECLSPEC_diguy diguyAuthorVisualObjectHandle
48 {
49 
50 public:
51 
52  /*l
53  ** Returns the visual material to be used for rendering this object.
54  */
55  diguyAuthorVisualMaterial* get_visual_material();
56 
57  /*l
58  ** The shapes the handle can have.
59  **
60  *i HANDLE_SHAPE_CYLINDER
61  **
62  ** A cylinder oriented along the Z axis, with its base at the
63  ** origin.
64  **
65  *i HANDLE_SHAPE_CONE
66  **
67  ** A cone oriented along the Z axis, with its base at the origin.
68  ** If get_inverted() returns 1, the point will be at the origin.
69  **
70  *i HANDLE_SHAPE_SPHERE
71  **
72  ** A sphere, centered at the origin.
73  **
74  *i HANDLE_SHAPE_PATH_BEAD
75  **
76  ** Usually a plus sign with depth, oriented so it can rotate around
77  ** the X axis.
78  **
79  *i HANDLE_SHAPE_PATH_STOP_SIGN
80  **
81  ** Usually an octagon with depth, oriented so it can rotate around
82  ** the X axis.
83  */
84  enum {
85  HANDLE_SHAPE_CYLINDER = 0,
86  HANDLE_SHAPE_CONE,
87  HANDLE_SHAPE_SPHERE,
88  HANDLE_SHAPE_PATH_BEAD,
89  HANDLE_SHAPE_PATH_STOP_SIGN
90  };
91 
92  /*l
93  ** Returns the handle shape. This will be one of the enum values above.
94  */
95  int get_handle_shape() {return m_handle_shape;}
96 
97  /*l
98  ** Returns the handle radius, for those shapes that have one, including:
99  **
100  *- - cylinder
101  *- - cone
102  *- - sphere
103  *- - path_bead
104  *- - path_stop_sign
105  */
106  float get_radius();
107 
108  /*l
109  ** Returns the handle height, for those shapes that have one, including:
110  **
111  *- - cylinder
112  *- - cone
113  */
114  float get_height();
115 
116  /*l
117  ** Returns the bead depth along the X axis, for those shapes that have
118  ** one, including:
119  **
120  *- - path_bead
121  *- - path_stop_sign
122  */
123  float get_bead_depth();
124 
125  /*
126  * Used for:
127  *
128  ** Returns the bead thickness, for those shapes that have one,
129  ** including:
130  **
131  *- - path_bead
132  */
133  float get_bead_arm_thickness();
134 
135  /*l
136  ** Returns whether the handle shape should be inverted. Valid for:
137  **
138  *- - cone
139  */
140  int get_inverted();
141 
142  /*l
143  ** Returns the position, in meters from the origin, of the object handle
144  ** in the DI-Guy global coordinate system. See
145  ** diguyCharacter::set_position() for a description of the coordinate
146  ** system.
147  */
148  diguyVec3f get_position();
149 
150  /*l
151  ** Returns the high precision position of the object handle.
152  */
153  diguyVec3d get_position_double();
154 
155  /*l
156  ** Returns the orientation, in degrees, of the object handle in the
157  ** DI-Guy global coordinate system. See
158  ** diguyCharacter::set_position() for a description of the coordinate
159  ** system.
160  */
161  diguyVec3f get_orientation();
162 
163  /*l
164  ** Returns the uid (unique identifier) of this object handle.
165  */
166  long get_uid();
167 
168  /*l
169  ** Returns 1 if this visual should be visible, else 0.
170  */
171  int get_visible();
172 
173 
174 /*****************************************************************************/
186  /*l
187  *b Description:
188  **
189  ** See diguyAuthorVisualWaypoint::build() for general information
190  ** about this function.
191  */
192  virtual void build();
193 
194  /*l
195  *b Description:
196  **
197  ** See diguyAuthorVisualWaypoint::unbuild() for general information
198  ** about this function.
199  */
200  virtual void unbuild();
201 
202  /*l
203  *b Description:
204  **
205  ** See diguyAuthorVisualWaypoint::update() for general information
206  ** about this function.
207  **
208  *i DIGUY_GRAPHICS_VISUAL_UPDATE_GEOMETRY
209  **
210  ** Object handles have different shapes based on the handle shape
211  ** returned by get_handle_shape().
212  */
213  virtual void update(int update_flags);
214 
215  /*l
216  *b Description:
217  **
218  ** See diguyAuthorVisualWaypoint::draw() for general information
219  ** about this function.
220  */
221  virtual void draw();
222 
223  /*l
224  *b Description:
225  **
226  ** See diguyAuthorVisualWaypoint::show() for general information
227  ** about this function.
228  */
229  virtual void show();
230 
231  /*l
232  *b Description:
233  **
234  ** See diguyAuthorVisualWaypoint::hide() for general information
235  ** about this function.
236  */
237  virtual void hide();
240 
241 /****************************************************************************/
242 /****************************************************************************/
243 
248 protected:
249 
250  friend class bdiScenarioCharacter;
251  friend class bdiBead;
252  friend class bdiBeadAction;
253  friend class bdiScenarioEditor;
254 
255  // protected constructor and destructor
256  diguyAuthorVisualObjectHandle(void* internal_data);
259  void set_shape_to_selection_disk(float radius = 0.5f,
260  float height = 0.05f);
261  void set_shape_to_selection_cone(float radius = 0.17f,
262  float height = 0.3f);
263  void set_shape_to_sphere(float radius);
264  void set_shape_to_path_bead();
265  void set_shape_to_path_stop_sign();
266  void set_internal_material(bdiGeometryVisualMaterial* mtl); // owns becomes false
268 public:
270 protected:
271 
272  void* m_internal_data;
274  bdiGeometryVisualMaterial* m_internal_material;
275  bool m_owns_internal_material;
276 
277  int m_handle_shape;
278  float m_size1;
279  float m_size2;
280  float m_size3;
281  int m_inverted;
282 
283  bdiFarPosition* m_position;
284  bdiVec3f* m_orientation;
285 
286  long m_uid;
287  int m_visible;
288 };
289 
290 #endif /* __diguyAuthorVisualObjectHandle_H */
291 
Definition: diguy_vector_classes.h:225
Link against: libdiguy
Definition: diguyAuthorVisualObjectHandle.h:42
diguyAuthorVisualObjectHandle * diguyAuthorVisualObjectHandleCreateFunc(void *internal_data)
Definition: diguyAuthorVisualObjectHandle.h:19
void diguy_author_set_object_handle_visual_create_func(diguyAuthorVisualObjectHandleCreateFunc *func)
Function for setting the create function for object handle visual subclass objects.
Definition: diguy_vector_classes.h:73
Summary:
Definition: diguyAuthorVisualMaterial.h:22