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