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 DisplayFrame;
66 class GlsGloFileAttribute;
67 
68 // Byte swapping functions used by this class.
69 float SwapFloatToNet( float val );
70 double SwapDoubleToNet( double val );
71 unsigned int SwapLongToNet( unsigned int val );
72 unsigned int SwapSignedLongToNet( int val );
73 unsigned short SwapShortToNet( unsigned short val );
74 short SwapSignedShortToNet( short val );
75 
76 // Exception thrown from GlsGloFile contstructor
77 class GLSGEN_GlsGloFile_EXPORT GlsGloFileNotFoundException
78 {
79 };
80 
82 {
83 public:
84  // Forward declarations.
85  class WriteBuffer;
86 
87  static const unsigned int NUM_OBJECTS_OFFSET = 16;
88 
89  /** The size of the timestamp written into the GLO file. */
90  static const unsigned int GLO_FILE_TIMESTAMP_SIZE = 6;
91 
92  // Object Initializer Enumeration
93  enum
94  {
95  // From display_types.h
96  GLS_GLO_INSTANCE_NAME = 1,
97  GLS_GLO_LOCATION,
98  GLS_GLO_ROTATION_POINT,
99  GLS_GLO_ACTION_CALLBACK,
100  GLS_GLO_OBJECT_NAME,
101  GLS_GLO_ATTRIBUTE_NAME,
102  GLS_GLO_TEXTURE_INDEX,
103  GLS_GLO_TEXTURE_REPEAT,
104  GLS_GLO_TEXTURE_MAP_MODE,
105  GLS_GLO_TEXTURE_MIN_FILTER,
106  GLS_GLO_TEXTURE_MAG_FILTER,
107  GLS_GLO_TEXTURE_BLEND_COLOR,
108  GLS_GLO_TEXTURE_ROTATION,
109  GLS_GLO_TEXTURE_SCALE_H,
110  GLS_GLO_TEXTURE_SCALE_V,
111  GLS_GLO_TEXTURE_OFFSET_X,
112  GLS_GLO_TEXTURE_OFFSET_Y,
113  GLS_GLO_POLYGON_MODE,
114  GLS_GLO_POLYGON_END,
115  GLS_GLO_POLYGON_OFFSET,
116  GLS_GLO_COLOR,
117  GLS_GLO_COLOR_MATERIAL_MODE,
118  GLS_GLO_LINE_WIDTH,
119  GLS_GLO_LINE_STIPPLE_PATTERN,
120  GLS_GLO_LINE_STIPPLE_MULTIPLIER,
121  GLS_GLO_VISIBILITY,
122  GLS_GLO_CULLBACKFACE,
123  GLS_GLO_ALPHAMODE,
124  GLS_GLO_ANTIALIAS,
125  GLS_GLO_ZBUFFER,
126  GLS_GLO_SHADING,
127  GLS_GLO_BLINKING,
128  GLS_GLO_BLINK_RATE,
129  GLS_GLO_PICKABLE,
130  GLS_GLO_LIGHTING_ENABLED,
131  GLS_GLO_MATERIAL_INDEX,
132  GLS_GLO_MATERIAL_INDICES,
133  GLS_GLO_DCS_MATRIX,
134  GLS_GLO_COMPONENT_ABSOLUTE_PLACEMENT,
135  GLS_GLO_COMPONENT_EDITOR_TRANSFORM,
136  GLS_GLO_TEXTURE_POINTS,
137 
138  // From component_base.h
139  GLS_GLO_COMPONENT_USE_PARENT_LIGHTING,
140 
141  // From display.h
142  GLS_GLO_NEED_CALCULATE,
143  GLS_GLO_NEED_PREDRAW,
144  GLS_GLO_NUMBER_OF_VERTICES,
145  GLS_GLO_VERTICES,
146  GLS_GLO_NORMALS,
147  GLS_GLO_TEXTURE_COORDINATES,
148 
149  // From gls_cylinder.h
150  GLS_GLO_CYLINDER_COLOR,
151  GLS_GLO_CYLINDER_SEGMENTS,
152  GLS_GLO_CYLINDER_FACES,
153  GLS_GLO_CYLINDER_FACE_START,
154  GLS_GLO_CYLINDER_FACE_END,
155  GLS_GLO_CYLINDER_TOP_SIZE,
156  GLS_GLO_CYLINDER_BOTTOM_SIZE,
157  GLS_GLO_CYLINDER_TOP_FACE,
158  GLS_GLO_CYLINDER_BOTTOM_FACE,
159  GLS_GLO_CYLINDER_RADII,
160 
161  // From gls_eyepoint.h
162  GLS_GLO_EYEPOINT_FOV,
163  GLS_GLO_EYEPOINT_ORTHOGRAPHIC,
164  GLS_GLO_EYEPOINT_ORTHO_SIZE,
165  GLS_GLO_EYEPOINT_FOV_IS_HORIZONTAL,
166  GLS_GLO_EYEPOINT_ASPECT,
167  GLS_GLO_EYEPOINT_NEAR_CLIP,
168  GLS_GLO_EYEPOINT_FAR_CLIP,
169  GLS_GLO_EYEPOINT_MAINTAIN_ASPECT,
170  GLS_GLO_EYEPOINT_VIEW_VECTORS,
171  GLS_GLO_EYEPOINT_OTHER_FOV,
172  GLS_GLO_EYEPOINT_OTHER_ORTHO_SIZE,
173  GLS_GLO_EYEPOINT_HORIZONTAL_CONSTRAINT,
174  GLS_GLO_EYEPOINT_VERTICAL_CONSTRAINT,
175 
176  // From gls_light_source.h
177  GLS_GLO_LIGHT_SOURCE_AMBIENT,
178  GLS_GLO_LIGHT_SOURCE_DIFFUSE,
179  GLS_GLO_LIGHT_SOURCE_SPECULAR,
180  GLS_GLO_LIGHT_SOURCE_SPOT_CUTOFF,
181  GLS_GLO_LIGHT_SOURCE_SPOT_EXPONENT,
182  GLS_GLO_LIGHT_SOURCE_CONSTANT_ATTENUATION,
183  GLS_GLO_LIGHT_SOURCE_LINEAR_ATTENUATION,
184  GLS_GLO_LIGHT_SOURCE_QUADRATIC_ATTENUATION,
185  GLS_GLO_LIGHT_SOURCE_LIGHT_TYPE,
186 
187  // From gls_sphere.h
188  GLS_GLO_SPHERE_MAPPING,
189  GLS_GLO_SPHERE_COLOR,
190  GLS_GLO_SPHERE_STACKS,
191  GLS_GLO_SPHERE_SLICES,
192  GLS_GLO_SPHERE_SLICE_START,
193  GLS_GLO_SPHERE_SLICE_END,
194  GLS_GLO_SPHERE_STACK_START,
195  GLS_GLO_SPHERE_STACK_END,
196  GLS_GLO_SPHERE_RADII,
197 
198  // from gls_text.h
199  GLS_GLO_TEXT_BORDER,
200  GLS_GLO_TEXT_CELL_HEIGHT,
201  GLS_GLO_TEXT_CELL_WIDTH,
202  GLS_GLO_TEXT_CONSTRAIN_CELL_RATIO,
203  GLS_GLO_TEXT_CONTROL_CELL_SIZE,
204  GLS_GLO_TEXT_FONT,
205  GLS_GLO_TEXT_HALO,
206  GLS_GLO_TEXT_LINESPACING,
207  GLS_GLO_TEXT_LOCK_CELL_SIZE,
208  GLS_GLO_TEXT_JUSTIFY,
209  GLS_GLO_TEXT_SHADOW,
210  GLS_GLO_TEXT_STRING,
211  GLS_GLO_TEXT_UPPERCASE,
212  GLS_GLO_TEXT_WRAP,
213  GLS_GLO_TEXT_HALO_COLOR,
214  GLS_GLO_TEXT_SHADOW_COLOR,
215  GLS_GLO_TEXT_SHADOW_DISTANCE,
216  GLS_GLO_TEXT_BASELINE,
217  GLS_GLO_TEXT_BG_COLOR,
218  GLS_GLO_TEXT_TEXT_COLOR,
219  GLS_GLO_TEXT_CHAR_SCALING,
220  GLS_GLO_TEXT_CHAR_SPACING,
221  GLS_GLO_TEXT_FAUX_BOLD,
222  GLS_GLO_TEXT_INVERSE,
223  GLS_GLO_TEXT_STRIKE_THRU,
224  GLS_GLO_TEXT_UNDERLINE,
225 
226  // From gltrimesh.h
227  GLS_GLO_TRIMESH_FIRST_VALUE,
228  GLS_GLO_TRIMESH_USE_DISPLAY_LIST,
229  GLS_GLO_TRIMESH_FACES,
230 
231  // From gls_3d_cable.h
232  GLS_GLO_3DCABLE_FIRST_VALUE,
233  GLS_GLO_3DCABLE_FLEXIBILITY,
234  GLS_GLO_3DCABLE_NUMBEROFSEGMENTS,
235  GLS_GLO_3DCABLE_NUMBEROFSIDES,
236  GLS_GLO_3DCABLE_RADIUS,
237  GLS_GLO_3DCABLE_LENGTH,
238  GLS_GLO_3DCABLE_GRAVITY,
239  GLS_GLO_3DCABLE_SECTIONSLACKPCT,
240  GLS_GLO_3DCABLE_SECTIONFLOORDIST,
241  GLS_GLO_3DCABLE_COLLISIONSTYLE,
242  GLS_GLO_3DCABLE_FILLCOLOR,
243  GLS_GLO_3DCABLE_LINECOLOR,
244 
245  // From gls_button.h
246  GLS_GLO_GLSBUTTON_CHANGE_CALLBACK,
247  GLS_GLO_GLSBUTTON_TOGGLE,
248  GLS_GLO_GLSBUTTON_WHICH_OBJ_POS_UP,
249  GLS_GLO_GLSBUTTON_WHICH_OBJ_POS_DOWN,
250  GLS_GLO_GLSBUTTON_STATE,
251  GLS_GLO_GLSBUTTON_EMIT_STATE_CHANGE_EVENT,
252 
253  // From gls_angular_scale.h
254  GLS_GLO_ANGULAR_SCALE_FIRST_VALUE,
255  GLS_GLO_ANGULAR_SCALE_RADII,
256  GLS_GLO_ANGULAR_SCALE_DECONFLICT_TICKS,
257  GLS_GLO_ANGULAR_SCALE_HALO_ENABLED,
258  GLS_GLO_ANGULAR_SCALE_HALO_WIDTH,
259  GLS_GLO_ANGULAR_SCALE_HALO_COLOR,
260  GLS_GLO_ANGULAR_SCALE_USE_SCALABLE_LINES,
261  GLS_GLO_ANGULAR_SCALE_RADIUS,
262  GLS_GLO_ANGULAR_SCALE_DATA,
263 
264  // From gls_clipping_group.h
265  GLS_GLO_CLIPPING_GROUP_STATE,
266  GLS_GLO_CLIPPING_GROUP_CLIPPING_ACTIVE,
267  GLS_GLO_CLIPPING_GROUP_BOTTOM_LEFT_CORNER,
268  GLS_GLO_CLIPPING_GROUP_TOP_RIGHT_CORNER,
269  GLS_GLO_CLIPPING_GROUP_SHOW_OUTLINE,
270 
271  // From gls_dynamic_path.h
272  GLS_GLO_DYNAMICPATH_FIRST_VALUE,
273  GLS_GLO_DYNAMICPATH_AFFECTS_LOCATION_X,
274  GLS_GLO_DYNAMICPATH_AFFECTS_LOCATION_Y,
275  GLS_GLO_DYNAMICPATH_AFFECTS_LOCATION_Z,
276  GLS_GLO_DYNAMICPATH_AFFECTS_ROTATION_X,
277  GLS_GLO_DYNAMICPATH_AFFECTS_ROTATION_Y,
278  GLS_GLO_DYNAMICPATH_AFFECTS_ROTATION_Z,
279  GLS_GLO_DYNAMICPATH_AFFECTS_SCALE_X,
280  GLS_GLO_DYNAMICPATH_AFFECTS_SCALE_Y,
281  GLS_GLO_DYNAMICPATH_AFFECTS_SCALE_Z,
282  GLS_GLO_DYNAMICPATH_USE_SHORT_ROTATION_PATHS,
283  GLS_GLO_DYNAMICPATH_STATE_COUNT,
284  GLS_GLO_DYNAMICPATH_STATE,
285 
286  // From gls_mutex_group.h
287  GLS_GLO_MUTEX_GROUP_STATE,
288  GLS_GLO_MUTEX_GROUP_CALC_INVISIBLE_STATES,
289  GLS_GLO_MUTEX_GROUP_PICK_INVISIBLE_STATES,
290  GLS_GLO_MUTEX_GROUP_PREDRAW_INVISIBLE_STATES,
291  GLS_GLO_MUTEX_GROUP_INPUT_DEVICE_BEHAVIOR,
292 
293  // From gls_multi_view.h
294  GLS_GLO_GLSMULTIVIEW_FIRST_VALUE,
295  GLS_GLO_GLSMULTIVIEW_VIEW_DATA,
296  GLS_GLO_GLSMULTIVIEW_VIEW_DRAWING_STATE,
297 
298  // From gls_linear_scale.h
299  GLS_GLO_LINEAR_SCALE_FIRST_VALUE,
300  GLS_GLO_LINEAR_SCALE_RADII,
301  GLS_GLO_LINEAR_SCALE_DECONFLICT_TICKS,
302  GLS_GLO_LINEAR_SCALE_HALO_ENABLED,
303  GLS_GLO_LINEAR_SCALE_HALO_WIDTH,
304  GLS_GLO_LINEAR_SCALE_HALO_COLOR,
305  GLS_GLO_LINEAR_SCALE_TICK_ANCHOR,
306  GLS_GLO_LINEAR_SCALE_USE_SCALABLE_LINES,
307  GLS_GLO_LINEAR_SCALE_DATA,
308 
309  // From gls_knob.h
310  GLS_GLO_GLSKNOB_CHANGE_CALLBACK,
311  GLS_GLO_GLSKNOB_ANGLERANGE,
312  GLS_GLO_GLSKNOB_CONTINUOUS,
313  GLS_GLO_GLSKNOB_POSITIONVAL,
314  GLS_GLO_GLSKNOB_DETENTPOSITIONS,
315  GLS_GLO_GLSKNOB_WHICHOBJECT,
316  GLS_GLO_GLSKNOB_STARTANGLE,
317  GLS_GLO_GLSKNOB_EMITDETENTVALEVENT,
318  GLS_GLO_GLSKNOB_EMITPOSITIONVALEVENT,
319  GLS_GLO_GLSKNOB_EMITLIMITEVENT,
320  GLS_GLO_GLSKNOB_EMITRELEASEEVENT,
321  GLS_GLO_GLSKNOB_SHOWDETENTSONLY,
322  GLS_GLO_GLSKNOB_CLICKSELECTSDETENT,
323 
324  // From gls_ellipse.h
325  GLS_GLO_ELLIPSE_FIRST_VALUE,
326  GLS_GLO_ELLIPSE_RADII,
327  GLS_GLO_ELLIPSE_THICKNESS,
328  GLS_GLO_ELLIPSE_SOLID,
329  GLS_GLO_ELLIPSE_INTERVAL,
330  GLS_GLO_ELLIPSE_START_ANGLE,
331  GLS_GLO_ELLIPSE_END_ANGLE,
332  GLS_GLO_ELLIPSE_COLOR,
333 
334  // From gls_switch.h
335  GLS_GLO_GLSSWITCH_INITIAL_DETENT_VAL,
336  GLS_GLO_GLSSWITCH_WHICH_OBJECT_BACKGROUND,
337  GLS_GLO_GLSSWITCH_FIRST_DETENT_SNAPBACK,
338  GLS_GLO_GLSSWITCH_LAST_DETENT_SNAPBACK,
339  GLS_GLO_GLSSWITCH_EMIT_DETENT_VAL_EVENT,
340  GLS_GLO_GLSSWITCH_EMIT_LIMIT_EVENT,
341  GLS_GLO_GLSSWITCH_EMIT_RELEASE_EVENT,
342 
343  // From gls_thumb_wheel.h
344  GLS_GLO_GLSTHUMBWHEEL_INITIAL_VAL,
345  GLS_GLO_GLSTHUMBWHEEL_EMIT_DETENT_VAL_EVENT,
346  GLS_GLO_GLSTHUMBWHEEL_EMIT_LIMIT_EVENT,
347  GLS_GLO_GLSTHUMBWHEEL_EMIT_RELEASE_EVENT,
348  GLS_GLO_GLSTHUMBWHEEL_NUMBER_OF_DETENTS,
349  GLS_GLO_GLSTHUMBWHEEL_CONTINUOUS_DRAG,
350  GLS_GLO_GLSTHUMBWHEEL_DETENT_VAL,
351  GLS_GLO_GLSTHUMBWHEEL_WHICH_OBJECT_THUMBWHEEL,
352  GLS_GLO_GLSTHUMBWHEEL_WHICH_OBJECT_ODOMETER,
353  GLS_GLO_GLSTHUMBWHEEL_SOUND_INDEX,
354 
355  // From gls_text_grid.h
356  GLS_GLO_TEXT_GRID_SIZE,
357  GLS_GLO_TEXT_GRID_LEFT_TO_RIGHT,
358 
359  // From gls_schematic_tee_interconnect.h
360  GLS_GLO_SCHEMATICTEEINTERCONNECT_FIRST_VALUE,
361  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_LINE_THICKNESS,
362  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_LINE_THICKNESS,
363  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_LINE_THICKNESS,
364  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_INTERCONNECT_TEXTURE_INDEX,
365  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_INTERCONNECT_TEXTURE_INDEX,
366  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_INTERCONNECT_TEXTURE_INDEX,
367  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_INTERCONNECT_TEXTURE_REPEAT_LENGTH,
368  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_INTERCONNECT_TEXTURE_REPEAT_LENGTH,
369  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_INTERCONNECT_TEXTURE_REPEAT_LENGTH,
370  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_FLOW_TEXTURE_INDEX,
371  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_FLOW_TEXTURE_INDEX,
372  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_FLOW_TEXTURE_INDEX,
373  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_FLOW_TEXTURE_REPEAT_LENGTH,
374  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_FLOW_TEXTURE_REPEAT_LENGTH,
375  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_FLOW_TEXTURE_REPEAT_LENGTH,
376  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_SHOW_FLOW,
377  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_SHOW_FLOW,
378  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_SHOW_FLOW,
379  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_FLOW_RATE,
380  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_FLOW_RATE,
381  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_FLOW_RATE,
382  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_SHOW_FLOW_BLINK,
383  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_SHOW_FLOW_BLINK,
384  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_SHOW_FLOW_BLINK,
385  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_FLOW_BLINK_RATE,
386  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_FLOW_BLINK_RATE,
387  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_FLOW_BLINK_RATE,
388  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_FLOW_BLINK_START_COLOR,
389  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_FLOW_BLINK_START_COLOR,
390  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_FLOW_BLINK_START_COLOR,
391  GLS_GLO_SCHEMATICTEEINTERCONNECT_LEFT_FLOW_BLINK_END_COLOR,
392  GLS_GLO_SCHEMATICTEEINTERCONNECT_RIGHT_FLOW_BLINK_END_COLOR,
393  GLS_GLO_SCHEMATICTEEINTERCONNECT_BASE_FLOW_BLINK_END_COLOR,
394  GLS_GLO_SCHEMATICTEEINTERCONNECT_USE_DISPLAY_LIST,
395  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_VISIBLE,
396  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_LINE_THICKNESS,
397  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_INTERCONNECT_TEXTURE_INDEX,
398  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_INTERCONNECT_TEXTURE_REPEAT_LENGTH,
399  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_FLOW_TEXTURE_INDEX,
400  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_FLOW_TEXTURE_REPEAT_LENGTH,
401  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_SHOW_FLOW,
402  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_FLOW_RATE,
403  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_SHOW_FLOW_BLINK,
404  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_FLOW_BLINK_RATE,
405  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_FLOW_BLINK_START_COLOR,
406  GLS_GLO_SCHEMATICTEEINTERCONNECT_TOP_FLOW_BLINK_END_COLOR,
407 
408  // From gls_schematic_polyline_interconnect.h
409  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_FIRST_VALUE,
410  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_ORIENTATION,
411  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_LINE_THICKNESS,
412  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_ROUNDED_CORNERS,
413  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_CORNER_RADIUS,
414  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_FORCE_EXACT_CORNER_RADIUS,
415  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_CORNER_SEGMENTS,
416  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_INTERCONNECT_TEXTURE_REPEAT_LENGTH,
417  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_FLOW_TEXTURE_INDEX,
418  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_FLOW_TEXTURE_REPEAT_LENGTH,
419  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_SHOW_FLOW,
420  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_FLOW_RATE,
421  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_SHOW_FLOW_BLINK,
422  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_FLOW_BLINK_RATE,
423  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_FLOW_BLINK_START_COLOR,
424  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_FLOW_BLINK_END_COLOR,
425  GLS_GLO_SCHEMATICPOLYLINEINTERCONNECT_USE_DISPLAY_LIST,
426 
427  // From gls_poly_line.h
428  GLS_GLO_POLY_LINE_FIRST_VALUE,
429  GLS_GLO_POLY_LINE_THICKNESS,
430  GLS_GLO_POLY_LINE_HALO,
431  GLS_GLO_POLY_LINE_HALO_COLOR,
432  GLS_GLO_POLY_LINE_HALO_THICKNESS,
433  GLS_GLO_POLY_LINE_NORMAL,
434 
435  // From gls_path_manager.h
436  GLS_GLO_PATHMANAGER_FIRST_VALUE,
437  GLS_GLO_PATHMANAGER_PATHOBJPAIR_COUNT,
438  GLS_GLO_PATHMANAGER_PATHOBJPAIR,
439 
440  // From gls_odometer.h
441  GLS_GLO_GLSODOMETER_VALUE,
442  GLS_GLO_GLSODOMETER_MIN_VALUE,
443  GLS_GLO_GLSODOMETER_MAX_VALUE,
444  GLS_GLO_GLSODOMETER_BASE_SYSTEM,
445  GLS_GLO_GLSODOMETER_BEHAVIOR_TYPE,
446  GLS_GLO_GLSODOMETER_GEOMETRY_TYPE,
447  GLS_GLO_GLSODOMETER_TEXTURE_SCALE,
448  GLS_GLO_GLSODOMETER_DEGREES_PER_DIGIT,
449  GLS_GLO_GLSODOMETER_ORDER_OF_MAGNITUDE,
450  GLS_GLO_GLSODOMETER_ROLLOVER_THRESHOLD,
451 
452  // From gls_nurb_curve.h
453  GLS_GLO_GLSNURBCURVE_FIRST_VALUE,
454  GLS_GLO_GLSNURBCURVE_EMITEVENT,
455 
456  // From gls_nine_patch.h
457  GLS_GLO_NINE_PATCH_FIRST_VALUE,
458  GLS_GLO_NINE_PATCH_CENTER_VISIBLE,
459  GLS_GLO_NINE_PATCH_EDGES,
460  GLS_GLO_NINE_PATCH_TEXTURE_EDGES,
461  GLS_GLO_NINE_PATCH_RADII,
462  GLS_GLO_NINE_PATCH_TEXTURE_POINTS,
463  GLS_GLO_NINE_PATCH_COLOR,
464 
465  // From serial_morph_mesh.h
466  GLS_GLO_SERIAL_MORPH_MESH_KEYFRAME_INDEX,
467 
468  // From gls_geometry_resource_mesh.h
469  GLS_GLO_GEOMETRY_RESOURCE_MESH_DATA,
470  GLS_GLO_GEOMETRY_RESOURCE_MESH_TRANSFORM,
471  GLS_GLO_GEOMETRY_RESOURCE_MESH_REFERENCE,
472  GLS_GLO_GEOMETRY_RESOURCE_MESH_INDEX_BUF_EFFECTS,
473 
474  // From gls_lod_group.h
475  GLS_GLO_LOD_GROUP_DISTANCE_RANGE,
476  GLS_GLO_LOD_GROUP_LOD_POSITIONS,
477 
478  // From gls_text_box.h
479  GLS_GLO_TEXT_BOX_VERTICAL_ALIGNMENT,
480  GLS_GLO_TEXT_BOX_LEFT_TO_RIGHT,
481 
482  // From gls_ctl_text_box.h
483  GLS_GLO_CTL_TEXT_BOX_VERTICAL_ALIGNMENT,
484  GLS_GLO_CTL_TEXT_BOX_ELLIPSIZE_MODE,
485  GLS_GLO_CTL_TEXT_BOX_HORIZONTAL_SCALE,
486  GLS_GLO_CTL_TEXT_BOX_VERTICAL_SCALE,
487  GLS_GLO_CTL_TEXT_BOX_TEXT_DIRECTION,
488 
489  // From gls_linear_float_controller.h
490  GLS_GLO_LINEAR_FLOAT_CONTROLLER_KEYARRAY,
491 
492  // From gls_moving_eye.h
493  GLS_GLO_MOVINGEYE_EMIT_EVENT,
494  GLS_GLO_MOVINGEYE_LOOK_AT_OBJECT,
495  GLS_GLO_MOVINGEYE_MAX_SPEED,
496  GLS_GLO_MOVINGEYE_MOVEMENT,
497  GLS_GLO_MOVINGEYE_ROUTE,
498  GLS_GLO_MOVINGEYE_DISABLE_HISTORY,
499 
500  // From gls_mimic_group.h
501  GLS_GLO_MIMIC_GROUP_MIMIC_ACTIVE,
502  GLS_GLO_MIMIC_GROUP_AUTO_REDRAW,
503  GLS_GLO_MIMIC_GROUP_BOTTOM_LEFT_CORNER,
504  GLS_GLO_MIMIC_GROUP_TOP_RIGHT_CORNER,
505  GLS_GLO_MIMIC_GROUP_SHOW_OUTLINE,
506  GLS_GLO_MIMIC_GROUP_TEXTURE_HEIGHT,
507  GLS_GLO_MIMIC_GROUP_TEXTURE_WIDTH,
508  GLS_GLO_MIMIC_GROUP_HAS_DEPTH_BUFFER,
509  GLS_GLO_MIMIC_GROUP_DEPTH_TEST,
510  GLS_GLO_MIMIC_GROUP_GENERATE_MIPMAPS,
511  GLS_GLO_MIMIC_GROUP_DRAW_MIMIC_POLYGON,
512  GLS_GLO_MIMIC_GROUP_ATTACHED_TEXTURE_INDEX,
513  GLS_GLO_MIMIC_GROUP_CLEAR_COLOR,
514  GLS_GLO_MIMIC_GROUP_USE_OPAQUE_TEXTURE,
515 
516  GLS_GLO_TEXT_SHADOW_OFFSET
517  };
518 
519  static const unsigned int MAX_STANDARD_ATTR_SIZE = 255;
520  static const unsigned int ATTR_SIZE_EXTENDED = 0;
521 
523  {
524  char magic[ 4 ]; // 'GLO\0'
525  int glsMajor; // GL Studio major version
526  int glsMinor; // GL Studio minor version
527  int glsBuild; // GL Studio build version
528  unsigned int numObjects; // Number of objects in this file
529  unsigned char timestamp[ GLO_FILE_TIMESTAMP_SIZE ]; // Time signature for this file
530  char padding[ 2 ];
531  };
532 
533  enum
534  {
535  TEXTURE_PRESENT = 0x01,
536  MATERIAL_PRESENT = 0x02
537  };
538 
540  {
541  unsigned int numberOfFaces; // Number of faces in the array
542  int defaultTexture; // Default texture for faces if none present in file
543  unsigned int defaultMaterial; // Default materia for faces if none present in file
544  unsigned char indexSize; // Size of each index in bytes (a,b,c)
545  unsigned char textureSize; // Size of texture index in bytes
546  unsigned char materialSize; // Size of material index in bytes
547  unsigned char componentsPresent; // bitfield
548  // 0x01 Textures present in file
549  // 0x02 Materials present in file
550  };
551 
552  /** The current version of the GlsGeometryResourceData. */
553  static const int GlsGeometryResourceData_Version = 2;
554 
556  {
557  unsigned int version; // Should be GlsGeometryResourceData_Version
558  unsigned int vertexSize; // Size of a single vertex (in bytes)
559  unsigned int numberOfVertices; // Size of the vertex array
560  unsigned int numberOfIndexBuffers; // Number of index buffers
561 
562  unsigned char numberOfTextureCoords; // Number of texture coords
563  unsigned char numberOfVertexAttribs; // Number of vertex attributes
564  bool hasNormal;
565  bool hasColor;
566 
567  bool hasSecondaryColor;
568  bool hasTangentAttrib;
569  unsigned char tangentAttribIndex;
570  bool hasBinormalAttrib;
571 
572  unsigned char binormalAttribIndex;
573  unsigned char padding1;
574  unsigned short padding2;
575 
576  // The structure is followed by:
577  // numberOfVertices vertex data structures (vertexSize*numberOfVertices bytes)
578  // numberOfIndexBuffers index buffer arrays
579  // Each index buffer array looks like this
580  // unsigned int size;
581  // <list of unsigned ints (size*4 bytes)>
582  };
583 
584  // The current version of the GlsGeometryResourceMeshIndexBufEffects
585  static const int GlsGeometryResourceMeshIndexBufEffects_Version = 2;
586 
588  {
589  unsigned int version; // Should be GlsGeometryResourceData_Version
590  unsigned int effectCount; // Number of effects
591 
592  // The header is followed <effectCount> GlsGeometryResourceMeshIndexBufEffect structures
593  };
594 
596  {
597  unsigned int materialIndex;
598  unsigned int diffuseTextureIndex;
599  unsigned int normalTextureIndex;
600  unsigned int specularTextureIndex;
601  unsigned int reflectionTextureIndex;
602 
603  // new for v2
604  float diffuseAmount;
605  float normalAmount;
606  float specularAmount;
607  float reflectionAmount;
608 
609  bool useVertexColors;
610  bool normalMapFlipGreen;
611  unsigned short padding; // just
612 
613  // diffuse UVW settings
614  float diffuse_uOffset;
615  float diffuse_vOffset;
616  float diffuse_uTiling;
617  float diffuse_vTiling;
618  float diffuse_angle;
619  // normal UVW settings
620  float normal_uOffset;
621  float normal_vOffset;
622  float normal_uTiling;
623  float normal_vTiling;
624  float normal_angle;
625  // specular UVW settings
626  float specular_uOffset;
627  float specular_vOffset;
628  float specular_uTiling;
629  float specular_vTiling;
630  float specular_angle;
631  };
632 
633  class Writer
634  {
635  public:
636  static const unsigned int MAX_STANDARD_ATTR_SIZE = 255;
637 
638  static const unsigned int ATTR_SIZE_EXTENDED = 0;
639 
640  // Create a GLO file writer for the given file
641  Writer( const std::string& filename, const bool open, const unsigned char* timestamp );
642 
643  // Destroy the writer
644  ~Writer();
645 
646  std::string Filename();
647 
648  std::string BaseFilename();
649 
650  inline unsigned char* Timestamp() { return _header.timestamp; }
651 
652  // Open file and prepare to write
653  void OpenForWriting( void );
654 
655  void DefaultChecking( bool val ) { _defaultChecking = val; }
656 
657  // Start writing an object record
658  void StartObjectRecord( void );
659 
660  // Add an object attribute to the file for the current object
661  void AddObjectAttribute( const unsigned int enumeration, const unsigned int size, const void* data );
662 
663  // Methods to add parameters to file
664  void AddBoolean( const unsigned int enumerator, const bool value );
665  void AddU8( const unsigned int enumerator, const unsigned char value );
666  void AddU16( const unsigned int enumerator, const unsigned short value );
667  void AddS16( const unsigned int enumerator, const short value );
668  void AddU32( const unsigned int enumerator, const unsigned int value );
669  void AddS32( const unsigned int enumerator, const int value );
670  void AddString( const unsigned int enumerator, const std::string& value );
671  void AddCString( const unsigned int enumerator, const char* value );
672  void AddFloat( const unsigned int enumerator, const float value );
673  void AddDouble( const unsigned int enumerator, const double value );
674  void AddVector( const unsigned int enumerator, const Vector& value );
675  void AddGlsColor( const unsigned int enumerator, const glsColor& value );
676  void AddMatrix( const unsigned int enumerator, const GlsMatrixAffineD& value );
677  void AddVertexArray( const unsigned int enumerator, const unsigned int nVertices, const Vertex verts[] );
678  void AddVectorArray( const unsigned int enumerator, const unsigned int nVertices, const Vector verts[] );
679  void AddFloatArray( const unsigned int enumerator, const unsigned int nVertices, const float verts[] );
680  void AddDoubleArray( const unsigned int enumerator, const unsigned int nVertices, const double verts[] );
681  void AddMaterialIndices( const unsigned int enumerator, DynamicArray<int>& values );
682 
683  // Same as AddVectorArray but only writes X & Y coordinates
684  void AddVector2DArray( const unsigned int enumerator, const unsigned int nVertices, const Vector verts[] );
685 
686  // Use these to write custom data structures to the file
687  unsigned int AddExtendedAttributeHeader( unsigned int enumerator, unsigned int size = 0 );
688  unsigned int AddAttributeHeader( unsigned int enumerator, unsigned char size = 0 );
689 
690  // Methods to add parameters to file, but check for value = default
691  void AddBoolean( const unsigned int enumerator, const bool value, const bool defVal );
692  void AddU8( const unsigned int enumerator, const unsigned char value, const unsigned char defVal );
693  void AddU16( const unsigned int enumerator, const unsigned short value, const unsigned short defVal );
694  void AddS16( const unsigned int enumerator, const short value, const short defVal );
695  void AddU32( const unsigned int enumerator, const unsigned int value, const unsigned int defVal );
696  void AddS32( const unsigned int enumerator, const int value, const int defVal );
697  void AddGlsColor( const unsigned int enumerator, const glsColor& value, const glsColor& defVal );
698  void AddFloat( const unsigned int enumerator, const float value, const float defVal );
699  void AddDouble( const unsigned int enumerator, const double value, const double defVal );
700 
701  // Writes data to file. Doesn't write attribute headers, just writes straight data
702  // Data is byte swapped into Big Endian format
703  void WriteU8( const unsigned char val );
704  void WriteS8( const char val );
705  void WriteU16( const unsigned short val );
706  void WriteS16( const short val );
707  void WriteU32( const unsigned int val );
708  void WriteS32( const int val );
709  void WriteFloat( const float val );
710  void WriteDouble( const double val );
711  void WriteGlsColor( const glsColor& value );
712 
713  // Writes data to file. Doesn't write attribute headers, just writes straight data
714  // Data is byte swapped into Big Endian format. Writes at the specified offset
715  void WriteU8( const unsigned char val, const unsigned int offset );
716  void WriteU32( const unsigned int val, const unsigned int offset );
717 
718  // Method to add matrix, but only if it isn't identity
719  void AddMatrix( const unsigned int enumerator, const GlsMatrixAffineD& value, const bool checkForIdentity );
720 
721  // End the current object record
722  void EndObjectRecord();
723 
724  // Flush the current buffer to disk and rewind
725  void Flush();
726 
727  // Close the file
728  void Close( void );
729 
730  protected:
731  std::string _filename;
732  bool _initialized;
733  FILE* _out;
734  bool _defaultChecking;
735  unsigned char _timestamp[ GLO_FILE_TIMESTAMP_SIZE ];
736  GloFileHeader _header;
737 
738  // Current count of the number of objects in the file
739  unsigned int _numObjects;
740 
741  // Current count of the number of params in the current object
742  short _numParams;
743 
744  // Byte buffer to store params in
745  WriteBuffer* _buffer;
746 
747  void WriteFileHeader();
748  };
749 
750  class Reader
751  {
752  public:
753  /** Do not bother caching GLO files that are larger than 1 MB. */
754  static const unsigned int GLO_SIZE_CACHING_LIMIT = 1024 * 1024;
755 
756  // Create a GLO file reader for the given file
757  Reader( const std::string& filename, const bool open );
758 
759  // Destroy the reader
760  ~Reader( void );
761 
762  // Open file and prepare to read
763  bool OpenForReading( void );
764 
765  // Get the number of object records in this file
766  unsigned int GetNumberOfObjectRecords() { return _header.numObjects; }
767 
768  unsigned int GetGLStudioVersionMajor() { return _header.glsMajor; }
769  unsigned int GetGLStudioVersionMinor() { return _header.glsMinor; }
770  unsigned int GetGLStudioBuildNumber() { return _header.glsBuild; }
771 
772  unsigned char* GetTimestamp() { return _header.timestamp; }
773 
774  // Close the file
775  void Close( void );
776 
777  // Data retrieval methods.
778  std::string GetString( const unsigned int size )
779  {
780  std::string retval( _fileDataPointer );
781  _fileDataPointer += size;
782  return retval;
783  }
784 
785  bool GetBoolean()
786  {
787  bool data = false;
788  memcpy( &data, _fileDataPointer, sizeof( bool ) );
789  _fileDataPointer += sizeof( bool );
790  return data;
791  }
792 
793  char GetByte()
794  {
795  char data = 0;
796  memcpy( &data, _fileDataPointer, sizeof( char ) );
797  _fileDataPointer += sizeof( char );
798  return data;
799  }
800 
801  unsigned char GetUnsignedByte()
802  {
803  unsigned char data = 0u;
804  memcpy( &data, _fileDataPointer, sizeof( unsigned char ) );
805  _fileDataPointer += sizeof( unsigned char );
806  return data;
807  }
808 
809  short GetShort()
810  {
811  short data = 0;
812  memcpy( &data, _fileDataPointer, sizeof( short ) );
813  _fileDataPointer += sizeof( short );
814  return data;
815  }
816 
817  unsigned short GetUnsignedShort()
818  {
819  unsigned short data = 0u;
820  memcpy( &data, _fileDataPointer, sizeof( unsigned short ) );
821  _fileDataPointer += sizeof( unsigned short );
822  return data;
823  }
824 
825  int GetInt()
826  {
827  int data = 0;
828  memcpy( &data, _fileDataPointer, sizeof( int ) );
829  _fileDataPointer += sizeof( int );
830  return data;
831  }
832 
833  unsigned int GetUnsignedInt()
834  {
835  unsigned int data = 0u;
836  memcpy( &data, _fileDataPointer, sizeof( unsigned int ) );
837  _fileDataPointer += sizeof( unsigned int );
838  return data;
839  }
840 
841  float GetFloat()
842  {
843  float data = 0.0f;
844  memcpy( &data, _fileDataPointer, sizeof( float ) );
845  _fileDataPointer += sizeof( float );
846  return data;
847  }
848 
849  double GetDouble()
850  {
851  double data = 0.0;
852  memcpy( &data, _fileDataPointer, sizeof( double ) );
853  _fileDataPointer += sizeof( double );
854  return data;
855  }
856 
857  void GetBytes( const unsigned int size, char** data )
858  {
859  memcpy( *data, _fileDataPointer, size );
860  _fileDataPointer += size;
861  }
862 
863  glsColor GetColor()
864  {
865  glsColor data = glsColor();
866  memcpy( &data, _fileDataPointer, sizeof( glsColor ) );
867  _fileDataPointer += sizeof( glsColor );
868  return data;
869  }
870 
871  DynamicArray<int> GetMaterialIndices()
872  {
873  DynamicArray<int> returnVal;
874  unsigned int count = (unsigned int)GetInt();
875  for( unsigned int i = 0; i < count; i++ )
876  {
877  returnVal.InsertObject( GetInt() );
878  }
879  return returnVal;
880  }
881 
882  bool IsInitialized() { return _initialized; }
883 
884  const std::string& GetFilename() { return _filename; }
885 
886  protected:
887  std::string _filename;
888  bool _initialized;
889  FILE* _in;
890  unsigned int _numberOfObjectRecords;
891  unsigned int _glsMajor;
892  unsigned int _glsMinor;
893  unsigned int _glsBuild;
894  unsigned char _timestamp[ GLO_FILE_TIMESTAMP_SIZE ];
895  GloFileHeader _header;
896  char* _fileData;
897  const char* _fileDataPointer;
898  };
899 
901  {
902  public:
903  WriteBuffer( const unsigned int initialSize );
904 
905  ~WriteBuffer();
906 
907  // Ensure the buffer is at least the specified size
908  void Resize( const unsigned int minimumSize );
909 
910  // Enlarge buffer by at least incrementalSize
911  void Enlarge( const unsigned int incrementalSize );
912 
913  // Get the buffer pointer
914  unsigned char* Buffer();
915 
916  // Get the current buffer size
917  unsigned int Size();
918 
919  // Write data to the buffer at the current offset, moving the
920  // current write position
921  void WriteData( const void* data, const unsigned int size );
922 
923  // Write data to the buffer at a specific offset, not moving the
924  // current write position
925  void WriteData( const void* data, const unsigned int size, const unsigned int offset );
926 
927  // Rewind to beginning of buffer
928  void Rewind();
929 
930  protected:
931  // Total size of the params for the current object
932  unsigned int _current;
933 
934  // Size of the param buffer
935  unsigned int _bufSize;
936 
937  // Buffer containing the params for the current object
938  unsigned char* _buf;
939  };
940 
942  {
943  public:
944  ObjectData( Reader* reader );
945 
946  ~ObjectData();
947 
948  void SetNumAttributes( const short numAttributes )
949  {
950  _numAttributes = numAttributes;
951  }
952 
953  bool HasAttributes()
954  {
955  return ( _numAttributes > 0 );
956  }
957 
958  GlsGloFileAttribute* GetNextAttribute();
959 
960  private:
961  Reader* _reader;
962  short _numAttributes;
963  GlsGloFileAttribute* _glsGloFileAttribute;
964  };
965 
966  // constructor - throws GlsGloFileNotFoundException if glow file isn't found.
967  GLSGEN_GlsGloFile_EXPORT GlsGloFile( const std::string& filename, const bool readMode = true );
968  GLSGEN_GlsGloFile_EXPORT ~GlsGloFile();
969  ObjectData* GetNextObject();
970  GLSGEN_GlsGloFile_EXPORT void VerifyTimestamp( const unsigned char* timestamp, const char* className );
971 
972 protected:
973  Reader* _reader;
974  int _numObjectsRemaining;
975  ObjectData* _objectData;
976 
977  // Stores the name of the file that we're reading; currently only used to make the error
978  // messages more intelligent.
979  std::string _filename;
980 };
981 
983 {
984 public:
986  : _reader( reader )
987  , _enumeration( 0 )
988  , _size( 0 )
989  {
990  }
991 
993  {
994  }
995 
996  void SetEnumeration( const unsigned int enumeration )
997  {
998  _enumeration = enumeration;
999  }
1000 
1001  void SetSize( const unsigned int size )
1002  {
1003  _size = size;
1004  }
1005 
1006  // Data Retrieval Methods
1007  unsigned int Enumeration()
1008  {
1009  return _enumeration;
1010  }
1011  unsigned int Size()
1012  {
1013  return _size;
1014  }
1015 
1016  std::string GetString()
1017  {
1018  return _reader->GetString( _size );
1019  }
1020 
1021  void GetVector( Vector& rval )
1022  {
1023  rval.x = _reader->GetFloat();
1024  rval.y = _reader->GetFloat();
1025  rval.z = _reader->GetFloat();
1026  }
1027  void GetVertex( Vertex& rval )
1028  {
1029  rval.x = _reader->GetFloat();
1030  rval.y = _reader->GetFloat();
1031  rval.z = _reader->GetFloat();
1032  rval.color.R( _reader->GetUnsignedByte() );
1033  rval.color.G( _reader->GetUnsignedByte() );
1034  rval.color.B( _reader->GetUnsignedByte() );
1035  rval.color.A( _reader->GetUnsignedByte() );
1036  }
1037 
1038  glsColor GetColor()
1039  {
1040  return _reader->GetColor();
1041  }
1042 
1043  void GetColor( glsColor& rval )
1044  {
1045  // Call the assignment version of this overload.
1046  rval = GetColor();
1047  }
1048 
1049  bool GetBoolean()
1050  {
1051  return _reader->GetBoolean();
1052  }
1053 
1054  char GetByte()
1055  {
1056  return _reader->GetByte();
1057  }
1058 
1059  unsigned char GetUnsignedByte()
1060  {
1061  return _reader->GetUnsignedByte();
1062  }
1063 
1064  short GetShort()
1065  {
1066  return _reader->GetShort();
1067  }
1068 
1069  unsigned short GetUnsignedShort()
1070  {
1071  return _reader->GetUnsignedShort();
1072  }
1073 
1074  int GetInt()
1075  {
1076  return _reader->GetInt();
1077  }
1078 
1079  unsigned int GetUnsignedInt()
1080  {
1081  return _reader->GetUnsignedInt();
1082  }
1083 
1084  float GetFloat()
1085  {
1086  return _reader->GetFloat();
1087  }
1088 
1089  double GetDouble()
1090  {
1091  return _reader->GetDouble();
1092  }
1093 
1094  char* GetBytes()
1095  {
1096  char* rval = new char[ _size ];
1097  _reader->GetBytes( _size, &rval );
1098  return rval;
1099  }
1100 
1101  DynamicArray<int> GetMaterialIndices()
1102  {
1103  return _reader->GetMaterialIndices();
1104  }
1105 
1106  void GetBytes( const unsigned int size, void* data )
1107  {
1108  _reader->GetBytes( size, (char**)&data );
1109  }
1110 
1111 private:
1112  GlsGloFile::Reader* _reader;
1113  unsigned int _enumeration;
1114  unsigned int _size;
1115 };
1116 
1117 // Byte swapping functions used by this class.
1118 float SwapFloatToNet( float val );
1119 double SwapDoubleToNet( double val );
1120 unsigned int SwapLongToNet( unsigned int val );
1121 unsigned int SwapSignedLongToNet( int val );
1122 unsigned short SwapShortToNet( unsigned short val );
1123 short SwapSignedShortToNet( short val );
1124 
1125 } // namespace disti
1126 
1127 #endif
GlsColor glsColor
Alias for backwards compatibility.
Definition: gls_color.h:272
Definition: gls_glo_file.h:900
Definition: vertex.h:408
unsigned char R(void) const
Definition: gls_color.h:208
The disti::DynamicArray class. A templated array of objects capable of dynamically growing...
unsigned char B(void) const
Definition: gls_color.h:214
Definition: gls_glo_file.h:77
The GlsMatrixAffine class.
A file for all GL Studio files to include.
Definition: gls_glo_file.h:982
Definition: gls_glo_file.h:941
Definition: gls_glo_file.h:539
Definition: gls_glo_file.h:81
static const unsigned int GLO_FILE_TIMESTAMP_SIZE
Definition: gls_glo_file.h:90
The disti::Vertex class. A class for manipulating 3D vertices.
unsigned char G(void) const
Definition: gls_color.h:211
Definition: gls_glo_file.h:750
Definition: gls_color.h:53
Definition: gls_glo_file.h:633
static const unsigned int GLO_SIZE_CACHING_LIMIT
Definition: gls_glo_file.h:754
The disti::DisplayFrame class.
Definition: gls_glo_file.h:522
Definition: vertex.h:83
unsigned char A(void) const
Definition: gls_color.h:217
Definition: bmpimage.h:46
static const int GlsGeometryResourceData_Version
Definition: gls_glo_file.h:553