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