GL Studio C++ Runtime API
rso_interface_1.h
Go to the documentation of this file.
1/// \file rso_interface_1.h
2/// \brief Defines the RSO interface, which provides a generic way of accessing RSOs and other content, disti::RSOInterface1.
3///
4/// \par Copyright Information
5///
6/// Copyright (c) 2017 by The DiSTI Corporation.<br>
7/// 12249 Science Drive; Suite 300<br>
8/// Orlando, Florida 32826<br>
9/// USA<br>
10/// <br>
11/// All rights reserved.<br>
12///
13/// This Software contains proprietary trade secrets of DiSTI and may not be
14/// reproduced, in whole or part, in any form, or by any means of electronic,
15/// mechanical, or otherwise, without the written permission of DiSTI. Said
16/// permission may be derived through the purchase of applicable DiSTI product
17/// licenses which detail the distribution rights of this content and any
18/// Derivative Works based on this or other copyrighted DiSTI Software.
19///
20/// NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21/// AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22/// PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23/// AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24/// IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25/// PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26///
27/// LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28/// IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29/// INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30/// DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31/// INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32/// INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33/// OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34/// EXCEED FIVE DOLLARS (US$5.00).
35///
36/// The aforementioned terms and restrictions are governed by the laws of the
37/// State of Florida and the United States of America.
38
39#ifndef DISTI_INCLUDED_RSO_INTERFACE_1_H
40#define DISTI_INCLUDED_RSO_INTERFACE_1_H
41
42// !!! NOTICE !!!
43// To maintain compatibility with existing RSOs this header cannot be changed.
44
45namespace disti
46{
47////////////////////////////////////////////////////////////////////////////////
48// In order for the RSO to be discovered in a .DLL or .so file,
49// The following "C" funtions need to be defined.
50// They are only comments here.
51////////////////////////////////////////////////////////////////////////////////
52// RSOInterface1* GetRSOInterface1_ClassNameHere()
53// Optionally:
54// const char* GlsDefaultClassName()
55////////////////////////////////////////////////////////////////////////////////
56
57/** The RSOInterface1 class defines an abstract interface to an RSO instance.
58 */
60{
61public:
62 ////////////////////////////////////////////////////////////////////////////////
63 // Forward declaration of support classes
64 ////////////////////////////////////////////////////////////////////////////////
65 class Vector;
66 class MatrixD;
67 class OpenGLMatrices;
68 class PlaneClass;
69 class Culler;
70 class Event;
71 class LocationEvent;
72 class MouseEvent;
73 class KeyboardEvent;
74 class ObjectEvent;
76 class ResourceFilter;
77
78public:
79 ////////////////////////////////////////////////////////////////////////////////
80 /// The RSO Interface methods
81 ////////////////////////////////////////////////////////////////////////////////
82
83 /// Perform component simulation.
84 /// Any non-drawing activities can be performed here.
85 /// Call this before PreDraw()
86 /// \param time The current application time in seconds.
87 virtual void Calculate( double time ) = 0;
88
89 /// Calculate transformations and perform culling
90 /// Call this before Draw()
91 /// \param current The current state of the OpenGL matrices.
92 /// \param culler The current culler state.
93 virtual void PreDraw( const OpenGLMatrices& current, Culler& culler ) = 0;
94
95 /// Draw the object via OpenGL
96 /// Call this after PreDraw()
97 virtual void Draw() = 0;
98
99 /// Set the string value for a given named resource.
100 /// \param resourceName The name of the resource to set.
101 /// \param resourceVal The new string value to set for the resource.
102 virtual void SetResource( const char* resourceName, const char* resourceVal ) = 0;
103
104 /// Get the string value for the given resource
105 /// \param resourceName The name of the resource whose value is to be returned.
106 /// \return The string value for the given resource, or empty string if not found.
107 virtual const char* GetResource( const char* resourceName ) = 0;
108
109 /// Get a list of the resources for the component.
110 /// Each resource is separated by a newline ('\n') with the output controlled by filter.
111 /// filter may be NULL in which case the default values are used.
112 /// \param filter The filter parameters to use.
113 /// \return A string containing the list of resource data that passes the filter.
114 virtual const char* GetResources( ResourceFilter* filter = 0 ) = 0;
115
116 /// Allow the object to handle an event
117 /// \param ev The event to handle.
118 /// \return True if the event was handled by the component.
119 virtual bool HandleInput( Event* ev ) = 0;
120
121 /// Allow for handling events from inside the object.
122 /// The emitted event handler will be passed events that are from inside the component
123 /// \param handler pointer to the EmittedEventHandler object to use or NULL to remove the current event handler.
124 /// \return true if this component may emit events, false if this component will never emit events.
125 virtual bool SetEmittedEventHandler( EmittedEventHandler* handler ) = 0;
126
127 /// Pick3D returns true if the RSO was picked.
128 /// \param winLoc Device coordinates for the mouse click. Z value should be set to 0 to ensure pick ray starts at near clip plane.
129 /// \param logicalCoords The start of the pick ray in logical coordinates. Should be calculated from the winLoc using this->WindowToLogical(winLoc, logicalCoords, &directionVector).
130 /// \param scale Current window scale. Affects picking radius of outlines. Initial value should typically be 1.0.
131 /// \param directionVector The direction of the pick ray in logical coordinates. Should be calculated from the winLoc using this->WindowToLogical(winLoc, logicalCoords, &directionVector).
132 /// \param collisionWinLoc Returns where the pick vector intersects the object that is hit in device coordinates.
133 /// \param drawnMatrices The matrices used to draw the object, including matrices set by parents that may have
134 /// dynamically rotated, translated or scaled this object. Initial value should typically be a default OpenGLMatrices() object.
135 /// \return True if the object was picked.
136 virtual bool Pick3D( const Vector& winLoc,
137 const Vector& logicalCoords,
138 float scale,
139 const Vector& directionVector,
140 Vector& collisionWinLoc,
141 const OpenGLMatrices& drawnMatrices )
142 = 0;
143
144 /// Get the bounding sphere for the component in the components coordinate system
145 /// \param center If the method returns true, contains the center point of the sphere. If the method returns false, value is undefined.
146 /// \param radius If the method returns true, contains the radius of the sphere. If the method returns false, value is undefined.
147 /// \returns true if the bounding sphere was returned, false if the bounding sphere is not available.
148 virtual bool GetBoundingSphere( Vector* center, float* radius ) = 0;
149
150 /// Get the extents of the component when drawn with the given transformation matrix, as a coordinate system-aligned box
151 /// \param min If the method returns true, contains the point corresponding with the 1st corner of the box. If the method returns false, value is undefined.
152 /// \param max If the method returns true, contains the point corresponding with the 2nd corner of the box. If the method returns false, value is undefined.
153 /// \param transform Transformation matrix from A to B where A is the component's coordinate system and B is the coordinate system to compute the bounding box in. (If NULL then identity matrix is assumed)
154 /// \returns true if the extents were calculated, false if the extents could not be calculated.
155 virtual bool GetBoundingBox( Vector* min, Vector* max, const MatrixD* transform = 0 ) = 0;
156
157 /// \return A new instance of the RSO that is a clone of this object or NULL if not possible.
159
160 /// Safely delete the object.
161 virtual void DeleteInstance() = 0;
162
163protected:
164 /// Protected destructor so it can't be deleted directly.
165 virtual ~RSOInterface1() {}
166
167public:
168 ////////////////////////////////////////////////////////////////////////////////
169 // Supporting classes
170 ////////////////////////////////////////////////////////////////////////////////
171
172 /** Vector */
173 class Vector
174 {
175 public:
176 float _x; ///< The X component.
177 float _y; ///< The Y component.
178 float _z; ///< The Z component.
179
180 Vector()
181 : _x( 0 )
182 , _y( 0 )
183 , _z( 0 )
184 {}
185
186 /// Set all three components.
187 /// \param x The new X component to set.
188 /// \param y The new Y component to set.
189 /// \param z The new Z component to set.
190 void Set( float x, float y, float z )
191 {
192 _x = x;
193 _y = y;
194 _z = z;
195 }
196
197 /// \return The X component.
198 float X() { return _x; }
199
200 /// \return The Y component.
201 float Y() { return _y; }
202
203 /// \return The Z component.
204 float Z() { return _z; }
205 };
206
207 /** MatrixD contains the data for a 4x4 matrix */
209 {
210 public:
211 double _data[ 4 * 4 ]; ///< Raw column-major matrix data.
212
213 // Uninitialized data
214 MatrixD()
215 {}
216
217 /// Constructor
218 /// \param data A double array to copy from.
219 MatrixD( double* data )
220 {
221 _data[ 0 ] = data[ 0 ];
222 _data[ 1 ] = data[ 1 ];
223 _data[ 2 ] = data[ 2 ];
224 _data[ 3 ] = data[ 3 ];
225 _data[ 4 ] = data[ 4 ];
226 _data[ 5 ] = data[ 5 ];
227 _data[ 6 ] = data[ 6 ];
228 _data[ 7 ] = data[ 7 ];
229 _data[ 8 ] = data[ 8 ];
230 _data[ 9 ] = data[ 9 ];
231 _data[ 10 ] = data[ 10 ];
232 _data[ 11 ] = data[ 11 ];
233 _data[ 12 ] = data[ 12 ];
234 _data[ 13 ] = data[ 13 ];
235 _data[ 14 ] = data[ 14 ];
236 _data[ 15 ] = data[ 15 ];
237 }
238 };
239
240 /** OpenGLMatrices is used to pass the current OpenGL matrices to PreDraw */
242 {
243 public:
244 int* _viewPort; ///< Pointer to viewport array size 4.
245 MatrixD* _projMatrix; ///< The projection matrix.
246 MatrixD* _modelMatrix; ///< The modelview matrix.
247
249 : _viewPort( 0 )
250 , _projMatrix( 0 )
251 , _modelMatrix( 0 )
252 {}
253
254 /// Constructor
255 /// \param viewPort The new viewport array.
256 /// \param projMatrix The new projection matrix.
257 /// \param modelMatrix The new modelview matrix.
258 OpenGLMatrices( int* viewPort, MatrixD* projMatrix, MatrixD* modelMatrix )
259 : _viewPort( viewPort )
260 , _projMatrix( projMatrix )
261 , _modelMatrix( modelMatrix )
262 {}
263 };
264
265 /** The PlaneClass is used to define the clipping planes for culling */
267 {
268 public:
269 float _a; ///< Coefficient to describe a 3D plane: aX + bY + cZ + d = 0
270 float _b; ///< Coefficient to describe a 3D plane: aX + bY + cZ + d = 0
271 float _c; ///< Coefficient to describe a 3D plane: aX + bY + cZ + d = 0
272 float _d; ///< Coefficient to describe a 3D plane: aX + bY + cZ + d = 0
273
274 PlaneClass()
275 : _a( 0 )
276 , _b( 0 )
277 , _c( 0 )
278 , _d( 0 )
279 {}
280
281 /// Set all components.
282 /// \param a The A component to set.
283 /// \param b The B component to set.
284 /// \param c The C component to set.
285 /// \param d The D component to set.
286 void Set( float a, float b, float c, float d )
287 {
288 _a = a;
289 _b = b;
290 _c = c;
291 _d = d;
292 }
293
294 /// \return The A component.
295 float A() { return _a; }
296
297 /// \return The B component.
298 float B() { return _b; }
299
300 /// \return The C component.
301 float C() { return _c; }
302
303 /// \return The D component.
304 float D() { return _d; }
305 };
306
307 /** Defines culling parameters for PreDraw */
308 class Culler
309 {
310 public:
311 bool _enabled; ///< Whether or not culling is enabled.
312 PlaneClass _planes[ 6 ]; ///< Array of six clipping planes to define the frustum.
313
314 Culler()
315 : _enabled( false )
316 {}
317 };
318
319 /** Base class for events */
320 class Event
321 {
322 public:
323 /** Event Type Enum */
324 typedef enum
325 {
326 EVENT_MOUSE = 0, /**< A Mouse (or touch screen) event */
327 EVENT_KEYBOARD, /**< A Keyboard event */
328 EVENT_TIMER, /**< Unused */
329 EVENT_OBJECT, /**< An event emitted by an object */
330 EVENT_KEYBOARD_UP /**< A Keyboard up event (uses KeyboardEvent class) */
332
333 /** Event Subtype Enum */
334 typedef enum
335 {
336 MOUSE_DOWN = 0, /**< A Mouse button was pushed down */
337 MOUSE_UP, /**< A Mouse button was released */
338 MOUSE_MOVE, /**< The mouse moved */
339 MOUSE_DRAG, /**< The mouse moved while a button was held down */
340 MOUSE_LEAVE, /**< The mouse exited the object */
341 MOUSE_ENTER, /**< The mouse entered the object */
342 MOUSE_WHEEL_MINUS, /**< The mouse wheel was turned in the negative direction */
343 MOUSE_WHEEL_PLUS /**< The mouse wheel was turned in the positive direction */
345
346 unsigned short _eventType; /**< Major event code. see EventTypeEnum */
347 unsigned short _eventSubtype; /**< Minor event code. see EventSubtypeEnum */
348
349 /**
350 Special Key State
351 */
352 typedef enum
353 {
354 NONE_STATE = 0,
355 SHIFT_STATE = 0x00010000,
356 CAPS_LOCK_STATE = 0x00020000,
357 CTRL_STATE = 0x00040000,
358 ALT_STATE = 0x00080000,
359 NUM_LOCK_STATE = 0x00100000,
360 META_STATE = 0x00400000,
361 SCROLL_LOCK_STATE = 0x00800000,
362 BUTTON1_STATE = 0x01000000,
363 BUTTON2_STATE = 0x02000000,
364 BUTTON3_STATE = 0x04000000
366
367 Event()
368 : _eventType( 0 )
369 , // Derived classes MUST set the appropriate event type
371 {}
372
373 virtual ~Event() {}
374
375 /// \return The type of this event.
376 unsigned short EventType() { return _eventType; }
377
378 /// Set the primary type of this event. i.e. EVENT_MOUSE
379 /// \param value The new primary type to set.
380 void EventType( unsigned short value ) { _eventType = value; }
381
382 /// \return The subtype of this event.
383 unsigned short EventSubType() { return _eventSubtype; }
384
385 /// Set the secondary type of this event. i.e. MOUSE_DOWN
386 /// \param value The new secondary type to set.
387 void EventSubType( unsigned short value ) { _eventSubtype = value; }
388 };
389
390 /** An event associated with a specific location in the application window.
391 * Base class for MouseEvent and KeyboardEvent.
392 */
393 class LocationEvent : public Event
394 {
395 public:
396 Vector _winLoc; /**< Location of the event in window coordinates
397 * x and y window coordinates in pixels.
398 * z is from 0.0 -> 1.0 and represents the depth.
399 * z == 0 is at the near cliping plane.
400 * z == 0.5 represents half way between near
401 * and far cliping planes.
402 */
404 {}
405
406 /// \return The window coordinates of the this event.
407 Vector WinLoc() { return _winLoc; }
408
409 /// Sets the window coordinates of this event.
410 /// \param value The new window coordinates to set.
411 void WinLoc( Vector value ) { _winLoc = value; }
412 };
413
414 /** An event containing mouse input. */
416 {
417 public:
418 /** Mouse Button Type */
419 typedef enum
420 {
421 MOUSE_LBUTTON = 1, /**< Mask that matches only left mouse button */
422 MOUSE_MBUTTON = 2, /**< Mask that matches only middle mouse button */
423 MOUSE_RBUTTON = 4, /**< Mask that matches only right mouse button */
424 MOUSE_BUTTON_ANY = 7 /**< Mask that matches any mouse button */
426
427 unsigned char _buttonMask; /**< bitfield: which button was pressed for this event ( MouseButtonType )*/
428 unsigned char _clicks; /**< # of times a button was pressed */
429 int _modifiers; /**< bitfield: which buttons or modifiers were depressed before event ( \sa SpecialKeyState) */
430
431 MouseEvent()
432 : _buttonMask( 0 )
433 , _clicks( 0 )
434 , _modifiers( NONE_STATE )
435 {
437 }
438
439 /// \return The current button mask of this event.
440 unsigned char ButtonMask() { return _buttonMask; }
441
442 /// Set the button mask for this event. i.e. Which buttons are down.
443 /// \param value The new button mask to set.
444 void ButtonMask( unsigned char value ) { _buttonMask = value; }
445
446 /// \return The number of clicks associated with this event.
447 unsigned char Clicks() { return _clicks; }
448
449 /// Set the number of clicks associated with this event. i.e. single or double click
450 /// \param value The new number of clicks to set
451 void Clicks( unsigned char value ) { _clicks = value; }
452
453 /// \return The current keyboard modifers of this event.
454 int Modifiers() { return _modifiers; }
455
456 /// Set the keyboard modifers for this event. e.g. control being held.
457 /// \param value The new keyboard modifers to set.
458 void Modifiers( int value ) { _modifiers = value; }
459 };
460
461 /** An event containing keyboard input */
463 {
464 public:
465 ///< \details The KeySymCodeEnum enumeration. Used by keysym (use ascii letters for all other keys):
466 enum
467 {
468 KEY_Button = 0xfee8,
469 KEY_BackSpace = 0xff08,
470 KEY_Tab = 0xff09,
471 KEY_Enter = 0xff0d,
472 KEY_Pause = 0xff13,
473 KEY_Scroll_Lock = 0xff14,
474 KEY_Escape = 0xff1b,
475 KEY_Home = 0xff50,
476 KEY_Left = 0xff51,
477 KEY_Up = 0xff52,
478 KEY_Right = 0xff53,
479 KEY_Down = 0xff54,
480 KEY_Page_Up = 0xff55,
481 KEY_Page_Down = 0xff56,
482 KEY_End = 0xff57,
483 KEY_Print = 0xff61,
484 KEY_Insert = 0xff63,
485 KEY_Menu = 0xff67,
486 KEY_Num_Lock = 0xff7f,
487 KEY_KP = 0xff80,
488 KEY_KP_Enter = 0xff8d,
489 KEY_KP_Last = 0xffbd,
490 KEY_F = 0xffbd,
491 KEY_F_Last = 0xffe0,
492 KEY_Shift_L = 0xffe1,
493 KEY_Shift_R = 0xffe2,
494 KEY_Control_L = 0xffe3,
495 KEY_Control_R = 0xffe4,
496 KEY_Caps_Lock = 0xffe5,
497 KEY_Meta_L = 0xffe7,
498 KEY_Meta_R = 0xffe8,
499 KEY_Alt_L = 0xffe9,
500 KEY_Alt_R = 0xffea,
501 KEY_Delete = 0xffff
503
504 int _keysym; /**< Code for key that was pressed ( \sa KeySymCodeEnum) */
505 int _modifiers; /**< bitfield: which modifiers or buttons were pressed ( \sa SpecialKeyState) */
506
508 : _keysym( 0 )
509 , _modifiers( 0 )
510 {
512 }
513
514 /// \return The key symbol code for this event.
515 int KeySym() { return _keysym; }
516
517 /// Set the key symbol associated with this event.
518 /// \param value The new symbol to set.
519 void KeySym( int value ) { _keysym = value; }
520
521 /// \return The current keyboard modifiers for this event.
522 int Modifiers() { return _modifiers; }
523
524 /// Set the keyboard modifiers for this event, e.g. shift is held.
525 /// \param value The new modifiers to set.
526 void Modifiers( int value ) { _modifiers = value; }
527 };
528
529 /** An event that is emitted from a simulation object */
530 class ObjectEvent : public Event
531 {
532 public:
533 char* _initiator; /**< The qualified name of the object that initiated the event */
534 char* _eventName; /**< String event name */
535 char* _eventData; /**< Any additional data for this event. A NULL terminated string */
536
538 : _initiator( 0 )
539 , _eventName( 0 )
540 , _eventData( 0 )
541 {
543 }
544
545 virtual ~ObjectEvent()
546 {
547 if( _initiator )
548 {
549 delete _initiator;
550 _initiator = 0;
551 }
552 if( _eventName )
553 {
554 delete _eventName;
555 _eventName = 0;
556 }
557 if( _eventData )
558 {
559 delete _eventData;
560 _eventData = 0;
561 }
562 }
563
564 /// \return The initiator name.
565 const char* Initiator() const
566 {
567 return _initiator;
568 }
569
570 /// Set the initiator name.
571 /// \param value The new name to set.
572 virtual void Initiator( const char* value )
573 {
574 if( _initiator )
575 {
576 delete[] _initiator;
577 _initiator = 0;
578 }
579 if( value )
580 {
581 _initiator = new char[ RSOInterface1::strlen( value ) + 1 ];
583 }
584 }
585
586 /// \return The event name.
587 const char* EventName() const
588 {
589 return _eventName;
590 }
591
592 /// Set the event name.
593 /// \param value The new name to set.
594 virtual void EventName( const char* value )
595 {
596 if( _eventName )
597 {
598 delete[] _eventName;
599 _eventName = 0;
600 }
601 if( value )
602 {
603 _eventName = new char[ RSOInterface1::strlen( value ) + 1 ];
605 }
606 }
607
608 /// \return The event data.
609 const char* EventData() const
610 {
611 return _eventData;
612 }
613
614 /// Set the event data.
615 /// \param value The new string data to set.
616 virtual void EventData( const char* value )
617 {
618 if( _eventData )
619 {
620 delete[] _eventData;
621 _eventData = 0;
622 }
623 if( value )
624 {
625 _eventData = new char[ RSOInterface1::strlen( value ) + 1 ];
627 }
628 }
629 };
630
631 /** The emitted event handler is an object provided by the
632 container to handle events emitted from the component.
633 */
635 {
636 protected:
637 virtual ~EmittedEventHandler() {}
638
639 public:
640 /// Called by the component to pass an event
641 /// to the container. Most containers will only handle ObjectEvents.
642 /// \param ev The event to handle
643 /// \return int Reserved. Currently always -1.
644 virtual int HandleEvent( Event* ev ) = 0;
645 };
646
647 /** The resource filter is a parameter to the GetResources method */
649 {
650 protected:
651 virtual ~ResourceFilter() {}
652
653 public:
654 /// \return The levels of qualification to show in the name.
655 virtual int LevelsUp() const = 0;
656
657 /// How many levels of qualification to show in the name.
658 /// -1 means full qualification.
659 /// Default: -1
660 /// \param value The new levels of qualification to show.
661 virtual void LevelsUp( int value ) = 0;
662
663 /// \return The number of levels of children to show.
664 virtual int GroupLevelsDown() const = 0;
665
666 /// How many levels of children to show.
667 /// 0 means don't show any children properties
668 /// -1 means all the way down.
669 /// Default: -1
670 /// \param value The new levels of children to show.
671 virtual void GroupLevelsDown( int value ) = 0;
672
673 /// \return True if only a list of names will be returned.
674 virtual bool NamesOnly() const = 0;
675
676 /// If true, only a list of names will be returned.
677 /// Values will not be returned.
678 /// The format changes to not include the ":".
679 /// Default: false
680 /// \param value The new names only flag.
681 virtual void NamesOnly( bool value ) = 0;
682
683 /// Manage the list of excluded attributes.
684 /// \param str The name of the new exclude item to add.
685 virtual void AddExclude( const char* str ) = 0;
686
687 /// \return The number of entries in the exclude list.
688 /// Default: 0
689 virtual int ExcludeCount() const = 0;
690
691 /// Returns NULL if index >= ExcludeCount() or index < -1
692 /// \param index The index of the exlcusion item to return.
693 /// \return The name of the item associated with the index.
694 virtual const char* GetExclude( int index ) const = 0;
695
696 /// Manage the list of included attributes.
697 /// \param str The name of the new include item to add.
698 virtual void AddInclude( const char* str ) = 0;
699
700 /// \return The number of entries in the include list.
701 /// Default: 0
702 virtual int IncludeCount() const = 0;
703
704 /// Returns NULL if index >= IncludeCount() or index < -1.
705 /// \param index The index of the inclusion item to return.
706 /// \return The name of the item associated with the index.
707 virtual const char* GetInclude( int index ) const = 0;
708
709 /// Check a name against the filters.
710 /// Exclude list takes precedence.
711 /// \param name The name to check against the filter.
712 /// \return True if the name passes the filter (to be included in the result).
713 virtual bool PassFilter( const char* name ) const = 0;
714 };
715
716 ////////////////////////////////////////////////////////////////////////////////
717 // Support class utility methods
718 ////////////////////////////////////////////////////////////////////////////////
719
720 /// Return the length of the given C string.
721 /// \param str The string whose length is to be computed.
722 /// \return The length of the string in bytes.
723 static unsigned int strlen( const char* str )
724 {
725 unsigned int i = 0;
726 while( str[ i ] != '\0' )
727 {
728 ++i;
729 }
730 return i;
731 }
732
733 /// Copy the given C string from src to dest.
734 /// \param dest The destination memory region.
735 /// \param src The source memory region.
736 /// \return The destination memory region.
737 static char* strcpy( char* dest, const char* src )
738 {
739 unsigned int i = 0;
740 while( ( dest[ i ] = src[ i ] ) != '\0' )
741 {
742 ++i;
743 }
744 return dest;
745 }
746};
747
748} // end namespace disti
749
750#endif
Definition: rso_interface_1.h:309
bool _enabled
Whether or not culling is enabled.
Definition: rso_interface_1.h:311
PlaneClass _planes[6]
Array of six clipping planes to define the frustum.
Definition: rso_interface_1.h:312
Definition: rso_interface_1.h:635
virtual int HandleEvent(Event *ev)=0
Definition: rso_interface_1.h:321
unsigned short _eventType
Definition: rso_interface_1.h:346
unsigned short EventSubType()
Definition: rso_interface_1.h:383
unsigned short EventType()
Definition: rso_interface_1.h:376
unsigned short _eventSubtype
Definition: rso_interface_1.h:347
EventSubtypeEnum
Definition: rso_interface_1.h:335
@ MOUSE_DOWN
Definition: rso_interface_1.h:336
@ MOUSE_ENTER
Definition: rso_interface_1.h:341
@ MOUSE_UP
Definition: rso_interface_1.h:337
@ MOUSE_DRAG
Definition: rso_interface_1.h:339
@ MOUSE_MOVE
Definition: rso_interface_1.h:338
@ MOUSE_WHEEL_PLUS
Definition: rso_interface_1.h:343
@ MOUSE_LEAVE
Definition: rso_interface_1.h:340
@ MOUSE_WHEEL_MINUS
Definition: rso_interface_1.h:342
EventTypeEnum
Definition: rso_interface_1.h:325
@ EVENT_MOUSE
Definition: rso_interface_1.h:326
@ EVENT_KEYBOARD_UP
Definition: rso_interface_1.h:330
@ EVENT_OBJECT
Definition: rso_interface_1.h:329
@ EVENT_TIMER
Definition: rso_interface_1.h:328
@ EVENT_KEYBOARD
Definition: rso_interface_1.h:327
void EventType(unsigned short value)
Definition: rso_interface_1.h:380
void EventSubType(unsigned short value)
Definition: rso_interface_1.h:387
SpecialKeyState
Definition: rso_interface_1.h:353
Definition: rso_interface_1.h:463
void Modifiers(int value)
Definition: rso_interface_1.h:526
int KeySym()
Definition: rso_interface_1.h:515
int _keysym
Definition: rso_interface_1.h:504
int Modifiers()
Definition: rso_interface_1.h:522
int _modifiers
Definition: rso_interface_1.h:505
void KeySym(int value)
Definition: rso_interface_1.h:519
enum disti::RSOInterface1::KeyboardEvent::@6 KeySymCodeEnum
<
Definition: rso_interface_1.h:394
Vector _winLoc
Definition: rso_interface_1.h:396
void WinLoc(Vector value)
Definition: rso_interface_1.h:411
Vector WinLoc()
Definition: rso_interface_1.h:407
Definition: rso_interface_1.h:209
double _data[4 *4]
Raw column-major matrix data.
Definition: rso_interface_1.h:211
MatrixD(double *data)
Definition: rso_interface_1.h:219
Definition: rso_interface_1.h:416
void Modifiers(int value)
Definition: rso_interface_1.h:458
MouseButtonType
Definition: rso_interface_1.h:420
@ MOUSE_BUTTON_ANY
Definition: rso_interface_1.h:424
@ MOUSE_LBUTTON
Definition: rso_interface_1.h:421
@ MOUSE_RBUTTON
Definition: rso_interface_1.h:423
@ MOUSE_MBUTTON
Definition: rso_interface_1.h:422
int Modifiers()
Definition: rso_interface_1.h:454
int _modifiers
Definition: rso_interface_1.h:429
void Clicks(unsigned char value)
Definition: rso_interface_1.h:451
unsigned char _buttonMask
Definition: rso_interface_1.h:427
unsigned char Clicks()
Definition: rso_interface_1.h:447
void ButtonMask(unsigned char value)
Definition: rso_interface_1.h:444
unsigned char ButtonMask()
Definition: rso_interface_1.h:440
unsigned char _clicks
Definition: rso_interface_1.h:428
Definition: rso_interface_1.h:531
virtual void EventName(const char *value)
Definition: rso_interface_1.h:594
const char * EventData() const
Definition: rso_interface_1.h:609
char * _eventName
Definition: rso_interface_1.h:534
virtual void Initiator(const char *value)
Definition: rso_interface_1.h:572
const char * Initiator() const
Definition: rso_interface_1.h:565
char * _initiator
Definition: rso_interface_1.h:533
const char * EventName() const
Definition: rso_interface_1.h:587
virtual void EventData(const char *value)
Definition: rso_interface_1.h:616
char * _eventData
Definition: rso_interface_1.h:535
Definition: rso_interface_1.h:242
MatrixD * _projMatrix
The projection matrix.
Definition: rso_interface_1.h:245
MatrixD * _modelMatrix
The modelview matrix.
Definition: rso_interface_1.h:246
OpenGLMatrices(int *viewPort, MatrixD *projMatrix, MatrixD *modelMatrix)
Definition: rso_interface_1.h:258
int * _viewPort
Pointer to viewport array size 4.
Definition: rso_interface_1.h:244
Definition: rso_interface_1.h:267
float A()
Definition: rso_interface_1.h:295
void Set(float a, float b, float c, float d)
Definition: rso_interface_1.h:286
float _a
Coefficient to describe a 3D plane: aX + bY + cZ + d = 0.
Definition: rso_interface_1.h:269
float C()
Definition: rso_interface_1.h:301
float D()
Definition: rso_interface_1.h:304
float _c
Coefficient to describe a 3D plane: aX + bY + cZ + d = 0.
Definition: rso_interface_1.h:271
float _b
Coefficient to describe a 3D plane: aX + bY + cZ + d = 0.
Definition: rso_interface_1.h:270
float _d
Coefficient to describe a 3D plane: aX + bY + cZ + d = 0.
Definition: rso_interface_1.h:272
float B()
Definition: rso_interface_1.h:298
Definition: rso_interface_1.h:649
virtual int GroupLevelsDown() const =0
virtual void AddInclude(const char *str)=0
virtual void GroupLevelsDown(int value)=0
virtual int ExcludeCount() const =0
virtual void LevelsUp(int value)=0
virtual const char * GetExclude(int index) const =0
virtual void AddExclude(const char *str)=0
virtual const char * GetInclude(int index) const =0
virtual int LevelsUp() const =0
virtual bool PassFilter(const char *name) const =0
virtual bool NamesOnly() const =0
virtual void NamesOnly(bool value)=0
virtual int IncludeCount() const =0
Definition: rso_interface_1.h:174
float _z
The Z component.
Definition: rso_interface_1.h:178
float Y()
Definition: rso_interface_1.h:201
float _x
The X component.
Definition: rso_interface_1.h:176
float _y
The Y component.
Definition: rso_interface_1.h:177
float X()
Definition: rso_interface_1.h:198
void Set(float x, float y, float z)
Definition: rso_interface_1.h:190
float Z()
Definition: rso_interface_1.h:204
Definition: rso_interface_1.h:60
virtual bool SetEmittedEventHandler(EmittedEventHandler *handler)=0
static unsigned int strlen(const char *str)
Definition: rso_interface_1.h:723
virtual void SetResource(const char *resourceName, const char *resourceVal)=0
static char * strcpy(char *dest, const char *src)
Definition: rso_interface_1.h:737
virtual void Draw()=0
virtual bool HandleInput(Event *ev)=0
virtual bool GetBoundingSphere(Vector *center, float *radius)=0
virtual void DeleteInstance()=0
Safely delete the object.
virtual const char * GetResource(const char *resourceName)=0
virtual RSOInterface1 * CloneObject()=0
virtual void PreDraw(const OpenGLMatrices &current, Culler &culler)=0
virtual const char * GetResources(ResourceFilter *filter=0)=0
virtual bool Pick3D(const Vector &winLoc, const Vector &logicalCoords, float scale, const Vector &directionVector, Vector &collisionWinLoc, const OpenGLMatrices &drawnMatrices)=0
virtual bool GetBoundingBox(Vector *min, Vector *max, const MatrixD *transform=0)=0
virtual ~RSOInterface1()
Protected destructor so it can't be deleted directly.
Definition: rso_interface_1.h:165
virtual void Calculate(double time)=0
The RSO Interface methods.
Definition: bmpimage.h:46