GL Studio C++ Runtime API
gls_glo_file.h
Go to the documentation of this file.
1 /*! \file
2  \brief Provides classes for reading and writing GL Studio Object initialization files
3  (GLO files).
4 
5  \par Copyright Information
6 
7  Copyright (c) 2017 by The DiSTI Corporation.<br>
8  11301 Corporate Blvd; Suite 100<br>
9  Orlando, Florida 32817<br>
10  USA<br>
11  <br>
12  All rights reserved.<br>
13 
14  This Software contains proprietary trade secrets of DiSTI and may not be
15 reproduced, in whole or part, in any form, or by any means of electronic,
16 mechanical, or otherwise, without the written permission of DiSTI. Said
17 permission may be derived through the purchase of applicable DiSTI product
18 licenses which detail the distribution rights of this content and any
19 Derivative Works based on this or other copyrighted DiSTI Software.
20 
21  NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
22 AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
23 PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
24 AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
25 IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
26 PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
27 
28  LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
29 IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
30 INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
31 DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
32 INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
33 INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
34 OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
35 EXCEED FIVE DOLLARS (US$5.00).
36 
37  The aforementioned terms and restrictions are governed by the laws of the
38 State of Florida and the United States of America.
39 
40 */
41 #if !defined( _GLS_GLO_FILE_H_ )
42 # define _GLS_GLO_FILE_H_
43 
44 # include "display_frame.h"
45 # include "dynamic_array.h"
46 # include "gls_include.h"
47 # include "gls_matrix_affine.h"
48 # include "vertex.h"
49 
50  //////////////////// Provides support for creating DLLs ////////////////////////
51 # if( defined( GLS_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
52  && defined( _MSC_VER )
53 # if defined( GLS_EXPORT_GENERATED )
54 # define GLSGEN_GlsGloFile_EXPORT __declspec( dllexport )
55 # else
56 # define GLSGEN_GlsGloFile_EXPORT __declspec( dllimport )
57 # endif
58 # else
59 # define GLSGEN_GlsGloFile_EXPORT
60 # endif
61 
62 namespace disti
63 {
64 // Forward declarations.
65 class GlsGloFileAttribute;
66 
67 // Exception thrown from GlsGloFile contstructor
68 class GLSGEN_GlsGloFile_EXPORT GlsGloFileNotFoundException
69 {
70 };
71 
73 {
74 public:
75  // Forward declarations.
76  class ByteBuffer;
77 
78  static const unsigned int NUM_OBJECTS_OFFSET = 16;
79 
80  /** The size of the timestamp written into the GLO file. */
81  static const unsigned int GLO_FILE_TIMESTAMP_SIZE = 6;
82 
83  // Object Initializer Enumeration
84  enum
85  {
86  // From display_types.h
87  GLS_GLO_INSTANCE_NAME = 1,
88  GLS_GLO_LOCATION,
89  GLS_GLO_ROTATION_POINT,
90  GLS_GLO_ACTION_CALLBACK,
91  GLS_GLO_OBJECT_NAME,
92  GLS_GLO_ATTRIBUTE_NAME,
93  GLS_GLO_TEXTURE_INDEX,
94  GLS_GLO_TEXTURE_REPEAT,
95  GLS_GLO_TEXTURE_MAP_MODE,
96  GLS_GLO_TEXTURE_MIN_FILTER,
97  GLS_GLO_TEXTURE_MAG_FILTER,
98  GLS_GLO_TEXTURE_BLEND_COLOR,
99  GLS_GLO_TEXTURE_ROTATION,
100  GLS_GLO_TEXTURE_SCALE_H,
101  GLS_GLO_TEXTURE_SCALE_V,
102  GLS_GLO_TEXTURE_OFFSET_X,
103  GLS_GLO_TEXTURE_OFFSET_Y,
104  GLS_GLO_POLYGON_MODE,
105  GLS_GLO_POLYGON_END,
106  GLS_GLO_POLYGON_OFFSET,
107  GLS_GLO_COLOR,
108  GLS_GLO_COLOR_MATERIAL_MODE,
109  GLS_GLO_LINE_WIDTH,
110  GLS_GLO_LINE_STIPPLE_PATTERN,
111  GLS_GLO_LINE_STIPPLE_MULTIPLIER,
112  GLS_GLO_VISIBILITY,
113  GLS_GLO_CULLBACKFACE,
114  GLS_GLO_ALPHAMODE,
115  GLS_GLO_ANTIALIAS,
116  GLS_GLO_ZBUFFER,
117  GLS_GLO_SHADING,
118  GLS_GLO_BLINKING,
119  GLS_GLO_BLINK_RATE,
120  GLS_GLO_PICKABLE,
121  GLS_GLO_LIGHTING_ENABLED,
122  GLS_GLO_MATERIAL_INDEX,
123  GLS_GLO_MATERIAL_INDICES,
124  GLS_GLO_DCS_MATRIX,
125  GLS_GLO_COMPONENT_ABSOLUTE_PLACEMENT,
126  GLS_GLO_COMPONENT_EDITOR_TRANSFORM,
127  GLS_GLO_TEXTURE_POINTS,
128 
129  // From component_base.h
130  GLS_GLO_COMPONENT_USE_PARENT_LIGHTING,
131 
132  // From display.h
133  GLS_GLO_NEED_CALCULATE,
134  GLS_GLO_NEED_PREDRAW,
135  GLS_GLO_NUMBER_OF_VERTICES,
136  GLS_GLO_VERTICES,
137  GLS_GLO_NORMALS,
138  GLS_GLO_TEXTURE_COORDINATES,
139 
140  // From gls_cylinder.h
141  GLS_GLO_CYLINDER_COLOR,
142  GLS_GLO_CYLINDER_SEGMENTS,
143  GLS_GLO_CYLINDER_FACES,
144  GLS_GLO_CYLINDER_FACE_START,
145  GLS_GLO_CYLINDER_FACE_END,
146  GLS_GLO_CYLINDER_TOP_SIZE,
147  GLS_GLO_CYLINDER_BOTTOM_SIZE,
148  GLS_GLO_CYLINDER_TOP_FACE,
149  GLS_GLO_CYLINDER_BOTTOM_FACE,
150  GLS_GLO_CYLINDER_RADII,
151 
152  // From gls_eyepoint.h
153  GLS_GLO_EYEPOINT_FOV,
154  GLS_GLO_EYEPOINT_ORTHOGRAPHIC,
155  GLS_GLO_EYEPOINT_ORTHO_SIZE,
156  GLS_GLO_EYEPOINT_FOV_IS_HORIZONTAL,
157  GLS_GLO_EYEPOINT_ASPECT,
158  GLS_GLO_EYEPOINT_NEAR_CLIP,
159  GLS_GLO_EYEPOINT_FAR_CLIP,
160  GLS_GLO_EYEPOINT_MAINTAIN_ASPECT,
161  GLS_GLO_EYEPOINT_VIEW_VECTORS,
162  GLS_GLO_EYEPOINT_OTHER_FOV,
163  GLS_GLO_EYEPOINT_OTHER_ORTHO_SIZE,
164  GLS_GLO_EYEPOINT_HORIZONTAL_CONSTRAINT,
165  GLS_GLO_EYEPOINT_VERTICAL_CONSTRAINT,
166 
167  // From gls_light_source.h
168  GLS_GLO_LIGHT_SOURCE_AMBIENT,
169  GLS_GLO_LIGHT_SOURCE_DIFFUSE,
170  GLS_GLO_LIGHT_SOURCE_SPECULAR,
171  GLS_GLO_LIGHT_SOURCE_SPOT_CUTOFF,
172  GLS_GLO_LIGHT_SOURCE_SPOT_EXPONENT,
173  GLS_GLO_LIGHT_SOURCE_CONSTANT_ATTENUATION,
174  GLS_GLO_LIGHT_SOURCE_LINEAR_ATTENUATION,
175  GLS_GLO_LIGHT_SOURCE_QUADRATIC_ATTENUATION,
176  GLS_GLO_LIGHT_SOURCE_LIGHT_TYPE,
177 
178  // From gls_sphere.h
179  GLS_GLO_SPHERE_MAPPING,
180  GLS_GLO_SPHERE_COLOR,
181  GLS_GLO_SPHERE_STACKS,
182  GLS_GLO_SPHERE_SLICES,
183  GLS_GLO_SPHERE_SLICE_START,
184  GLS_GLO_SPHERE_SLICE_END,
185  GLS_GLO_SPHERE_STACK_START,
186  GLS_GLO_SPHERE_STACK_END,
187  GLS_GLO_SPHERE_RADII,
188 
189  // from gls_text.h
190  GLS_GLO_TEXT_BORDER,
191  GLS_GLO_TEXT_CELL_HEIGHT,
192  GLS_GLO_TEXT_CELL_WIDTH,
193  GLS_GLO_TEXT_CONSTRAIN_CELL_RATIO,
194  GLS_GLO_TEXT_CONTROL_CELL_SIZE,
195  GLS_GLO_TEXT_FONT,
196  GLS_GLO_TEXT_HALO,
197  GLS_GLO_TEXT_LINESPACING,
198  GLS_GLO_TEXT_LOCK_CELL_SIZE,
199  GLS_GLO_TEXT_JUSTIFY,
200  GLS_GLO_TEXT_SHADOW,
201  GLS_GLO_TEXT_STRING,
202  GLS_GLO_TEXT_UPPERCASE,
203  GLS_GLO_TEXT_WRAP,
204  GLS_GLO_TEXT_HALO_COLOR,
205  GLS_GLO_TEXT_SHADOW_COLOR,
206  GLS_GLO_TEXT_SHADOW_DISTANCE,
207  GLS_GLO_TEXT_BASELINE,
208  GLS_GLO_TEXT_BG_COLOR,
209  GLS_GLO_TEXT_TEXT_COLOR,
210  GLS_GLO_TEXT_CHAR_SCALING,
211  GLS_GLO_TEXT_CHAR_SPACING,
212  GLS_GLO_TEXT_FAUX_BOLD,
213  GLS_GLO_TEXT_INVERSE,
214  GLS_GLO_TEXT_STRIKE_THRU,
215  GLS_GLO_TEXT_UNDERLINE,
216 
217  // From gltrimesh.h
218  GLS_GLO_TRIMESH_FIRST_VALUE,
219  GLS_GLO_TRIMESH_USE_DISPLAY_LIST,
220  GLS_GLO_TRIMESH_FACES,
221 
222  // From gls_3d_cable.h
223  GLS_GLO_3DCABLE_FIRST_VALUE,
224  GLS_GLO_3DCABLE_FLEXIBILITY,
225  GLS_GLO_3DCABLE_NUMBEROFSEGMENTS,
226  GLS_GLO_3DCABLE_NUMBEROFSIDES,
227  GLS_GLO_3DCABLE_RADIUS,
228  GLS_GLO_3DCABLE_LENGTH,
229  GLS_GLO_3DCABLE_GRAVITY,
230  GLS_GLO_3DCABLE_SECTIONSLACKPCT,
231  GLS_GLO_3DCABLE_SECTIONFLOORDIST,
232  GLS_GLO_3DCABLE_COLLISIONSTYLE,
233  GLS_GLO_3DCABLE_FILLCOLOR,
234  GLS_GLO_3DCABLE_LINECOLOR,
235 
236  // From gls_button.h
237  GLS_GLO_GLSBUTTON_CHANGE_CALLBACK,
238  GLS_GLO_GLSBUTTON_TOGGLE,
239  GLS_GLO_GLSBUTTON_WHICH_OBJ_POS_UP,
240  GLS_GLO_GLSBUTTON_WHICH_OBJ_POS_DOWN,
241  GLS_GLO_GLSBUTTON_STATE,
242  GLS_GLO_GLSBUTTON_EMIT_STATE_CHANGE_EVENT,
243 
244  // From gls_angular_scale.h
245  GLS_GLO_ANGULAR_SCALE_FIRST_VALUE,
246  GLS_GLO_ANGULAR_SCALE_RADII,
247  GLS_GLO_ANGULAR_SCALE_DECONFLICT_TICKS,
248  GLS_GLO_ANGULAR_SCALE_HALO_ENABLED,
249  GLS_GLO_ANGULAR_SCALE_HALO_WIDTH,
250  GLS_GLO_ANGULAR_SCALE_HALO_COLOR,
251  GLS_GLO_ANGULAR_SCALE_USE_SCALABLE_LINES,
252  GLS_GLO_ANGULAR_SCALE_RADIUS,
253  GLS_GLO_ANGULAR_SCALE_DATA,
254 
255  // From gls_clipping_group.h
256  GLS_GLO_CLIPPING_GROUP_STATE,
257  GLS_GLO_CLIPPING_GROUP_CLIPPING_ACTIVE,
258  GLS_GLO_CLIPPING_GROUP_BOTTOM_LEFT_CORNER,
259  GLS_GLO_CLIPPING_GROUP_TOP_RIGHT_CORNER,
260  GLS_GLO_CLIPPING_GROUP_SHOW_OUTLINE,
261 
262  // From gls_dynamic_path.h
263  GLS_GLO_DYNAMICPATH_FIRST_VALUE,
264  GLS_GLO_DYNAMICPATH_AFFECTS_LOCATION_X,
265  GLS_GLO_DYNAMICPATH_AFFECTS_LOCATION_Y,
266  GLS_GLO_DYNAMICPATH_AFFECTS_LOCATION_Z,
267  GLS_GLO_DYNAMICPATH_AFFECTS_ROTATION_X,
268  GLS_GLO_DYNAMICPATH_AFFECTS_ROTATION_Y,
269  GLS_GLO_DYNAMICPATH_AFFECTS_ROTATION_Z,
270  GLS_GLO_DYNAMICPATH_AFFECTS_SCALE_X,
271  GLS_GLO_DYNAMICPATH_AFFECTS_SCALE_Y,
272  GLS_GLO_DYNAMICPATH_AFFECTS_SCALE_Z,
273  GLS_GLO_DYNAMICPATH_USE_SHORT_ROTATION_PATHS,
274  GLS_GLO_DYNAMICPATH_STATE_COUNT,
275  GLS_GLO_DYNAMICPATH_STATE,
276 
277  // From gls_mutex_group.h
278  GLS_GLO_MUTEX_GROUP_STATE,
279  GLS_GLO_MUTEX_GROUP_CALC_INVISIBLE_STATES,
280  GLS_GLO_MUTEX_GROUP_PICK_INVISIBLE_STATES,
281  GLS_GLO_MUTEX_GROUP_PREDRAW_INVISIBLE_STATES,
282  GLS_GLO_MUTEX_GROUP_INPUT_DEVICE_BEHAVIOR,
283 
284  // From gls_multi_view.h
285  GLS_GLO_GLSMULTIVIEW_FIRST_VALUE,
286  GLS_GLO_GLSMULTIVIEW_VIEW_DATA,
287  GLS_GLO_GLSMULTIVIEW_VIEW_DRAWING_STATE,
288 
289  // From gls_linear_scale.h
290  GLS_GLO_LINEAR_SCALE_FIRST_VALUE,
291  GLS_GLO_LINEAR_SCALE_RADII,
292  GLS_GLO_LINEAR_SCALE_DECONFLICT_TICKS,
293  GLS_GLO_LINEAR_SCALE_HALO_ENABLED,
294  GLS_GLO_LINEAR_SCALE_HALO_WIDTH,
295  GLS_GLO_LINEAR_SCALE_HALO_COLOR,
296  GLS_GLO_LINEAR_SCALE_TICK_ANCHOR,
297  GLS_GLO_LINEAR_SCALE_USE_SCALABLE_LINES,
298  GLS_GLO_LINEAR_SCALE_DATA,
299 
300  // From gls_knob.h
301  GLS_GLO_GLSKNOB_CHANGE_CALLBACK,
302  GLS_GLO_GLSKNOB_ANGLERANGE,
303  GLS_GLO_GLSKNOB_CONTINUOUS,
304  GLS_GLO_GLSKNOB_POSITIONVAL,
305  GLS_GLO_GLSKNOB_DETENTPOSITIONS,
306  GLS_GLO_GLSKNOB_WHICHOBJECT,
307  GLS_GLO_GLSKNOB_STARTANGLE,
308  GLS_GLO_GLSKNOB_EMITDETENTVALEVENT,
309  GLS_GLO_GLSKNOB_EMITPOSITIONVALEVENT,
310  GLS_GLO_GLSKNOB_EMITLIMITEVENT,
311  GLS_GLO_GLSKNOB_EMITRELEASEEVENT,
312  GLS_GLO_GLSKNOB_SHOWDETENTSONLY,
313  GLS_GLO_GLSKNOB_CLICKSELECTSDETENT,
314 
315  // From gls_ellipse.h
316  GLS_GLO_ELLIPSE_FIRST_VALUE,
317  GLS_GLO_ELLIPSE_RADII,
318  GLS_GLO_ELLIPSE_THICKNESS,
319  GLS_GLO_ELLIPSE_SOLID,
320  GLS_GLO_ELLIPSE_INTERVAL,
321  GLS_GLO_ELLIPSE_START_ANGLE,
322  GLS_GLO_ELLIPSE_END_ANGLE,
323  GLS_GLO_ELLIPSE_COLOR,
324 
325  // From gls_switch.h
326  GLS_GLO_GLSSWITCH_INITIAL_DETENT_VAL,
327  GLS_GLO_GLSSWITCH_WHICH_OBJECT_BACKGROUND,
328  GLS_GLO_GLSSWITCH_FIRST_DETENT_SNAPBACK,
329  GLS_GLO_GLSSWITCH_LAST_DETENT_SNAPBACK,
330  GLS_GLO_GLSSWITCH_EMIT_DETENT_VAL_EVENT,
331  GLS_GLO_GLSSWITCH_EMIT_LIMIT_EVENT,
332  GLS_GLO_GLSSWITCH_EMIT_RELEASE_EVENT,
333 
334  // From gls_thumb_wheel.h
335  GLS_GLO_GLSTHUMBWHEEL_INITIAL_VAL,
336  GLS_GLO_GLSTHUMBWHEEL_EMIT_DETENT_VAL_EVENT,
337  GLS_GLO_GLSTHUMBWHEEL_EMIT_LIMIT_EVENT,
338  GLS_GLO_GLSTHUMBWHEEL_EMIT_RELEASE_EVENT,
339  GLS_GLO_GLSTHUMBWHEEL_NUMBER_OF_DETENTS,
340  GLS_GLO_GLSTHUMBWHEEL_CONTINUOUS_DRAG,
341  GLS_GLO_GLSTHUMBWHEEL_DETENT_VAL,
342  GLS_GLO_GLSTHUMBWHEEL_WHICH_OBJECT_THUMBWHEEL,
343  GLS_GLO_GLSTHUMBWHEEL_WHICH_OBJECT_ODOMETER,
344  GLS_GLO_GLSTHUMBWHEEL_SOUND_INDEX,
345 
346  // From gls_text_grid.h
347  GLS_GLO_TEXT_GRID_SIZE,
348  GLS_GLO_TEXT_GRID_LEFT_TO_RIGHT,
349 
350  // From gls_schematic_tee_interconnect.h
351  GLS_GLO_SCHEMATICTEEINTERCONNECT_FIRST_VALUE,
352  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_LINE_THICKNESS,
353  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_LINE_THICKNESS,
354  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_LINE_THICKNESS,
355  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_INTERCONNECT_TEXTURE_INDEX,
356  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_INTERCONNECT_TEXTURE_INDEX,
357  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_INTERCONNECT_TEXTURE_INDEX,
358  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_INTERCONNECT_TEXTURE_REPEAT_LENGTH,
359  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_INTERCONNECT_TEXTURE_REPEAT_LENGTH,
360  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_INTERCONNECT_TEXTURE_REPEAT_LENGTH,
361  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_FLOW_TEXTURE_INDEX,
362  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_FLOW_TEXTURE_INDEX,
363  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_FLOW_TEXTURE_INDEX,
364  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_FLOW_TEXTURE_REPEAT_LENGTH,
365  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_FLOW_TEXTURE_REPEAT_LENGTH,
366  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_FLOW_TEXTURE_REPEAT_LENGTH,
367  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_SHOW_FLOW,
368  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_SHOW_FLOW,
369  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_SHOW_FLOW,
370  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_FLOW_RATE,
371  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_FLOW_RATE,
372  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_FLOW_RATE,
373  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_SHOW_FLOW_BLINK,
374  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_SHOW_FLOW_BLINK,
375  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_SHOW_FLOW_BLINK,
376  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_FLOW_BLINK_RATE,
377  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_FLOW_BLINK_RATE,
378  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_FLOW_BLINK_RATE,
379  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_FLOW_BLINK_START_COLOR,
380  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_FLOW_BLINK_START_COLOR,
381  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_FLOW_BLINK_START_COLOR,
382  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_FLOW_BLINK_END_COLOR,
383  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_FLOW_BLINK_END_COLOR,
384  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_FLOW_BLINK_END_COLOR,
385  GLS_GLO_SCHEMATICTEEINTERCONNECT_USE_DISPLAY_LIST,
386  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_VISIBLE,
387  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_LINE_THICKNESS,
388  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_INTERCONNECT_TEXTURE_INDEX,
389  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_INTERCONNECT_TEXTURE_REPEAT_LENGTH,
390  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_FLOW_TEXTURE_INDEX,
391  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_FLOW_TEXTURE_REPEAT_LENGTH,
392  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_SHOW_FLOW,
393  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_FLOW_RATE,
394  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_SHOW_FLOW_BLINK,
395  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_FLOW_BLINK_RATE,
396  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_FLOW_BLINK_START_COLOR,
397  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_FLOW_BLINK_END_COLOR,
398 
399  // From gls_schematic_polyline_interconnect.h
400  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_FIRST_VALUE,
401  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_ORIENTATION,
402  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_LINE_THICKNESS,
403  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_ROUNDED_CORNERS,
404  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_CORNER_RADIUS,
405  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_FORCE_EXACT_CORNER_RADIUS,
406  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_CORNER_SEGMENTS,
407  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_INTERCONNECT_TEXTURE_REPEAT_LENGTH,
408  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_FLOW_TEXTURE_INDEX,
409  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_FLOW_TEXTURE_REPEAT_LENGTH,
410  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_SHOW_FLOW,
411  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_FLOW_RATE,
412  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_SHOW_FLOW_BLINK,
413  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_FLOW_BLINK_RATE,
414  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_FLOW_BLINK_START_COLOR,
415  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_FLOW_BLINK_END_COLOR,
416  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_USE_DISPLAY_LIST,
417 
418  // From gls_poly_line.h
419  GLS_GLO_POLY_LINE_FIRST_VALUE,
420  GLS_GLO_POLY_LINE_THICKNESS,
421  GLS_GLO_POLY_LINE_HALO,
422  GLS_GLO_POLY_LINE_HALO_COLOR,
423  GLS_GLO_POLY_LINE_HALO_THICKNESS,
424  GLS_GLO_POLY_LINE_NORMAL,
425 
426  // From gls_path_manager.h
427  GLS_GLO_PATHMANAGER_FIRST_VALUE,
428  GLS_GLO_PATHMANAGER_PATHOBJPAIR_COUNT,
429  GLS_GLO_PATHMANAGER_PATHOBJPAIR,
430 
431  // From gls_odometer.h
432  GLS_GLO_GLSODOMETER_VALUE,
433  GLS_GLO_GLSODOMETER_MIN_VALUE,
434  GLS_GLO_GLSODOMETER_MAX_VALUE,
435  GLS_GLO_GLSODOMETER_BASE_SYSTEM,
436  GLS_GLO_GLSODOMETER_BEHAVIOR_TYPE,
437  GLS_GLO_GLSODOMETER_GEOMETRY_TYPE,
438  GLS_GLO_GLSODOMETER_TEXTURE_SCALE,
439  GLS_GLO_GLSODOMETER_DEGREES_PER_DIGIT,
440  GLS_GLO_GLSODOMETER_ORDER_OF_MAGNITUDE,
441  GLS_GLO_GLSODOMETER_ROLLOVER_THRESHOLD,
442 
443  // From gls_nurb_curve.h
444  GLS_GLO_GLSNURBCURVE_FIRST_VALUE,
445  GLS_GLO_GLSNURBCURVE_EMITEVENT,
446 
447  // From gls_nine_patch.h
448  GLS_GLO_NINE_PATCH_FIRST_VALUE,
449  GLS_GLO_NINE_PATCH_CENTER_VISIBLE,
450  GLS_GLO_NINE_PATCH_EDGES,
451  GLS_GLO_NINE_PATCH_TEXTURE_EDGES,
452  GLS_GLO_NINE_PATCH_RADII,
453  GLS_GLO_NINE_PATCH_TEXTURE_POINTS,
454  GLS_GLO_NINE_PATCH_COLOR,
455 
456  // From serial_morph_mesh.h
457  GLS_GLO_SERIAL_MORPH_MESH_KEYFRAME_INDEX,
458 
459  // From gls_geometry_resource_mesh.h
460  GLS_GLO_GEOMETRY_RESOURCE_MESH_DATA,
461  GLS_GLO_GEOMETRY_RESOURCE_MESH_TRANSFORM,
462  GLS_GLO_GEOMETRY_RESOURCE_MESH_REFERENCE,
463  GLS_GLO_GEOMETRY_RESOURCE_MESH_INDEX_BUF_EFFECTS,
464 
465  // From gls_lod_group.h
466  GLS_GLO_LOD_GROUP_DISTANCE_RANGE,
467  GLS_GLO_LOD_GROUP_LOD_POSITIONS,
468 
469  // From gls_text_box.h
470  GLS_GLO_TEXT_BOX_VERTICAL_ALIGNMENT,
471  GLS_GLO_TEXT_BOX_LEFT_TO_RIGHT,
472 
473  // From gls_ctl_text_box.h
474  GLS_GLO_CTL_TEXT_BOX_VERTICAL_ALIGNMENT,
475  GLS_GLO_CTL_TEXT_BOX_ELLIPSIZE_MODE,
476  GLS_GLO_CTL_TEXT_BOX_HORIZONTAL_SCALE,
477  GLS_GLO_CTL_TEXT_BOX_VERTICAL_SCALE,
478 
479  // From gls_linear_float_controller.h
480  GLS_GLO_LINEAR_FLOAT_CONTROLLER_KEYARRAY,
481 
482  // From gls_moving_eye.h
483  GLS_GLO_MOVINGEYE_EMIT_EVENT,
484  GLS_GLO_MOVINGEYE_LOOK_AT_OBJECT,
485  GLS_GLO_MOVINGEYE_MAX_SPEED,
486  GLS_GLO_MOVINGEYE_MOVEMENT,
487  GLS_GLO_MOVINGEYE_ROUTE,
488  GLS_GLO_MOVINGEYE_DISABLE_HISTORY,
489 
490  // From gls_mimic_group.h
491  GLS_GLO_MIMIC_GROUP_MIMIC_ACTIVE,
492  GLS_GLO_MIMIC_GROUP_BOTTOM_LEFT_CORNER,
493  GLS_GLO_MIMIC_GROUP_TOP_RIGHT_CORNER,
494  GLS_GLO_MIMIC_GROUP_SHOW_OUTLINE,
495  GLS_GLO_MIMIC_GROUP_TEXTURE_HEIGHT,
496  GLS_GLO_MIMIC_GROUP_TEXTURE_WIDTH,
497  GLS_GLO_MIMIC_GROUP_HAS_DEPTH_BUFFER,
498  GLS_GLO_MIMIC_GROUP_DEPTH_TEST,
499  GLS_GLO_MIMIC_GROUP_GENERATE_MIPMAPS,
500  GLS_GLO_MIMIC_GROUP_DRAW_MIMIC_POLYGON,
501  GLS_GLO_MIMIC_GROUP_ATTACHED_TEXTURE_INDEX,
502  GLS_GLO_MIMIC_GROUP_CLEAR_COLOR,
503  GLS_GLO_MIMIC_GROUP_USE_OPAQUE_TEXTURE,
504 
505  GLS_GLO_TEXT_SHADOW_OFFSET
506  };
507 
509  {
510  char magic[ 4 ]; // 'GLO\0'
511  int glsMajor; // GL Studio major version
512  int glsMinor; // GL Studio minor version
513  int glsBuild; // GL Studio build version
514  unsigned int numObjects; // Number of objects in this file
515  unsigned char timestamp[ GLO_FILE_TIMESTAMP_SIZE ]; // Time signature for this file
516  char padding[ 2 ];
517  };
518 
519  enum
520  {
521  TEXTURE_PRESENT = 0x01,
522  MATERIAL_PRESENT = 0x02
523  };
524 
526  {
527  unsigned int numberOfFaces; // Number of faces in the array
528  int defaultTexture; // Default texture for faces if none present in file
529  unsigned int defaultMaterial; // Default materia for faces if none present in file
530  unsigned char indexSize; // Size of each index in bytes (a,b,c)
531  unsigned char textureSize; // Size of texture index in bytes
532  unsigned char materialSize; // Size of material index in bytes
533  unsigned char componentsPresent; // bitfield
534  // 0x01 Textures present in file
535  // 0x02 Materials present in file
536  };
537 
538  /** The current version of the GlsGeometryResourceData. */
539  static const int GlsGeometryResourceData_Version = 2;
540 
542  {
543  unsigned int version; // Should be GlsGeometryResourceData_Version
544  unsigned int vertexSize; // Size of a single vertex (in bytes)
545  unsigned int numberOfVertices; // Size of the vertex array
546  unsigned int numberOfIndexBuffers; // Number of index buffers
547 
548  unsigned char numberOfTextureCoords; // Number of texture coords
549  unsigned char numberOfVertexAttribs; // Number of vertex attributes
550  bool hasNormal;
551  bool hasColor;
552 
553  bool hasSecondaryColor;
554  bool hasTangentAttrib;
555  unsigned char tangentAttribIndex;
556  bool hasBinormalAttrib;
557 
558  unsigned char binormalAttribIndex;
559  unsigned char padding1;
560  unsigned short padding2;
561 
562  // The structure is followed by:
563  // numberOfVertices vertex data structures (vertexSize*numberOfVertices bytes)
564  // numberOfIndexBuffers index buffer arrays
565  // Each index buffer array looks like this
566  // unsigned int size;
567  // <list of unsigned ints (size*4 bytes)>
568  };
569 
570  // The current version of the GlsGeometryResourceMeshIndexBufEffects
571  static const int GlsGeometryResourceMeshIndexBufEffects_Version = 2;
572 
574  {
575  unsigned int version; // Should be GlsGeometryResourceData_Version
576  unsigned int effectCount; // Number of effects
577 
578  // The header is followed <effectCount> GlsGeometryResourceMeshIndexBufEffect structures
579  };
580 
582  {
583  unsigned int materialIndex;
584  unsigned int diffuseTextureIndex;
585  unsigned int normalTextureIndex;
586  unsigned int specularTextureIndex;
587  unsigned int reflectionTextureIndex;
588 
589  // new for v2
590  float diffuseAmount;
591  float normalAmount;
592  float specularAmount;
593  float reflectionAmount;
594 
595  bool useVertexColors;
596  bool normalMapFlipGreen;
597  unsigned short padding; // just
598 
599  // diffuse UVW settings
600  float diffuse_uOffset;
601  float diffuse_vOffset;
602  float diffuse_uTiling;
603  float diffuse_vTiling;
604  float diffuse_angle;
605  // normal UVW settings
606  float normal_uOffset;
607  float normal_vOffset;
608  float normal_uTiling;
609  float normal_vTiling;
610  float normal_angle;
611  // specular UVW settings
612  float specular_uOffset;
613  float specular_vOffset;
614  float specular_uTiling;
615  float specular_vTiling;
616  float specular_angle;
617  };
618 
619  class Writer
620  {
621  public:
622  static const unsigned int MAX_STANDARD_ATTR_SIZE = 255;
623 
624  static const unsigned int ATTR_SIZE_EXTENDED = 0;
625 
626  // Create a GLO file writer for the given file
627  Writer( std::string filename, bool open, unsigned char* timestamp );
628 
629  // Destroy the writer
630  ~Writer( void );
631 
632  std::string Filename();
633 
634  std::string BaseFilename();
635 
636  inline unsigned char* Timestamp() { return _timestamp; }
637 
638  // Open file and prepare to write
639  void OpenForWriting( void );
640 
641  void DefaultChecking( bool val ) { _defaultChecking = val; }
642 
643  // Start writing an object record
644  void StartObjectRecord( void );
645 
646  // Add an object attribute to the file for the current object
647  void AddObjectAttribute( GlsGloFileAttribute& attr, void* data );
648 
649  // Methods to add parameters to file
650  void AddBoolean( unsigned int enumerator, bool value );
651  void AddU8( unsigned int enumerator, unsigned char value );
652  void AddU16( unsigned int enumerator, unsigned short value );
653  void AddS16( unsigned int enumerator, short value );
654  void AddU32( unsigned int enumerator, unsigned int value );
655  void AddS32( unsigned int enumerator, int value );
656  void AddString( unsigned int enumerator, const std::string& value );
657  void AddCString( unsigned int enumerator, char* value );
658  void AddFloat( unsigned int enumerator, float value );
659  void AddDouble( unsigned int enumerator, double value );
660  void AddVector( unsigned int enumerator, const Vector& value );
661  void AddGlsColor( unsigned int enumerator, const glsColor& value );
662  void AddMatrix( unsigned int enumerator, const GlsMatrixAffineD& value );
663  void AddVertexArray( unsigned int enumerator, unsigned int nVertices, Vertex verts[] );
664  void AddVectorArray( unsigned int enumerator, unsigned int nVertices, Vector verts[] );
665  void AddFloatArray( unsigned int enumerator, unsigned int nVertices, float verts[] );
666  void AddDoubleArray( unsigned int enumerator, unsigned int nVertices, double verts[] );
667  void AddMaterialIndices( unsigned int enumerator, DynamicArray<int> values );
668 
669  // Same as AddVectorArray but only writes X & Y coordinates
670  void AddVector2DArray( unsigned int enumerator, unsigned int nVertices, Vector verts[] );
671 
672  // Use these to write custom data structures to the file
673  unsigned int AddExtendedAttributeHeader( unsigned int enumerator, unsigned int size = 0 );
674  unsigned int AddAttributeHeader( unsigned int enumerator, unsigned char size = 0 );
675 
676  // Methods to add parameters to file, but check for value = default
677  void AddBoolean( unsigned int enumerator, bool value, bool defVal );
678  void AddU8( unsigned int enumerator, unsigned char value, unsigned char defVal );
679  void AddU16( unsigned int enumerator, unsigned short value, unsigned short defVal );
680  void AddS16( unsigned int enumerator, short value, short defVal );
681  void AddU32( unsigned int enumerator, unsigned int value, unsigned int defVal );
682  void AddS32( unsigned int enumerator, int value, int defVal );
683  void AddGlsColor( unsigned int enumerator, const glsColor& value, const glsColor& defVal );
684  void AddFloat( unsigned int enumerator, float value, float defVal );
685  void AddDouble( unsigned int enumerator, double value, double defVal );
686 
687  // Writes data to file. Doesn't write attribute headers, just writes straight data
688  // Data is byte swapped into Big Endian format
689  void WriteU8( unsigned char val );
690  void WriteS8( char val );
691  void WriteU16( unsigned short val );
692  void WriteS16( short val );
693  void WriteU32( unsigned int val );
694  void WriteS32( int val );
695  void WriteFloat( float val );
696  void WriteDouble( double val );
697  void WriteGlsColor( const glsColor& value );
698 
699  // Writes data to file. Doesn't write attribute headers, just writes straight data
700  // Data is byte swapped into Big Endian format. Writes at the specified offset
701  void WriteU8( unsigned char val, unsigned int offset );
702  void WriteU32( unsigned int val, unsigned int offset );
703 
704  // Method to add matrix, but only if it isn't identity
705  void AddMatrix( unsigned int enumerator, const GlsMatrixAffineD& value, bool checkForIdentity );
706 
707  // End the current object record
708  void EndObjectRecord();
709 
710  // Flush the current buffer to disk and rewind
711  void Flush();
712 
713  // Close the file
714  void Close( void );
715 
716  protected:
717  std::string _filename;
718  bool _initialized;
719  FILE* _out;
720  bool _defaultChecking;
721  unsigned char _timestamp[ GLO_FILE_TIMESTAMP_SIZE ];
722 
723  // Current count of the number of objects in the file
724  unsigned int _numObjects;
725 
726  // Current count of the number of params in the current object
727  short _numParams;
728 
729  // Byte buffer to store params in
730  ByteBuffer* _buffer;
731 
732  void WriteFileHeader();
733  };
734 
735  class Reader
736  {
737  public:
738  // Create a GLO file reader for the given file
739  Reader( std::string filename, bool open );
740 
741  // Destroy the reader
742  ~Reader( void );
743 
744  // Open file and prepare to read
745  bool OpenForReading( void );
746 
747  // Get the number of object records in this file
748  unsigned int NumberOfObjectRecords();
749 
750  // Add an object attribute to the file for the current object
751  // Caller must free the returned value when done
752  GlsGloFileAttribute* GetNextObjectAttribute( void );
753 
754  unsigned int GetGLStudioVersionMajor() { return _glsMajor; }
755  unsigned int GetGLStudioVersionMinor() { return _glsMinor; }
756  unsigned int GetGLStudioBuildNumber() { return _glsBuild; }
757 
758  unsigned char* GetTimestamp() { return _timestamp; }
759 
760  // Close the file
761  bool Close( void );
762 
763  // Data retrieval methods.
764  std::string GetString( unsigned int size );
765  std::string GetStringUTF8( unsigned int size );
766  bool GetBoolean();
767  char GetByte();
768  short GetShort();
769  int GetInt();
770  float GetFloat();
771  double GetDouble();
772  unsigned int GetBytes( unsigned int size, void* data );
773  glsColor GetColor();
774  void ReadMaterials( DisplayFrame* frame );
775  DynamicArray<int> GetMaterialIndices();
776 
777  unsigned char GetUnsignedByte();
778  unsigned short GetUnsignedShort();
779  unsigned int GetUnsignedInt();
780 
781  bool IsInitialized() { return _initialized; }
782 
783  const std::string& GetFilename() { return _filename; }
784 
785  protected:
786  std::string _filename;
787  bool _initialized;
788  FILE* _in;
789  unsigned int _numberOfObjectRecords;
790  unsigned int _glsMajor;
791  unsigned int _glsMinor;
792  unsigned int _glsBuild;
793  unsigned char _timestamp[ GLO_FILE_TIMESTAMP_SIZE ];
794 
795  // Read the next object from the file
796  bool GetNextObject( void );
797 
798  void ReadBytes( unsigned int size );
799 
800  void ReadHeader();
801  };
802 
804  {
805  public:
806  ObjectData( short numAttributes, Reader* reader );
807  virtual ~ObjectData();
808 
809  bool HasAttributes();
810 
811  GlsGloFileAttribute* GetNextAttribute();
812 
813  protected:
814  short _numAttributesRemaining;
815  Reader* _reader;
816  GlsGloFileAttribute* _lastAttribute;
817  };
818 
819  // constructor - throws GlsGloFileNotFoundException if glow file isn't found.
820  GLSGEN_GlsGloFile_EXPORT GlsGloFile( std::string filename, bool readMode = true, float version = 0.0f );
821  GLSGEN_GlsGloFile_EXPORT ~GlsGloFile();
822  ObjectData GetNextObject();
823  void ReadMaterials( DisplayFrame* frame );
824  GLSGEN_GlsGloFile_EXPORT void VerifyTimestamp( unsigned char* timestamp, const char* className );
825 
826 protected:
827  Reader* _reader;
828  int _numObjectsRemaining;
829 
830  // Stores the name of the file that we're reading; currently only used to make the error
831  // messages more intelligent.
832  std::string _filename;
833 };
834 
836 {
837 public:
838  unsigned int _enumeration;
839  unsigned int _size;
840 
841  GlsGloFileAttribute( unsigned int enumeration, unsigned int size, GlsGloFile::Reader* reader )
842  {
843  _enumeration = enumeration;
844  _size = size;
845  _reader = reader;
846  }
847 
849  {
850  }
851 
852  int SizeRemaining();
853 
854  // Data Retrieval Methods
855  unsigned int Enumeration();
856  std::string GetString();
857  std::string GetStringUTF8();
858  void GetVector( Vector& rval );
859  void GetVertex( Vertex& rval );
860  glsColor GetColor();
861  void GetColor( glsColor& rval );
862  bool GetBoolean();
863  char GetByte();
864  unsigned char GetUnsignedByte();
865  short GetShort();
866  unsigned short GetUnsignedShort();
867  int GetInt();
868  unsigned int GetUnsignedInt();
869  float GetFloat();
870  double GetDouble();
871  unsigned int GetBytes( unsigned int size, void* data );
872  DynamicArray<int> GetMaterialIndices();
873 
874 protected:
875  unsigned int ReduceSizeBy( unsigned int size );
876 
877 private:
878  GlsGloFile::Reader* _reader;
879 };
880 
881 // Byte swapping functions used by this class.
882 float SwapFloatToNet( float val );
883 double SwapDoubleToNet( double val );
884 unsigned int SwapLongToNet( unsigned int val );
885 unsigned int SwapSignedLongToNet( int val );
886 unsigned short SwapShortToNet( unsigned short val );
887 short SwapSignedShortToNet( short val );
888 
889 } // namespace disti
890 
891 #endif
Definition: display_frame.h:83
Definition: vertex.h:408
The disti::DynamicArray class. A templated array of objects capable of dynamically growing...
Definition: gls_glo_file.h:68
The GlsMatrixAffine class.
A file for all GL Studio files to include.
Definition: gls_glo_file.h:835
Definition: gls_glo_file.h:803
Definition: gls_glo_file.h:525
Definition: gls_glo_file.h:72
static const unsigned int GLO_FILE_TIMESTAMP_SIZE
Definition: gls_glo_file.h:81
The disti::Vertex class. A class for manipulating 3D vertices.
Definition: gls_glo_file.h:735
Definition: gls_color.h:53
Definition: gls_glo_file.h:619
The disti::DisplayFrame class.
Definition: gls_glo_file.h:508
Definition: vertex.h:83
Definition: bmpimage.h:46
static const int GlsGeometryResourceData_Version
Definition: gls_glo_file.h:539