DI-Guy SDK Documentation  13.8
diguyAuthorVisualRegionMesh.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2024 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
6 #ifndef __diguyAuthorVisualRegionMesh_H
7 #define __diguyAuthorVisualRegionMesh_H
8 
9 #include <declspec_diguy.h>
12 class diguyVec3f;
13 class diguyRegion;
14 class bdiRenderRegionMeshData;
15 
17 
18 
19 /*l
20  ** Function for setting the create function for region mesh 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 
28 /*********************************************************************/
42 class BDI_DECLSPEC_diguy diguyAuthorVisualRegionMesh
43 {
44 
45 public:
46 
47  /*l
48  ** Returns the visual material to be used for rendering this object.
49  */
50  diguyAuthorVisualMaterial* get_visual_material();
51 
52  /*l
53  ** Returns the diguyRegion object that this visual is associated with.
54  ** Note that one diguyRegion will most likely have multiple region mesh
55  ** visuals.
56  */
57  diguyRegion* get_region();
58 
59  /*l
60  ** Returns the index of the subregion of the associated diguyRegion that
61  ** this visual is part of. This value will be one of the
62  ** diguySubregionIndex enumerated values.
63  */
64  int get_subregion_index();
65 
66  /*l
67  ** Returns the number of quad polygons to be rendered by this visual.
68  ** They should be rendered using the material's brush color.
69  */
70  int get_num_quads();
71 
72  /*l
73  ** Returns one corner of one of the visual's quads. Corner argument
74  ** should be between 0 and 3, quad argument between 0 and the result
75  ** from get_num_quads() - 1.
76  **
77  ** The returned vertex will be relative to the region's origin as
78  ** returned by get_mesh_origin().
79  **
80  ** Note: this will be slow. Use get_quads_data_ptr() if possible.
81  */
82  diguyVec3f get_quad_point(int quad, int corner);
83 
84  /*l
85  ** Returns a pointer to a contiguous data buffer that contains all
86  ** quad polygon data for this visual. There will be four times the
87  ** value returned by get_num_quads() vectors in the data buffer.
88  **
89  ** The returned vertices will be relative to the region's origin as
90  ** returned by get_mesh_origin().
91  */
92  diguyVec3f* get_quads_data_ptr();
93 
94  /*l
95  ** Returns the number of line segment edges to be rendered by this
96  ** visual. They should be rendered using the material's pen color.
97  */
98  int get_num_edges();
99 
100  /*l
101  ** Returns one endpoint of one of the visual's edges. End argument
102  ** should be 0 or 1, edge argument between 0 and the result from
103  ** get_num_edges() - 1.
104  **
105  ** The returned vertex will be relative to the region's origin as
106  ** returned by get_mesh_origin().
107  **
108  ** Note: this will be slow. Use get_edges_data_ptr() if possible.
109  */
110  diguyVec3f get_edge_point(int edge, int end);
111 
112  /*l
113  ** Returns a pointer to a contiguous data buffer that contains all
114  ** line segment edge data for this visual. There will be two times the
115  ** value returned by get_num_edges() vectors in the data buffer.
116  **
117  ** The returned vertices will be relative to the region's origin as
118  ** returned by get_mesh_origin().
119  */
120  diguyVec3f* get_edges_data_ptr();
121 
122  /*l
123  ** Returns the origin of the geometry in the visual. All quads and
124  ** edges will be relative to this origin.
125  */
126  diguyVec3f get_mesh_origin();
127 
128  /*l
129  ** Returns the level at which this mesh should be highlighted. This
130  ** will be 0, 1, or 2. The higher the highlight level, the brighter
131  ** the mesh should appear.
132  **
133  ** It's recommended that for highlight level 0, the colors of the visual
134  ** material be scaled by a factor of 0.6; for highlight level 1, by a
135  ** factor of 0.8; and for highlight level 2 don't scale.
136  **
137  ** Highlight level 2 should have a wider line width than levels 0 or 1.
138  */
139  int get_highlight_level();
140 
141  /*l
142  ** Returns 1 if this visual should be visible, else 0.
143  */
144  int get_visible();
145 
146 
147 /*****************************************************************************/
159  /*l
160  *b Description:
161  **
162  ** build() will be called by DI-Guy when it is time for a
163  ** renderer-specific visual object to be created. All information
164  ** necessary to build the visual should be available via the Accessor
165  ** Functions above when this function is called.
166  **
167  ** It is common for build() and update() to use the same internal,
168  ** user-written function for creating geometry.
169  **
170  *i Immediate Mode:
171  **
172  ** Immediate mode renderers may override this function to create an
173  ** object, for example a vertex array, that may be used when draw() is
174  ** called.
175  **
176  *i Scene Graph:
177  **
178  ** Scene graph renderers almost always override this function to
179  ** create a scene graph node object that is attached to the scene
180  ** graph and updated when update() is called.
181  */
182  virtual void build();
183 
184  /*l
185  *b Description:
186  **
187  ** See diguyAuthorVisualWaypoint::unbuild() for general information
188  ** about this function.
189  */
190  virtual void unbuild();
191 
192  /*l
193  *b Description:
194  **
195  ** See diguyAuthorVisualWaypoint::update() for general information
196  ** about this function. Specifics for this visual type are below.
197  **
198  *i DIGUY_GRAPHICS_VISUAL_UPDATE_GEOMETRY
199  **
200  ** Region mesh visuals need to use calls to get_num_quads(),
201  ** get_quads_data_ptr(), etc. to determine geometry.
202  **
203  *i DIGUY_GRAPHICS_VISUAL_UPDATE_POSITION
204  **
205  ** Region mesh visuals do not use this value. The overall positions
206  ** of polygons that make up the mesh are recomputed and applied
207  ** during an overall geometry update operation.
208  */
209  virtual void update(int update_flags);
210 
211  /*l
212  *b Description:
213  **
214  ** See diguyAuthorVisualWaypoint::draw() for general information
215  ** about this function.
216  */
217  virtual void draw();
218 
219  /*l
220  *b Description:
221  **
222  ** See diguyAuthorVisualWaypoint::show() for general information
223  ** about this function.
224  */
225  virtual void show();
226 
227  /*l
228  *b Description:
229  **
230  ** See diguyAuthorVisualWaypoint::hide() for general information
231  ** about this function.
232  */
233  virtual void hide();
234 
235 
236 
237 
238 /****************************************************************************/
239 /****************************************************************************/
240 
246  static diguyAuthorVisualRegionMeshCreateFunc* s_create_func;
247 
248  diguyAuthorVisualRegionMesh(void* internal_data);
249  virtual ~diguyAuthorVisualRegionMesh();
250 
251  bdiRenderRegionMeshData* m_scripted_object;
252  bdiRenderRegionMeshData* get_scripted_object() {return m_scripted_object;}
253 
254  friend class bdiRenderRegionMeshData;
255 };
256 
257 #endif /* __diguyAuthorVisualRegionMesh_H */
258 
A two-and-a-half-dimensional surface that represents either a navigation mesh or an area that's been ...
Definition: diguyRegion.h:50
diguyAuthorVisualRegionMesh * diguyAuthorVisualRegionMeshCreateFunc(void *internal_data)
Definition: diguyAuthorVisualRegionMesh.h:16
The diguyAuthorVisualRegionMesh class provides an interface for creating supplemental visuals needed ...
Definition: diguyAuthorVisualRegionMesh.h:38
void diguy_author_set_region_mesh_visual_create_func(diguyAuthorVisualRegionMeshCreateFunc *func)
Function for setting the create function for region mesh 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