| GL Studio C++ Runtime API

display.h
Go to the documentation of this file.
1/*! \file
2 \brief The disti::DisplayObject class and global enumerations.
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
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*/
40#ifndef INCLUDED_DISTI_DISPLAY_H
41#define INCLUDED_DISTI_DISPLAY_H
42
43#include "cull.h"
44#include "display_types.h"
45#include "disti_metadata.h"
46#include "dynamic_array.h"
47#include "editor_object_base.h"
48#include "gls_gl.h"
49#include "gls_matrix_affine.h"
50#include "gls_painter.h"
51#include "util.h"
52#include "vertex.h"
53#include "weak_referenceable_mixin.h"
54
55#ifdef GLES
56# include "gls_state_manager.h"
57#endif
58
59/** \namespace disti
60 * Contains GL Studio classes and other DiSTI code.
61 */
62 namespace disti
63{
64// Forward declarations
65 class DisplayObject;
66 class DisplayFrame;
67 class Group;
68 class DisplayEvent;
69 class TexturePalette;
70 class CallbackMethodCallerBase;
71 class GlsResourceFilter;
72 class DisplayObjectEditor;
73 class Culler;
74#ifdef GLES
75 class GlsGloFile;
76 class GlsGloFileAttribute;
77#endif
78
79/// \cond INTERNAL
80 GLS_EXPORT void InitializeLibrary( const char* unlockString = NULL, const DisplayFrame* frame = NULL, bool checkLicense = false );
81 GLS_EXPORT const char* LicenseUnlockedBy();
82/// \endcond
83
84 typedef DisplayObject* DisplayObjectPtr; ///< Typedef for a DisplayObject pointer.
85 typedef DynamicArray<DisplayObjectPtr> DisplayObjectArray; ///< Typedef for a DynamicArray containing DisplayObjects.
86 typedef DynamicArray<int> DynamicIntArray; ///< Typedef for a DynamicArray containing ints.
87
88/** \class DisplayObject
89 Base Class for all graphical objects. It is an abstract class. Each
90 object drawn in the editor will have a corresponding object. All drawn objects
91 are derived from this class.
92*/
93
94 class DisplayObject : virtual public AttributeChangedNotifier
95 , virtual public WeakReferenceableMixin
96{
97 friend class DisplayObjectEditor;
98
99 public:
100 /** The default constructor for display objects. Generally invoked
101 * by constructors of derived classes.
102 * \param x X coordinate of object location
103 * \param y Y coordinate of object location
104 * \param z Z coordinate of object location
105 */
106 GLS_EXPORT DisplayObject( float x, float y, float z );
107
108 /** The copy constructor for display objects
109 *
110 * \param object The display object that is being copied
111 * \param generateNames Whether or not to generate a new instance name
112 */
113 GLS_EXPORT DisplayObject( const DisplayObject& object, const bool generateNames );
114
115 /** Virtual destructor for display object */
116 virtual GLS_EXPORT ~DisplayObject();
117
118 /** Call this to delete objects, as it handles special cases
119 * like cleanup of LiveComponents.*/
120 GLS_EXPORT void Destroy();
121
122#ifndef GLES
123 /// \see GetCppInterfaceDescription
124 /// \param addToThisList If not NULL this list will be added to then returned. If NULL a new list will be created.
125 /// \return A templated list.
126 static GLS_EXPORT InterfaceListType* StaticGetCppInterfaceDescription( InterfaceListType* addToThisList = NULL );
127#endif
128 /** Sets and retrieves the current setting used for determining what attributes get
129 * created for each object.*/
130 typedef enum
131 {
132 GLS_ATTRIBUTES_BASIC = 1,
133 GLS_ATTRIBUTES_DYNAMIC = 2,
134 GLS_ATTRIBUTES_APPEARANCE = 4,
135 GLS_ATTRIBUTES_GEOMETRY = 8,
136 GLS_ATTRIBUTES_SPECIALIZED = 16,
137 GLS_ATTRIBUTES_ALL = ~0,
138 GLS_ATTRIBUTES_NONE = 0
139 } AvailableAttributesEnum;
140
141 /** Specifies which attributes are available for the object.
142 * Currently the available attributes cannot be changed after they have been set.
143 * (Only the first call has an effect.)
144 * \param value A bitfield specifying which types of attributes to make available.
145 * \sa AvailableAttributesEnum
146 */
147 virtual GLS_EXPORT void SetAvailableAttributes( unsigned int value );
148
149 /** Set the alpha mode state for this object
150 * \param mode which alpha mode to use when drawing
151 * \sa AlphaMode_e
152 */
153 virtual GLS_EXPORT void AlphaMode( int mode );
154
155 /** Get the alpha mode for this object
156 * \return Whether or not alpha testing or blending is enabled when drawing
157 * \sa AlphaMode_e
158 */
159 virtual GLS_EXPORT int AlphaMode();
160
161 /** Get the anti aliasing state this object
162 * \return Whether or not this object will be drawn antialiased
163 */
164 virtual GLS_EXPORT bool AntiAlias();
165
166 /** Set the anti aliasing state for this object
167 * \param alias Whether or not to perform anti aliasing
168 */
169 virtual GLS_EXPORT void AntiAlias( bool alias );
170
171 /** Second half of texture setup. Applies texture modes like modulate, decal, etc.
172 * \param textureIndex Index of the texture to apply
173 */
174 GLS_EXPORT void ApplyTextureSettings( int textureIndex = -1 /* will use _textureIndex by default */ );
175
176 /// Gets the full list of attributes for this object.
177 /// \return A reference to the attribute dictionary in this object.
178 inline DistiAttribDict& Attributes() { return *_attribDict; };
179
180 /// Gets the full list of attributes for this object, except const.
181 /// \return A reference to the attribute dictionary in this object.
182 inline const DistiAttribDict& Attributes() const { return *_attribDict; };
183
184 /** Sets the texture blend color for the object
185 * \param color A GlsColor
186 */
187 virtual GLS_EXPORT void SetBlendColor( const GlsColor& color );
188
189 /** Gets the texture blend color for the object
190 * \param color Filled in with RGBA (0-255 range)
191 * NOTE: Not Virtual. Simply calls void GetBlendColor(const GlsColor& color);
192 */
193 GLS_EXPORT void GetBlendColor( unsigned char color[] );
194
195 /** Gets the texture blend color for the object
196 * \param r Returns red color component (0-255 range)
197 * \param g Returns Green color component (0-255 range)
198 * \param b Returns Blue color component (0-255 range)
199 * \param a Returns Alpha color component (0-255 range)
200 * NOTE: Not Virtual. Simply calls void GetBlendColor(const GlsColor& color);
201 */
202 GLS_EXPORT void GetBlendColor( unsigned char& r, unsigned char& g, unsigned char& b, unsigned char& a );
203
204 /** Gets the texture blend color for the object
205 * \return Returns the current texture blend color.
206 */
207 virtual GLS_EXPORT GlsColor GetBlendColor();
208
209 /** Sets the texture blend color for the object
210 * \param color RGBA color (0-255 range)
211 * NOTE: Not Virtual. Simply calls void SetBlendColor(const GlsColor& color);
212 */
213 GLS_EXPORT void SetBlendColor( unsigned char color[] );
214
215 /** Sets the texture blend color for the object
216 * \param r Red color component (0-255 range)
217 * \param g Green color component (0-255 range)
218 * \param b Blue color component (0-255 range)
219 * \param a Alpha color component (0-255 range)
220 * NOTE: Not Virtual. Simply calls void SetBlendColor(const GlsColor& color);
221 */
222 GLS_EXPORT void SetBlendColor( unsigned char r, unsigned char g, unsigned char b, unsigned char a );
223
224 /// \return True if the object is blinked off (invisible) false otherwise.
225 virtual GLS_EXPORT bool BlinkedOff();
226
227 /** Get the blinking state this object
228 * \return Whether or not this object is blinking
229 */
230 virtual GLS_EXPORT bool Blinking();
231
232 /** Set the blinking state for this object
233 * \param blink Whether or not to blink this object
234 */
235 virtual GLS_EXPORT void Blinking( const bool blink );
236
237 /** Get the blinking rate this object
238 * \return The rate at which this object is blinking
239 */
240 virtual GLS_EXPORT float BlinkRate();
241
242 /** Set the blinking rate for this object
243 * \param rate Number of times per second to blink this object
244 */
245 virtual GLS_EXPORT void BlinkRate( const float rate );
246
247 /// Sets whether the application should use the system time or a manual time
248 /// for calculating the blink state of objects
249 /// \param useManualTime If true, will use user defined time, otherwise system time.
250 static GLS_EXPORT void UseManualBlinkElapsedTime( bool useManualTime );
251
252 /// Sets the time the application will use to determine the blink state of
253 /// objects. Has no effect if UseManualBlinkElapsedTime was not set to true.
254 /// \param elapsedTime The blink time to be set.
255 static GLS_EXPORT void SetManualBlinkElapsedTime( double elapsedTime );
256
257 /** Get the current bounding volume center
258 * \return The current bounding volume center
259 */
260 inline const Vector& BoundingVolumeCenter() const { return _boundingVolumeCenter; }
261
262 /** Set the current bounding volume center
263 * \param center The new center
264 */
265 void GLS_EXPORT BoundingVolumeCenter( const Vector& center );
266
267 /** Determines if the given ray hits this bounding volume
268 * \param start Starting point of the ray
269 * \param direction Direction vector of the ray
270 * \return True if this bounding volume hit by the ray
271 */
272 bool GLS_EXPORT BoundingVolumeHit( const Vector& start, const Vector& direction );
273
274 /** Get the bounding sphere radius
275 * \return The bounding sphere radius
276 */
277 inline float BoundingVolumeRadius() const { return _boundingVolumeRadius; }
278
279 /** Set the bounding sphere radius
280 * \param radius The bounding sphere radius
281 */
282 void GLS_EXPORT BoundingVolumeRadius( float radius );
283
284 /** Provides a mechanism for performing regular calculations, seperate
285 * from drawing. In a standalone applicaton Calculate is recursively
286 * called by the main loop before the objects are drawn.
287 * \param time The elaspsed time in seconds since program start
288 */
289 virtual GLS_EXPORT void Calculate( double time );
290
291 /** Calculates where the pick vector hit this object
292 * \param pickLoc Start of the pick vector
293 * \param directionVector Direction of the pick vector
294 * \param collisionPoint Returns the collision point
295 */
296 GLS_EXPORT void CalculateCollisionPoint( const Vector& pickLoc, const Vector& directionVector, Vector* collisionPoint );
297
298 /** Calculates the bounding box of the parent group object.
299 */
300 virtual GLS_EXPORT void CalculateParentBoundingBox();
301
302 /** Recalculates the texture coordinates for the object based on the TexturePoints.
303 */
304 virtual GLS_EXPORT void CalculateTextureCoordinates();
305
306 /// Converts the object's texture points into a transformation matrix
307 /// for use in calculating the object's texture coordinates.
308 /// \param world2tex Returned matrix result.
309 /// \return True if successful, otherwise false.
310 GLS_EXPORT bool GetTexturePointTransformationMatrix( GlsMatrixType& world2tex );
311
312 /** \return The current callback method for this object */
313 inline CallbackMethodCallerBase* CallbackCaller() const { return _callbackCaller; }
314
315 /** Sets the callback method for this object. cb MUST be dynamically allocated since
316 * memory management will be passed to this display object. cb will be deleted when
317 * a new callback is registered via this method or when the display object is
318 * destructed.
319 * \param cb The new callback method for this object
320 */
321 GLS_EXPORT void CallbackCaller( CallbackMethodCallerBase* cb );
322
323 /** Gets the location of the center of the object in logical units. Value is based on the
324 * extents of the object and does not take into consideration dynamic rotation
325 * \param center Will contain the center coordinate on return
326 */
327 virtual GLS_EXPORT void GetCenter( Vector& center );
328
329 /** Copy+Create operation in one method. In derived classes, this
330 * method will create a new instance of the derived class and then
331 * copy the object into the new instance. The cut,copy,paste and undo
332 * operations use this method.
333 * \param generateNames Whether or not to generate new names for cloned objects
334 * \return A new object, identical to the original, except for the instance name
335 */
336 virtual DisplayObject* CloneObject( bool generateNames = false ) = 0;
337
338 /** Gets the color for the object outline
339 * \return The outline color
340 */
341 virtual GLS_EXPORT GlsColor GetColor();
342
343 /** Gets the RGBA color for the object outline
344 * \param c4 Gets the RGBA line color (0-255 range) for the object
345 * NOTE: Not Virtual. Simply calls void GetColor(const GlsColor& color)
346 */
347 GLS_EXPORT void GetColor( unsigned char c4[] );
348
349 /** Gets the RGBA color for the object outline
350 * \param r Gets the red component (0-255 range) of the line color for the object
351 * \param g Gets the blue component (0-255 range) of the line color for the object
352 * \param b Gets the green component (0-255 range) of the line color for the object
353 * \param a Gets the alpha component (0-255 range) of the line color for the object
354 * NOTE: Not Virtual. Simply calls void GetColor(const GlsColor& color)
355 */
356 GLS_EXPORT void GetColor( unsigned char& r, unsigned char& g, unsigned char& b, unsigned char& a );
357
358 /** Sets the RGBA color for the object outline
359 * \param color The new color
360 */
361 virtual GLS_EXPORT void SetColor( const GlsColor& color );
362
363 /** Sets the RGBA color for the object outline
364 * \param c4 The new RGBA (0-255 range) line color for the object
365 * NOTE: Not Virtual. Simply calls void SetColor(const GlsColor& color)
366 */
367 inline void SetColor( unsigned char c4[] ) { SetColor( GlsColor( c4 ) ); }
368
369 /** Sets the RGBA color for the object outline
370 * \param r The new red component (0-255 range) of the line color for the object
371 * \param g The new blue component (0-255 range) of the line color for the object
372 * \param b The new green component (0-255 range) of the line color for the object
373 * \param a The new alpha component (0-255 range) of the line color for the object
374 * NOTE: Not Virtual. Simply calls void SetColor(const GlsColor& color)
375 */
376 inline void SetColor( unsigned char r, unsigned char g, unsigned char b, unsigned char a ) { SetColor( GlsColor( r, g, b, a ) ); }
377
378 /** Copies the geometry information from one object to another. Used by
379 * the undo mechanism to allow user to undo a geometry change.
380 * \param src The object to copy geometry from */
381 virtual GLS_EXPORT void CopyGeometry( DisplayObject* src );
382
383 /** Copies the hierarchy information from one object to another
384 * \param src The object to copy from
385 * \param copyName Whether or not to copy the object name
386 */
387 virtual GLS_EXPORT void CopyHierarchyProperties( DisplayObject* src, bool copyName );
388
389 /** Copies the attributes except for geometry attributes from one object
390 * to another. Used by the undo mechanism to undo most attribute change
391 * operations.
392 * \param src The object to copy properties from */
393 virtual GLS_EXPORT void CopyProperties( DisplayObject* src );
394
395#ifndef GLES
396 /** Get the details of the Cpp Interface
397 * The actual interface is exposed in compiled code.
398 * \param addToThisList If not NULL this list will be added to then returned. If NULL a new list will be created.
399 * \return A templated list.
400 * The caller must call the corresponding free method to
401 * safely free the memory.
402 */
403 virtual GLS_EXPORT InterfaceListType* GetCppInterfaceDescription( InterfaceListType* addToThisList = NULL );
404
405 /** Frees the memory allocated by a previous call to GetCppInterfaceDescription
406 * \param array Memory allocated by a previous call to GetCppInterfaceDescription
407 */
408 virtual GLS_EXPORT void GetCppInterfaceDescriptionFree( InterfaceListType* array );
409#endif
410
411 /** Sets if back faces should be removed
412 * \param val True if back faces should be removed
413 */
414 virtual GLS_EXPORT void CullBackFace( const bool val );
415
416 /** Returns if back faces should be removed
417 * \return True if backfaces are removed
418 */
419 virtual GLS_EXPORT bool CullBackFace();
420
421 /// \return Whether or not this object is currently culled.
422 inline bool Culled() const { return _culled; }
423
424 /// Set whether or not the object is to be culled.
425 /// \param val The new cull value.
426 inline void Culled( bool val ) { _culled = val; }
427
428 /// This is the cull test normally performed within PreDraw().
429 /// \param matrix Transformation from vertices to the frustrums coordinate system.
430 /// \param culler Culler to perform the test.
431 /// \return True if object is to be culled, otherwise false.
432 inline bool CullTest( const GlsMatrixType* matrix, const Culler& culler )
433 {
434 // Make some vectors representing a unit sphere
435 Vector loc( _boundingVolumeCenter + _location );
436 Vector i( loc );
437 Vector j( loc );
438 Vector k( loc );
439
440 i.x += 1.0f;
441 j.y += 1.0f;
442 k.z += 1.0f;
443
444 // Transform into the frustrums coordinate system
445 matrix->Transform( loc );
446 matrix->Transform( i );
447 matrix->Transform( j );
448 matrix->Transform( k );
449
450 // Subtract the location to get the radius vectors
451 i -= loc;
452 j -= loc;
453 k -= loc;
454
455 // Find the largest radius of the transformed sphere
456 float maxRadius = sqrtf( MAX( i.MagnitudeSquared(), MAX( j.MagnitudeSquared(), k.MagnitudeSquared() ) ) );
457
458 return culler.SphereOutsideFrustum( loc, maxRadius * _boundingVolumeRadius );
459 }
460
461 /// Gets the objects Dynamic Coordinate System (DCS) Matrix.
462 /// \return A reference to the Dcs Matrix stored in the object.
463 GlsMatrixType& DcsMatrix() { return _dcsMatrix; } // deprecated
464
465 /// Gets the objects Dynamic Coordinate System (DCS) Matrix.
466 /// \return The Dcs Matrix value stored in the object.
467 GlsMatrixType DcsMatrix() const { return _dcsMatrix; }
468
469 /** Sets the dcs matrix
470 * \param matrix the dcs matrix
471 */
472 void GLS_EXPORT DcsMatrix( const GlsMatrixType& matrix );
473
474 /// Remove the Vertex at \a index.
475 /// \param index The index of the vertex to delete.
476 virtual GLS_EXPORT void DeleteVertexAt( unsigned int index );
477
478 /** Remove the Vertex at (indexAfter - 1).
479 * \param indexAfter One past the index to delete. If it is beyond the number of vertices or
480 * is 0, the vertices will be unchanged.
481 * \deprecated User code should use DeleteVertexAt() instead.
482 * \note This virtual function is kept for backwards compatibility only. It is marked 'final'
483 * (where supported). Subclasses should override DeleteVertexAt() instead.
484 */
485 DISTI_DEPRECATED( "User code should use DeleteVertexAt()." )
486 virtual void DeleteVertex( unsigned int indexAfter ) DISTI_FINAL
487 {
488 if( indexAfter > 0 )
489 {
490 DeleteVertexAt( indexAfter - 1 );
491 }
492 }
493
494 /** Get the z buffering state for this object
495 * \return Whether or not this object will be draw Z buffered
496 */
497 virtual GLS_EXPORT int DepthTest();
498
499 /** Set the z buffering state for this object
500 * \param zbuf Whether or not to perform z buffering
501 */
502 virtual GLS_EXPORT void DepthTest( unsigned char zbuf );
503
504 /** Draws this object on the current display frame (_parent member).
505 Pure virtual method */
506 virtual void Draw() = 0;
507
508 /** \returns This object's _drawMatrix (it's contribution to the ModelMatrix)
509 * or NULL if the object does not have a _drawMatrix.
510 */
511 inline const GlsMatrixType* DrawMatrix() { return _drawMatrix; }
512
513 /** \returns True if the draw matrix needs to be calculated
514 */
515 inline bool NeedCalcDrawMatrix() { return _needCalcDrawMatrix; }
516
517 /** Sets the dynamic rotation to the specified value for the specified axis (in degrees)
518 * \param angle The new dynamic rotation angle for the object
519 * \param axis The axis to change
520 * NOTE: Not virtual
521 */
522 GLS_EXPORT void DynamicRotate( float angle, int axis );
523
524 /** Sets the dynamic rotation to the specified value for all axes (in degrees)
525 * \param v Vector containing the new dynamic rotation angles for each axis
526 */
527 GLS_EXPORT void DynamicRotate( const Vector& v );
528
529 /** Sets the dynamic rotation to the specified value for all axes (in degrees)
530 * \param angle Array of three floats containing the new dynamic rotation angles for each axis
531 */
532 GLS_EXPORT void DynamicRotate( float angle[] );
533
534 /** Sets the dynamic rotation to the specified value for all axes (in degrees)
535 * \param x The new dynamic rotation angle for the X axis
536 * \param y The new dynamic rotation angle for the Y axis
537 * \param z The new dynamic rotation angle for the Z axis
538 * NOTE: Is virtual. If needed overload this method.
539 */
540 virtual GLS_EXPORT void DynamicRotate( float x, float y, float z );
541
542 /** Changes the dynamic rotation by the specified value for the specified axis (in degrees)
543 * \param angle The change in dynamic rotation angle for the object
544 * \param axis The axis to change
545 */
546 virtual GLS_EXPORT void DynamicRotateRelative( float angle, int axis );
547
548 /** Gets the dynamic rotation to the specified value for
549 * the specified axis.
550 * \param axis The axis to get the rotation from
551 * \return The dynamic rotation angle for the axis (in degrees)
552 */
553 virtual GLS_EXPORT float DynamicRotation( int axis );
554
555 /// Returns the dynamic rotation for this object on all axes.
556 /// \return The vector containing the dynamic rotation values.
557 virtual GLS_EXPORT Vector DynamicRotation();
558
559 /** Returns the dynamic scale values in a Vertex
560 * \return The dynamic scale values
561 * NOTE: Not virtual
562 */
563 virtual GLS_EXPORT Vector DynamicScale();
564
565 /** Sets the dynamic scale values for an object.
566 * \param x X scale
567 * \param y Y scale
568 * \param z Z scale
569 */
570 virtual GLS_EXPORT void DynamicScale( float x, float y, float z );
571
572 /** Sets the dynamic scale values for an object.
573 * \param scale The new dynamic scale for the object
574 */
575 GLS_EXPORT void DynamicScale( const Vector& scale );
576
577 /** Sets the dynamic translation to the specified value for all axes (in logical units)
578 * \note Make sure to pass float values for x,y,z here,
579 or the compiler may choose an unexpected method signature.
580 * \sa DynamicTranslate(float, int, bool)
581 * \param x The new dynamic translation for the X axis
582 * \param y The new dynamic translation for the Y axis
583 * \param z The new dynamic translation for the Z axis
584 * \param relative If true will add to existing dynamic translation
585 */
586 virtual GLS_EXPORT void DynamicTranslate( float x, float y, float z, bool relative = false );
587
588 /** Sets the dynamic translation to the specified value for all axes (in logical units)
589 * \param amount The new dynamic translation for the X, Y, and Z axes
590 * \param relative If true will add to existing dynamic translation
591 * NOTE: Not virtual
592 */
593 GLS_EXPORT void DynamicTranslate( const Vertex& amount, bool relative );
594
595 /** Sets the dynamic translation to the specified value for all axes (in logical units). Equivalent to DynamicTranslate( amount, false );
596 * \param amount The new dynamic translation for the X, Y, and Z axes
597 * NOTE: Not virtual
598 */
599 GLS_EXPORT void DynamicTranslate( const Vector& amount );
600
601 /** Sets the dynamic translation to the specified value for the specified axis
602 * \param amount The new dynamic translation for the axis
603 * \param axis Z_AXIS, Y_AXIS, or X_AXIS
604 * \param relative If true will add to existing dynamic translation
605 */
606#ifdef GLES
607 virtual GLS_EXPORT void DynamicTranslateAxis( float amount, int axis, bool relative );
608#else
609 virtual GLS_EXPORT void DynamicTranslate( float amount, int axis, bool relative = false );
610#endif
611 /** Returns the current dynamic translation for the specified axis
612 * \param axis Z_AXIS, Y_AXIS, or X_AXIS
613 * \returns the translation
614 */
615 virtual GLS_EXPORT float DynamicTranslation( int axis );
616
617 /** Returns the current dynamic translation for all axes
618 * \returns the translation
619 */
620 virtual GLS_EXPORT Vector DynamicTranslation();
621
622 /** Used in the editor to access editor functionality. Gets the editor object pointer.
623 * USER CODE SHOULD NOT USE THIS METHOD!
624 * \return Pointer to editor object.
625 */
626 GLS_EXPORT DisplayObjectEditor* Editor();
627
628 /** Used in the editor to access editor functionality. Gets the editor object pointer.
629 * USER CODE SHOULD NOT USE THIS METHOD!
630 * \return Pointer to editor object.
631 */
632 GLS_EXPORT const DisplayObjectEditor* Editor() const;
633
634 /** Used in the editor to access editor functionality. Sets the editor object pointer.
635 * USER CODE SHOULD NOT USE THIS METHOD!
636 * \param editor Pointer to editor object.
637 */
638 GLS_EXPORT void Editor( DisplayObjectEditor* editor );
639
640 /** Figure out the static extents for the object.
641 * Used by the editor as part of the pick operation and
642 * for figuring out the size of groups.
643 * \param x Gets the minimum x extent
644 * \param y Gets the minimum y extent
645 * \param z Gets the minimum z extent
646 * \param x1 Gets the maximum x extent
647 * \param y1 Gets the maximum y extent
648 * \param z1 Gets the maximum z extent
649 */
650 virtual GLS_EXPORT void GetExtents( float& x, float& y, float& z, float& x1, float& y1, float& z1 );
651
652 /** Determines the static extents of geometry projected to the XY plane of the object's DCS.
653 * \param min Returns the minimum values found in the traversal
654 * \param max Returns the maximum values found in the traversal
655 */
656 GLS_EXPORT void GetExtentsDCS( Vector& min, Vector& max );
657
658 /** Gets the RGBA color for filling the object
659 * \param r Gets the red component (0-255 range) of the fill color for the object
660 * \param g Gets the blue component (0-255 range) of the fill color for the object
661 * \param b Gets the green component (0-255 range) of the fill color for the object
662 * \param a Gets the alpha component (0-255 range) of the fill color for the object
663 * NOTE: NOT Virtual Simply calls GlsColor GetFillColor()
664 */
665 GLS_EXPORT void GetFillColor( unsigned char& r, unsigned char& g,
666 unsigned char& b, unsigned char& a );
667
668 /** Gets the RGBA color for filling the object
669 * \param c4 Gets the RGBA fill color (0-255 range) for the object
670 * NOTE: NOT Virtual. Simply calls GlsColor GetFillColor()
671 */
672 GLS_EXPORT void GetFillColor( unsigned char c4[] );
673
674 /** Gets the fill color of the object
675 * \return The fill color
676 */
677 virtual GLS_EXPORT GlsColor GetFillColor();
678
679 /** Sets the RGBA color for filling the object
680 * \param r The new red component (0-255 range) of the fill color for the object
681 * \param g The new blue component (0-255 range) of the fill color for the object
682 * \param b The new green component (0-255 range) of the fill color for the object
683 * \param a The new alpha component (0-255 range) of the fill color for the object
684 * NOTE: Not Virtual. Simply calls void SetFillColor(const GlsColor& color)
685 */
686 inline void SetFillColor( unsigned char r, unsigned char g, unsigned char b, unsigned char a ) { SetFillColor( GlsColor( r, g, b, a ) ); }
687
688 /** Sets the RGBA color for filling the object
689 * \param c4 The new RGBA fill color (0-255 range) for the object
690 * NOTE: Not Virtual. Simply calls void SetFillColor(const GlsColor& color)
691 */
692 inline void SetFillColor( unsigned char c4[] ) { SetFillColor( GlsColor( c4 ) ); }
693
694 /** Sets the RGBA color for filling the object
695 * \param color The new RGBA fill color (0-255 range) for the object
696 */
697 virtual GLS_EXPORT void SetFillColor( const GlsColor& color );
698
699 /// Allows the object the opportunity to configure itself after having all its children initialized and properties set by the
700 /// code generator. By default, users do not need to call this function, it is called by the generated code in CreateObjects()
701 /// if the object is a user defined class. User defined classes can override this, calling BaseClass::FinishObject(),
702 /// before supplying class specific initialization code as needed.
703 /// User code should only conisder itself and its children as the hierarchy above will not have been set up yet.
704 /// User code should not call FinishObject on its children, since it will have already been called when those children were created.
705 /// This method will be called by generated code once this object and its children have been fully instantiated.
706 virtual void FinishObject(){};
707
708 /** Dynamically generate a name for the object, based on the current time
709 */
710 virtual GLS_EXPORT void GenerateInstanceName();
711
712 /** Handles an event that is sent to the object.
713 * \param ev The event to send to the object
714 * \returns Which object handled the event
715 */
716 virtual GLS_EXPORT DisplayObject* handle( DisplayEvent* ev );
717
718 /// Determines if the object is hit by a pick ray starting at (x,y,z) and pointing towards directionVector in object logical coordinate system.
719 /// If Pickable() == PICK_BEST it will return the closest point that was hit, otherwise it returns the first point that was hit.
720 /// This method should not pick points behind the viewer.
721 /// \param x X coordinate of pick ray start in logical coordinates.
722 /// \param y Y coordinate of pick ray start in logical coordinates.
723 /// \param z Z coordinate of pick ray start in logical coordinates.
724 /// \param scale The scale factor of the window. Affects picking of outlines. Standard value is 1.0.
725 /// \param directionVector The direction of the pick ray.
726 /// \param collisionPoint If this method returns true, this Vector will contain the location that was hit in logical coordinates.
727 /// \return boolean indicating if the object was hit by the pick ray.
728 virtual GLS_EXPORT bool Hit( float x, float y, float z, float scale, const Vector& directionVector, Vector* collisionPoint );
729
730 /// Determines if the object is hit by a pick ray starting at (x,y,z) and pointing towards directionVector in the object logical coordinate system
731 /// If Pickable() == PICK_BEST it will return the closest point that was hit, otherwise it returns the first point that was hit.
732 /// This method should not pick points behind the viewer.
733 /// \param x X coordinate of pick ray start in logical coordinates.
734 /// \param y Y coordinate of pick ray start in logical coordinates.
735 /// \param z Z coordinate of pick ray start in logical coordinates.
736 /// \param scale The scale factor of the window. Affects picking of outlines. Standard value is 1.0.
737 /// \param vertices An array of vertices describing the Object.
738 /// \param vertex_cnt Size of the vertices array.
739 /// \param directionVector The direction of the pick vector.
740 /// \param collisionPoint If this method returns true, this Vector will contain the location that was hit in logical coordinates.
741 /// \return True if click is inside, false otherwise.
742 ///
743 /// Comment: The hit determination algorithm is based on the principle
744 /// that a point is inside a polygon if a line drawn through the
745 /// point intersects an even number of edges.
746 virtual GLS_EXPORT bool HitUtil( float x, float y, float z, float scale, Vertex* vertices, unsigned int vertex_cnt, const Vector& directionVector, Vector* collisionPoint );
747
748 /// Insert a vertex at \a index. Duplicate the vertex pointed to
749 /// by \a index, so that there are two vertices that are exactly the same.
750 /// If \a index is greater than the number of vertices, then the last vertex is duplicated.
751 /// \param index The index to insert a vertex at.
752 virtual GLS_EXPORT void InsertVertexAt( unsigned int index );
753
754 /** Insert a new vertex into the vertex array, duplicating the vertex at (indexAfter - 1).
755 * \param indexAfter One past the index to insert. The vertex before this (or the last vertex,
756 * if more than the number of vertices) will be duplicated. If 0, the 0th vertex
757 * will be duplicated.
758 * \deprecated New code should use InsertVertexAt().
759 * \note This virtual function is kept for backwards compatibility only. It is marked 'final'
760 * (where supported). Subclasses should override InsertVertexAt() instead.
761 */
762 DISTI_DEPRECATED( "User code should use InsertVertexAt()." )
763 virtual void InsertVertex( unsigned int indexAfter ) DISTI_FINAL
764 {
765 InsertVertexAt( indexAfter > 0 ? indexAfter - 1 : 0 );
766 }
767
768 /// Gets the name for the object.
769 /// \return The name of the object.
770 GLS_EXPORT char* InstanceName();
771
772 /// Gets the name for the object, but const.
773 /// \return The name of the object.
774 GLS_EXPORT const char* InstanceName() const;
775
776 /** Sets the name for the object. This name corresponds to the name
777 * that is generated in the source code.
778 * \param name The new name for the object
779 */
780 GLS_EXPORT void InstanceName( const char* name );
781
782 /// \return The current lighting state.
783 virtual GLS_EXPORT bool LightingEnabled();
784
785 /// Sets the lighting state.
786 /// \param lighting The new lighting state.
787 virtual GLS_EXPORT void LightingEnabled( bool lighting );
788
789 /** Get the line stipple multiplier for this object
790 * \return The line stipple multiplier for this object
791 */
792 virtual GLS_EXPORT int LineStippleMultiplier();
793
794 /** Set the line stipple multiplier for this object
795 * \param mult The new line stipple pattern
796 */
797 virtual GLS_EXPORT void LineStippleMultiplier( int mult );
798
799 /** Get the line stipple pattern for this object
800 * \return The line stipple pattern for this object
801 */
802 virtual GLS_EXPORT int LineStipplePattern();
803
804 /** Set the line stipple pattern for this object
805 * \param pattern The new line stipple pattern
806 */
807 virtual GLS_EXPORT void LineStipplePattern( int pattern );
808
809 /** Gets the width of lines in the object.
810 * \return The line width of the object in logical units
811 */
812 virtual GLS_EXPORT float LineWidth();
813
814 /** Sets the width of lines in the object.
815 * \param width The new line width of the object in logical units
816 */
817 virtual GLS_EXPORT void LineWidth( float width );
818
819 /** \return The location of the origin of the object
820 * Lifetime is guaranteed to coincide with the DisplayObject's lifetime.
821 */
822 virtual GLS_EXPORT const Vertex& Location() const;
823
824 /** Sets the location of the origin of the object
825 * \param v The new location
826 */
827 virtual GLS_EXPORT void Location( const Vertex& v );
828
829 /** Sets the location of the origin of the object
830 * \param x X Coordinate of the new location
831 * \param y Y Coordinate of the new location
832 * \param z Z Coordinate of the new location
833 */
834 virtual GLS_EXPORT void Location( float x, float y, float z );
835
836 /** Gets the location of the origin of the object
837 * \param v Will be filled in with the current location
838 */
839 virtual GLS_EXPORT void GetLocation( Vertex& v );
840
841 /** Gets the location of the origin of the object
842 * \param x Will be filled in with the x coordinate
843 * \param y Will be filled in with the y coordinate
844 * \param z Will be filled in with the z coordinate
845 */
846 virtual GLS_EXPORT void GetLocation( float& x, float& y, float& z );
847
848 /** \return X component of location */
849 inline float X() const { return Location().x; }
850
851 /** \return Y component of location */
852 inline float Y() const { return Location().y; }
853
854 /** \return Z component of location */
855 inline float Z() const { return Location().z; }
856
857 /// Sets x component of location
858 /// \param x The new x location.
859 inline void X( const float x ) { Location( x, Y(), Z() ); }
860
861 /// Sets y component of location
862 /// \param y The new x location.
863 inline void Y( const float y ) { Location( X(), y, Z() ); }
864
865 /// Sets z component of location
866 /// \param z The new x location.
867 inline void Z( const float z ) { Location( X(), Y(), z ); }
868
869 /// \return The current material index. Returns -1 if multiple are applied.
870 virtual GLS_EXPORT int MaterialIndex();
871
872 /// Sets the material index.
873 /// \param index The new material index to set.
874 virtual GLS_EXPORT void MaterialIndex( int index );
875
876 /// \return A list of material indices.
877 virtual GLS_EXPORT DynamicArray<int>& MaterialIndices();
878
879 /// Sets the list of material indices.
880 /// \param indices The new material list to set.
881 virtual GLS_EXPORT void MaterialIndices( DynamicArray<int> indices );
882
883 /** \return The saved Model matrix, if any. Normally not used by the user.*/
884 GLS_EXPORT GlsMatrixType* ModelMatrix();
885
886 /** \return true if Calculate() needs to be called on this object */
887 inline bool NeedCalculate() { return _needCalculate; }
888
889 /** Gets the object's normals.
890 * \return Pointer to the object's normal vertex array
891 */
892 inline Vector* Normals() { return ( _normals ); }
893
894 /** Sets the vertex normal data for this object
895 * \param nPoints The number of vertices in the object
896 * \param vertices The vertex normals for the object
897 */
898 virtual GLS_EXPORT void SetNormals( unsigned int nPoints, Vector* vertices );
899
900 /** Sets the vertex normal data for this object
901 * \param nPoints The number of vertices in the object
902 * \param ... X,Y,Z for each vertex normal
903 */
904 GLS_EXPORT void VaSetNormals( unsigned int nPoints, ... );
905
906 /** Gets the object's number of vertices.
907 * \return The integer number of vertices in the object
908 */
909 inline unsigned int NumberOfVertices() const { return ( _nVertices ); }
910
911 /** Get the depth (in the Z Dimension) of the object in logical units. Value is based on the
912 * extents of the object and does not take into consideration dynamic rotation
913 * \return The depth in logical units (based on extents in the Z Dimension)
914 */
915 virtual GLS_EXPORT float ObjectDepth();
916
917 /** Get the height (in the Y Dimension) of the object in logical units. Value is based on the
918 * extents of the object and does not take into consideration dynamic rotation
919 * \return The height in logical units (based on extents in the Y Dimension)
920 */
921 virtual GLS_EXPORT float ObjectHeight();
922
923 /** Get the width (in the X Dimension) of the object in logical units. Value is based on the
924 * extents of the object and does not take into consideration dynamic rotation
925 * \return The width in logical units (based on extents in the X Dimension)
926 */
927 virtual GLS_EXPORT float ObjectWidth();
928
929 /** Redefines the frame of reference for the object. Since the vertices in the object are
930 * specified relative to the _location member, this routine allows you to specify the
931 * absolute coordinate for _location and then recalculates the vertices to be relative to that
932 * new location
933 * \param vert The new origin point for the object
934 */
935 virtual GLS_EXPORT void SetOrigin( const Vertex& vert );
936
937 /** Sets the parent display frame pointer for this object to the indicated display frame
938 * \param par The new display frame to be the parent object
939 */
940 virtual GLS_EXPORT void Parent( DisplayFrame* par );
941
942 /** Gets the parent display frame pointer for this object
943 * \return The parent display frame of this object
944 */
945 inline DisplayFrame* Parent() const { return _parent; }
946
947 /** Sets the parentGroup pointer for this object
948 * \param group The group to which this object belongs
949 */
950 virtual GLS_EXPORT void ParentGroup( Group* group );
951
952 /** Gets the parentGroup pointer for this object
953 * \return The group to which this object belongs
954 */
955 inline Group* ParentGroup() const { return _parentGroup; }
956
957 /** Attempts to pick an object in 3D and accounting for dynamic rotations and translations of this object or
958 * parent objects. It also looks at the pickable status and attempts to return the "Best" pick if that is
959 * what is desired.
960 *
961 * Note: This method will pick objects in the scene based on a pick ray starting at winLoc and pointing into the screen.
962 * It will not pick objects behind the depth specified by winLoc.z. Typically winLoc.z should be set to 0 to ensure that
963 * the pick ray starts at near clip plane.
964 *
965 * \param winLoc Device coordinates for the mouse click. Z value should be set to 0 to ensure pick ray starts at near clip plane.
966 * \param logicalCoords The start of the pick ray in logical coordinates. Should be calculated from the winLoc using this->WindowToLogical(winLoc, logicalCoords, &directionVector).
967 * \param scale Current window scale. Affects picking radius of outlines. Initial value should typically be 1.0.
968 * \param directionVector The direction of the pick ray in logical coordinates. Should be calculated from the winLoc using this->WindowToLogical(winLoc, logicalCoords, &directionVector).
969 * \param collisionWinLoc Returns where the pick vector intersects the object that is hit in device coordinates.
970 * \param drawnMatrices The matrices used to draw the object, including matrices set by parents that may have
971 * dynamically rotated, translated or scaled this object. Initial value should typically be a default OpenGLMatrices() object.
972 *
973 * \return The object that was hit, or NULL if no object hit
974 */
975 virtual GLS_EXPORT DisplayObject* Pick3D( const Vector& winLoc,
976 const Vector& logicalCoords,
977 float scale,
978 const Vector& directionVector,
979 Vector& collisionWinLoc, /*Returned*/
980 const OpenGLMatrices& drawnMatrices );
981
982 /** Get the pickable state for this object
983 * \return The pick mode
984 * \sa PickableType_e
985 */
986 inline unsigned char Pickable() { return _pickable; }
987
988 /** Set the pickable state for this object
989 * \param pick The pick mode
990 * \sa PickableType_e
991 */
992 virtual GLS_EXPORT void Pickable( unsigned char pick );
993
994 /** Gets the polygon end mode (Open or Closed) for the polygon
995 * \return Enumeration indicating open or closed mode
996 * \sa PolygonClose_e
997 */
998 virtual GLS_EXPORT int PolygonEnd();
999
1000 /** Sets the polygon end mode (Open or Closed) for the polygon
1001 * \param end Enumeration indicating open or closed mode
1002 * \sa PolygonClose_e
1003 */
1004 virtual GLS_EXPORT void PolygonEnd( const int end );
1005
1006 /** Gets the polygon drawing mode for this object
1007 * \return The polygon drawing mode for this object
1008 * \sa PolygonMode_e
1009 */
1010 virtual GLS_EXPORT int PolygonMode();
1011
1012 /** Sets the polygon drawing mode for this object
1013 * \param mode The new polygon drawing mode for this object
1014 * \sa PolygonMode_e
1015 */
1016 virtual GLS_EXPORT void PolygonMode( int mode );
1017
1018 /** Traverses the hierarchy calculating the
1019 * _modelMatrix, _projMatrix, _viewMatrix as needed.
1020 * \param current Current matrices inherited from parent
1021 * \param culler Object that possibly marks this object for culling
1022 */
1023 virtual GLS_EXPORT void PreDraw( const OpenGLMatrices& current, Culler& culler );
1024
1025 /** \return The saved Projection matrix, if any. Normally not used by the user.
1026 */
1027 GLS_EXPORT GlsMatrixType* ProjMatrix();
1028
1029 /** Reallocates the vertex and texture coordinate and normal arrays. Existing vertices are
1030 * copied . If the new size is less than the old size, the first numVertices vertices are
1031 * copied. If the new size is larger, all vertices are copied and the new vertices are
1032 * initialized to zero.
1033 * \param numVertices The new number of vertices for the object
1034 * \param initializeNew Whether or not to initialize the new vertices
1035 * \param copyOld Whether or not to copy the old data
1036 */
1037 virtual GLS_EXPORT void ReallocateVertices( unsigned int numVertices, bool initializeNew, bool copyOld );
1038
1039 /** Return the relative angle of an line constructed from the given point
1040 * to the _location of the object, (in the xy plane)
1041 * \param x X coordinate of endpoint
1042 * \param y Y coordinate of endpoint
1043 * \return Relative angle in degrees
1044 */
1045 virtual GLS_EXPORT float RelativeAngle( const float x, const float y );
1046
1047 /// Gets a reference to the specified attribute for reading and writing.
1048 /// This reference can be streamed into and out of variables.
1049 /// For Example: someObject->Resource("Visible") >> someBool;
1050 /// someBool << someObject->Resource("Visible");
1051 /// \param name The name of the attribute to be returned.
1052 /// \return A reference to the attribute if it is present, or DistiEmptyAttribute if not.
1053 virtual GLS_EXPORT DistiAttributeBase& Resource( const char* name );
1054
1055 /** Writes the resources (attributes) of this object to the specified stream.
1056 * The output of this method can be controlled by the GlsResourceFilter.
1057 * Note that if filter->NamesOnly() is false (the default), then only resources
1058 * that can return a value will appear in the list.
1059 *
1060 * \sa GlsResourceFilter
1061 * \sa DistiAttributeProperty
1062 * \param outstr The stream to write to
1063 * \param filter The filter to determine what to write
1064 */
1065 virtual GLS_EXPORT void GetResources( std::ostream& outstr, GlsResourceFilter* filter = NULL );
1066
1067#ifndef GLES
1068 /** Restores the alpha test/blend settings if they were changed from default
1069 * \sa SetupAlpha
1070 */
1071 GLS_EXPORT void RestoreAlpha();
1072
1073 /** Restores the antialias settings if they were changed from default
1074 * \sa SetupAntiAlias
1075 */
1076 GLS_EXPORT void RestoreAntiAlias();
1077
1078 /** Restores the lighting state
1079 * \sa SetupLighting
1080 */
1081 GLS_EXPORT void RestoreLighting();
1082
1083 /** Sets the line style settings to their defaults
1084 * \sa SetupLineStyle
1085 */
1086 GLS_EXPORT void RestoreLineStyle();
1087#endif
1088
1089 /** \return The rotation point for the object.
1090 * Lifetime is guaranteed to coincide with the DisplayObject's lifetime.
1091 */
1092 const Vertex& RotationPoint() const { return _rotationPoint; }
1093
1094 /** Sets the location of the rotation point for the object. Dynamic
1095 * rotation of the object will cause the object to be rotated around this
1096 * point.
1097 * \param v The new rotation point
1098 */
1099 virtual GLS_EXPORT void RotationPoint( const Vertex& v );
1100
1101 /** Sets the location of the rotation point for the object. Dynamic
1102 * rotation of the object will cause the object to be rotated around this
1103 * point.
1104 * \param x X Coordinate of the new rotation point
1105 * \param y Y Coordinate of the new rotation point
1106 * \param z Z Coordinate of the new rotation point
1107 */
1108 virtual GLS_EXPORT void RotationPoint( float x, float y, float z );
1109
1110 /** Gets the location of the rotation point for the object.
1111 * \param v Will be filled in with the current rotation point
1112 */
1113 virtual GLS_EXPORT void GetRotationPoint( Vertex& v );
1114
1115 /** Rotates the object (around the specified axis) by the angle
1116 * indicated, at the object's rotation point. Recalculates the
1117 * vertex data.
1118 * \param angle The angle to rotate by, in degrees
1119 * \param axis The axis to rotate the object around.
1120 */
1121 virtual GLS_EXPORT void Rotate( float angle, int axis = Z_AXIS );
1122
1123 /** Rotates the object (around the specified axis) by the angle indicated,
1124 * at the point specified. Recalculates the vertex data.
1125 * \param origin The point to rotate around
1126 * \param angle The angle to rotate by, in degrees
1127 * \param axis The axis to rotate the object around
1128 */
1129 virtual GLS_EXPORT void Rotate( const Vector& origin, float angle, int axis = Z_AXIS );
1130
1131 /** Rotates the object (around the specified axis) by the angle indicated,
1132 * at the point specified. Recalculates the vertex data.
1133 * \param orig The point to rotate around
1134 * \param angle The angle to rotate by, in degrees
1135 * \param axis The arbitrary axis to rotate the object around
1136 */
1137 virtual GLS_EXPORT void Rotate( const Vector& orig, float angle, const Vector& axis );
1138
1139 /** Causes the Projection, Model and View matrix for this object to be saved. Used by the 3D
1140 * picking algorithm. Normally not used by the user.
1141 */
1142 GLS_EXPORT void SaveMatrices();
1143
1144 /** Scales the object, either the handleBar, or the Anchor is
1145 * used to translate the object, not both. Anchor takes
1146 * presidence, if it is set HandleBar is ignored.
1147 * The footprint is different from the 2D scale so the compiler can destinguish the two.
1148 * \param px Value of the percentage of scale in x-axis
1149 * \param py Value of the percentage of scale in y-axis
1150 * \param pz Value of the percentage of scale in z-axis
1151 * \param anchor Anchor from which to scale object relative to
1152 * \param handleBar Vertex that is being dragged
1153 */
1154 virtual GLS_EXPORT void Scale( float px, float py, float pz, Vertex* anchor, int handleBar = 0 );
1155
1156 /// Set attributes of the object using VarArgs style interface
1157 /// Object attributes are defined with an enumeration. This
1158 /// routine is designed to make generated code very clean and readable.
1159 /// \sa GLS_Initializers
1160 /// \param spec The enum for the first attribute value to set.
1161 GLS_EXPORT void Set( int spec, ... );
1162
1163 /// Sets the alpha blending state based on object settings.
1164 /// \return True if the state changed from defaults, otherwise false.
1165 /// \sa RestoreAlpha
1166 GLS_EXPORT bool SetupAlpha();
1167
1168#ifndef GLES
1169 /// Sets the antialias settings based on object settings.
1170 /// \return True if the state changed from defaults, otherwise false.
1171 /// \sa RestoreAntiAlias
1172 GLS_EXPORT bool SetupAntiAlias();
1173#endif
1174
1175 /** Sets the depth test settings based on object settings */
1176 GLS_EXPORT void SetupDepthTest();
1177
1178 /** Sets the lighting state
1179 * \sa RestoreLighting
1180 */
1181 GLS_EXPORT void SetupLighting();
1182
1183 /** Sets the line style settings based on object settings
1184 * \return True if the line style was set. If this method returns true
1185 * then the object must call RestoreLineStyle to cleanup
1186 * \sa RestoreLineStyle
1187 */
1188 GLS_EXPORT bool SetupLineStyle();
1189
1190#if !defined( GLES )
1191 /** Sets the polygon draw style based on object settings */
1192 GLS_EXPORT void SetupPolyDrawStyle();
1193
1194 /** Sets the shading settings based on object settings */
1195 GLS_EXPORT void SetupShading();
1196#endif
1197
1198 /** First half of texture setup for the object.
1199 * \return True if the object will be textured False otherwise.
1200 * If this method returns true, then the caller needs to do
1201 * a glDisable(GL_TEXTURE_2D) afterwards to cleanup
1202 */
1203 GLS_EXPORT bool SetupTexture();
1204
1205 /** Gets the polygon shading mode (Flat or gouraud) for the polygon
1206 * \return Enumeration indicating shading mode
1207 * \sa ShadingType_e
1208 */
1209 virtual GLS_EXPORT int Shading();
1210
1211 /** Sets the polygon shading mode (Flat or gouraud) for the polygon
1212 * \param shading Enumeration indicating shading mode
1213 * \sa ShadingType_e
1214 */
1215 virtual GLS_EXPORT void Shading( const int shading );
1216
1217 /** Determines the static extents of the geometry projected to the XY plane of an arbirary coordinate system.
1218 * \param min Returns the minimum values found in the traversal
1219 * \param max Returns the maximum values found in the traversal
1220 * \param matrix Transformation matrix from logical coordinates to the coordinate system to determine the extents in.
1221 * \param resetMinMax Normally not specified by user. Should be true for the initial call.
1222 */
1223 virtual GLS_EXPORT void GetTransformedExtents( Vector& min, Vector& max, const GlsMatrixType& matrix, bool resetMinMax = true );
1224
1225 /** Sets the texture coordinate data for this object
1226 * \param nPoints The number of texture vertices in the object
1227 * \param new_tex_coord The texture coordinates for the object
1228 * \param isVectorArray true if array points to a Vector array, false if it
1229 * points to a Vertex array
1230 * \sa TextureCoordinates()
1231 * \sa VaSetTexCoords()
1232 * \sa SetTexCoords()
1233 */
1234 virtual GLS_EXPORT void SetTexCoords( unsigned int nPoints, Vector* new_tex_coord, bool isVectorArray = true );
1235
1236 /// Vertex version of SetTexCoords
1237 /// \param nPoints The number of texture vertices in the object.
1238 /// \param new_tex_coord The texture coordinates for the object.
1239 /// \sa VaSetTexCoords()
1240 /// \sa TextureCoordinates()
1241 void SetTexCoords( unsigned int nPoints, Vertex* new_tex_coord )
1242 {
1243 SetTexCoords( nPoints, new_tex_coord, false );
1244 }
1245
1246 /** Sets the texture coordinate data for this object
1247 * \param nPoints The number of texture vertices in the object
1248 * \param ... X,Y,Z for each vertex
1249 * \sa TextureCoordinates()
1250 * \sa GetTextureCoordinates()
1251 */
1252 GLS_EXPORT void VaSetTexCoords( unsigned int nPoints, ... );
1253
1254 /** Gets the object's texture coordinates
1255 * \note Texture Coordinates are vertex attributes. They can be two-dimensional
1256 * (UV-coordinates) or three-dimensional (UVW-coordinates). The texture coordinates at each
1257 * vertex are interpolated across the triangle generated from those vertices to determine
1258 * where to sample the texture applied to the object.
1259 * \note Some shaders use UVW coordinates as an input, but use them for some other purpose than texturing.
1260 * \return Pointer to the object's texture coordinate array. NULL if the object is not textured.
1261 * \sa GetTextureCoordinates()
1262 * \sa VaSetTexCoords()
1263 * \sa SetTexCoords()
1264 * \sa GetTexturePoints()
1265 */
1266 Vector* TextureCoordinates() { return _texCoord; }
1267
1268 /** Gets the object's texture coordinates
1269 * \return Pointer to the object's texture coordinate array. NULL if the object is not textured.
1270 * \sa TextureCoordinates()
1271 * \sa GetTexturePoints()
1272 */
1273 Vector* GetTextureCoordinates() { return _texCoord; }
1274
1275 /** Get the texture index for this object
1276 * \return The texture index for this object
1277 */
1278 virtual GLS_EXPORT int TextureIndex();
1279
1280 /** Sets the texture index to be used when drawing the object.
1281 * \param textureIndex The texture index to use.
1282 * -1 indicates that no texture will be drawn.
1283 */
1284 virtual GLS_EXPORT void TextureIndex( int textureIndex );
1285
1286 /** Gets the object's texture points
1287 * \return Pointer to the object's texture point array.
1288 * \note For most DisplayObjects, the Texture Points are used to compute the texture coordinates.
1289 * The TexturePoints are four vertices that describe where the "corners" of the texture is in
1290 * Vertex Coordinates (i.e., the object's parent's logical coordinate space translated to
1291 * the object location). The DisplayObject then uses a projection to compute the texture
1292 * coordinates from these points. The most common is a Planar mapping, but a few objects
1293 * use other mappings (e.g. Spherical or Cylindrical).
1294 * \sa TextureCoordinates()
1295 * \sa GetTextureCoordinates()
1296 */
1297 virtual GLS_EXPORT Vector* GetTexturePoints();
1298
1299 /** Gets the texturing repeat mode for this object
1300 * \return The texture repeat mode for this object
1301 */
1302 virtual GLS_EXPORT bool TextureRepeat();
1303
1304 /** Sets the texturing repeat mode for this object
1305 * \param rep The new texture repeat mode for this object (boolean)
1306 */
1307 virtual GLS_EXPORT void TextureRepeat( const int rep );
1308
1309 /** Gets the texturing mapping mode for this object
1310 * \return The texture mapping mode for this object
1311 * \sa TextureMap_e
1312 */
1313 virtual GLS_EXPORT int TextureMappingTechnique();
1314
1315 /** Sets the texturing mapping mode for this object
1316 * \param map The new texture mapping mode for this object
1317 * \sa TextureMap_e
1318 */
1319 virtual GLS_EXPORT void TextureMappingTechnique( const int map );
1320
1321 /** Gets the texture magnification filter for this object
1322 * \return The texture magnification filter for this object
1323 * \sa TextureFilter_e
1324 */
1325 virtual GLS_EXPORT int TextureMagnificationFilter();
1326
1327 /** Sets the texture magnification filter for this object
1328 * \param filter The new texture magnification filter for this object
1329 * \sa TextureFilter_e
1330 */
1331 virtual GLS_EXPORT void TextureMagnificationFilter( const int filter );
1332
1333 /** Gets the texture minification filter for this object
1334 * \return The texture minification filter for this object
1335 * \sa TextureFilter_e
1336 */
1337 virtual GLS_EXPORT int TextureMinificationFilter();
1338
1339 /** Sets the texture minification filter for this object
1340 * \param filter The new texture minification filter for this object
1341 * \sa TextureFilter_e
1342 */
1343 virtual GLS_EXPORT void TextureMinificationFilter( const int filter );
1344
1345 /** Moves the object by the amount indicated.
1346 * \param tr Float[3] array containing the x,y,z amounts to translate by
1347 */
1348 virtual GLS_EXPORT void Translate( float tr[] );
1349
1350 /** Moves the object by the amount indicated.
1351 * \param x X amount to translate by
1352 * \param y Y amount to translate by
1353 * \param z Z amount to translate by
1354 */
1355 virtual GLS_EXPORT void Translate( float x, float y, float z );
1356
1357 /** Moves the object's vertices by the amount indicated. Does not change _location.
1358 * \param x X amount to translate by
1359 * \param y Y amount to translate by
1360 * \param z Z amount to translate by
1361 */
1362 virtual GLS_EXPORT void TranslateVertices( float x, float y, float z );
1363
1364 /** Updates the bounding volume of this object
1365 * This method should be called if the vertices change for picking and
1366 * culling to work correctly.
1367 * This will only update this object. If PerformGroupCullCheck is enabled
1368 * for one of the objects parents, you may also need to call
1369 * CalculateParentBoundingBox() to update all of the objects parents.
1370 */
1371 virtual void GLS_EXPORT UpdateBoundingVolume();
1372
1373 /** Gets the current UserData pointer. UserData is a pointer the user can
1374 * use to attach user defined data to a GL Studio object.
1375 * \return The current UserData pointer
1376 */
1377 void* UserData() const { return _userData; }
1378
1379 /** Sets the current UserData pointer
1380 * \param data The new UserData pointer
1381 */
1382 void UserData( void* data ) { _userData = data; }
1383
1384 /** Changes the color of a vertex
1385 * \param vertex 1 based index of the vertex to the change color for
1386 * \param CurrentFillColor The new RGBA (0-255 range) color for the vertex
1387 */
1388 virtual GLS_EXPORT void SetVertexColor( unsigned int vertex, unsigned char CurrentFillColor[] );
1389
1390 /** Gets the object's vertices.
1391 * You should call UpdateBoundingVolume after changing an object's extents.
1392 * \sa UpdateBoundingVolume
1393 * \return Pointer to the object's vertex array
1394 */
1395 virtual Vertex* Vertices() { return _vertices; }
1396
1397 /** Sets the vertex data for this polygon
1398 * You should call UpdateBoundingVolume after changing an object's extents.
1399 * \sa UpdateBoundingVolume
1400 * \param nPoints The number of vertices in the object
1401 * \param vertices The vertex data for the object
1402 */
1403 virtual GLS_EXPORT void SetVertices( unsigned int nPoints, Vertex* vertices );
1404
1405 /** Sets the vertex data for this object
1406 * You should call UpdateBoundingVolume after changing an object's extents.
1407 * \sa UpdateBoundingVolume
1408 * \param nPoints The number of vertices in the object
1409 * \param ... r,g,b,a,x,y,z for each vertex
1410 */
1411 GLS_EXPORT void VaSetVertices( unsigned int nPoints, ... );
1412
1413 protected:
1414 /** Sets the vertex data for this object
1415 * You should call UpdateBoundingVolume after changing an object's extents.
1416 * \sa UpdateBoundingVolume
1417 * \param nPoints The number of vertices in the object
1418 * \param args va_list in the form r,g,b,a,x,y,z for each vertex
1419 */
1420 virtual GLS_EXPORT void VaListSetVertices( unsigned int nPoints, va_list args );
1421
1422 /** Sets the normal data for this object
1423 * This function is called as part of VaSetNormals( unsigned int, ... )
1424 * \param nPoints The number of normals in the object
1425 * \param args va_list in the form x,y,z for each normal
1426 */
1427 virtual GLS_EXPORT void VaListSetNormals( unsigned int nPoints, va_list args );
1428
1429 /** Sets the texture coordinate data for this object
1430 * This function is called as part of VaTexCoords( unsigned int, ... )
1431 * \param nPoints The number of texture coordinates in the object
1432 * \param args va_list in the form x,y,z for each texture coordinate
1433 */
1434 virtual GLS_EXPORT void VaListSetTexCoords( unsigned int nPoints, va_list args );
1435
1436 public:
1437 /** \return The saved View matrix, if any. Normally not used by the user.*/
1438 GLS_EXPORT int* ViewMatrix();
1439
1440 /** Get the visibility state this object
1441 * \return Whether or not this object is enabled for drawing
1442 */
1443 inline bool Visible() const { return _visible; }
1444
1445 /** Get the visibility state this object
1446 * \return Whether or not this object is enabled for drawing
1447 */
1448 inline bool Visibility() const { return _visible; }
1449
1450 /** Set the visiblity state for this object
1451 * \param vis Whether or not enable this object for drawing
1452 */
1453 virtual GLS_EXPORT void Visibility( const bool vis );
1454
1455 /** Gets the rotation point for the object in world coordinates
1456 * \return The rotation point for the object in world coordinates
1457 */
1458 virtual GLS_EXPORT Vector WorldRotationPoint();
1459
1460 /** Sets the rotation point for the object in world coordinates
1461 * \param vert The rotation point for the object in world coordinates
1462 */
1463 virtual GLS_EXPORT void WorldRotationPoint( const Vector& vert );
1464
1465 /** Gets a vertex from the object, in World coordinates (i.e. not relative to the location
1466 * as is the case with the Vertices() API call).
1467 * \param i Index of the vertex to get
1468 * \return The vertex
1469 */
1470 virtual GLS_EXPORT Vertex WorldVertex( unsigned int i );
1471
1472 /** Sets a vertex of the object, in World coordinates (i.e. not relative to the location
1473 * as is the case with the Vertices() API call. )
1474 * \param i The 0 based index of the vertex to get
1475 * \param vert The new vertex value
1476 */
1477 virtual GLS_EXPORT void WorldVertex( unsigned int i, const Vertex& vert );
1478
1479 /// Convert a point from logical coordinates to window coordinates.
1480 /// \param logical The point in logical coordinates.
1481 /// \param winLoc The returned value in window coordinates. Z Ranges from 0.0 to 1.0. 0.0 is near clip, 1.0 is far clip.
1482 /// \param alternateMatrices When supplied it is used instead of self determined matrices.
1483 /// \return True if the conversion succeeded, otherwise false.
1484 GLS_EXPORT bool LogicalToWindow( const Vector& logical,
1485 Vector& winLoc, /* .z is 0.0 -> 1.0 */
1486 const OpenGLMatrices& alternateMatrices = OpenGLMatrices() );
1487
1488 /// Convert a point in window coordinates to logical coordinates.
1489 /// \param winLoc Coordinate in window coordinates. X and Y are in pixels. Z Ranges from 0.0 to 1.0. 0.0 is near clip, 1.0 is far clip.
1490 /// \param logical Coordinate in logical coordinates (returned).
1491 /// \param directionVector Normal into the screen at the point (returned).
1492 /// \param alternateMatrices A Set of matrices that if supplied, will alter the point.
1493 /// \return True if the conversion succeeded, otherwise false.
1494 GLS_EXPORT bool WindowToLogical(
1495 const Vector& winLoc,
1496 Vector& logical, /* returned */
1497 Vector* directionVector = NULL, /* returned if not NULL */
1498 const OpenGLMatrices& alternateMatrices = OpenGLMatrices() );
1499
1500 /** PROJECT a point from logical coordinates to the object's DCS's XY plane
1501 * \param logicalPoint The original point in logical coordinates
1502 * \param objectLocal The returned point in the objects DCS coordinate system on the XY plane.
1503 * \param directionVector The direction vector to use when projecting the point. If NULL, the point will be converted but not projected.
1504 * \param planeNormal
1505 * \param planePoint
1506 * \param dcsMatrix An alternate DCS matrix to convert to.
1507 */
1508 GLS_EXPORT void LogicalToDCS(
1509 Vector logicalPoint,
1510 Vector& objectLocal, /* returned */
1511 const Vector* directionVector,
1512 const Vector& planeNormal = Vector( 0, 0, 1 ), /* X/Y plane */
1513 const Vector& planePoint = Vector(),
1514 const GlsMatrixType* dcsMatrix = NULL );
1515
1516 /** Transform a point from the object's DCS coordinate system to the logical coordinate system.
1517 * \param dcsPoint The original point in dcs coordinates
1518 * \param logicalPoint The returned point in the objects DCS coordinate system on the XY plane.
1519 * \param dcsMatrix An alternate DCS matrix to convert from.
1520 */
1521 GLS_EXPORT void DCSToLogical(
1522 Vector dcsPoint,
1523 Vector& logicalPoint, /* returned */
1524 const GlsMatrixType* dcsMatrix = NULL );
1525
1526#ifdef GLES
1527 /// Create a new DisplayObject, reading the properties in order from the GLO file.
1528 /// \param dataStream The GLO data stream we are getting our properties from.
1529 /// \param parent The Group that will be this object's parent.
1530 /// \return True on success.
1531 GLS_EXPORT bool Create( GlsGloFile& dataStream, Group* parent );
1532
1533 /// Invalidates the painter and refreshes the geometry on the next paint cycle.
1534 GLS_EXPORT void GeometryRefresh();
1535#endif
1536
1537 protected:
1538#ifdef GLES
1539 bool _geometryRefresh; ///< Whether or not the geometry (VBOs etc.) needs to be updated on the GPU.
1540
1541 /// Updates the state manager's texture minification and magnification filter based on this display's configuration.
1542 GLS_EXPORT void ApplyTextureMinMagSettings();
1543
1544 /// Updates the state manager's texture environment based on this object configuration.
1545 GLS_EXPORT void ApplyTextureEnvModeSettings();
1546
1547 /// \return True if this object has a texture associated with it.
1548 GLS_EXPORT bool SetupTextureIsNeeded();
1549
1550#endif
1551
1552 int _alphaMode; /**< Whether or not to perform alpha testing while drawing. */
1553
1554 bool _antiAlias; /**< Whether or not to perform anti-aliasing while drawing. */
1555
1556 bool _attributesAdded; /**< True if SetAvailableAttributes has been called. Users should not change this. */
1557
1558 bool _blinking; /**< Whether or not the blinking mode is turned on */
1559
1560 float _blinkRate; /**< Number of times per second the object will blink */
1561
1562 bool _isBlinkedOff; ///< Stores whether the object is presently blinked on or off.
1563
1564 GlsColor _color; /**< The RGBA color for drawing the outline of the object. */
1565
1566 bool _cullBackFace; /**< Whether or not to remove backfaces */
1567
1568 GlsMatrixType _dcsMatrix; /**< The dynamic coordinate system. The Dynamic changes to rotation, scale, and translate will
1569 * be modified by this and applied to the _drawMatrix. */
1570
1571 unsigned char _depthTest; /**< What kind of depth testing while drawing. See DepthBuffer_e*/
1572
1573 GlsMatrixType* _drawMatrix; /**< The objects current contribution to the draw matrix.
1574 * This will be multiplied by the current matrix at draw time.
1575 * If NULL, this object has no contribution (it is not dynamic)
1576 * See CalcDrawMatrix() for more */
1577
1578 bool _needCalcDrawMatrix; ///< True if CalcDrawMatrix() needs to be called on this object.
1579
1580 unsigned char _lineStippleMultiplier; /**< The multiplier used when applying a line stipple pattern to a line. */
1581
1582 unsigned short _lineStipplePattern; /**< A bit pattern indicating which pixels in a line should be drawn and which pixels should not. */
1583
1584 float _lineWidth; /**< The current width of lines rendered in the object, in logical units */
1585
1586 Vertex _location; /**< The location of the origin point for this object, in the world coordinate system. */
1587
1588 DynamicArray<int> _materialIndices; ///< List of materials associated with this object.
1589
1590 GlsMatrixType* _modelMatrix; /**< Stores the Model matrix for this object, if needed. Used by Draw() and 3D picking. */
1591
1592 Vector* _normals; /**< The array of vertex normals for this object.
1593 * The size of this array is based on _nVertices */
1594
1595 unsigned int _nTex_vertices; /**< The number of Texture Coordinate Vertices in this object */
1596
1597 unsigned int _nVertices; /**< The number of vertices in this object */
1598
1599 unsigned char _polygonEnd; /**< Whether or not this is a CLOSED or OPEN polygon */
1600
1601 unsigned char _polygonMode; /**< The mode for drawing the object. */
1602
1603 GlsMatrixType* _projMatrix; /**< Stores the Projection matrix for this object, if needed. Used by Draw() and 3D picking. */
1604
1605 unsigned char _shading; /**< The shading mode for this object */
1606
1607 Vector* _texCoord; /**< The array of texture coordinates for this object. If an object is untextured,
1608 * this value is NULL. The size of this array is based on _nTex_vertices */
1609
1610 GlsColor _textureBlendColor; /**< The current texture blend color (used if TextureMapMode is TEXTURE_MAP_BLEND mode only) */
1611
1612 int _textureIndex; /**< The index into the texture palette array of the texture used to
1613 * to texture this object. A texture index of -1 indicates that no
1614 * texture is assigned to the object. */
1615
1616 unsigned char _textureMagFilter; /**< The current texturing magnification filter mode for the object */
1617
1618 unsigned char _textureMinFilter; /**< The current texturing minification filter mode for the object */
1619
1620 unsigned char _textureMap; /**< The current texturing map mode for the object. */
1621
1622 Vector _texturePoints[ NUM_TEXTURE_POINTS ]; /**< Used to store the relative placement and rotation of a texture on
1623 * the object. Texture coordinates are calculated from the texture points.
1624 * The _texturePoints are relative to the _location, which makes
1625 * them in the objects coordinate system.
1626 */
1627
1628 unsigned char _textureRepeat; /**< The current texturing repeat mode for the object. */
1629
1630 void* _userData; /**< Data pointer for the user to assign as needed */
1631
1632 Vertex* _vertices; /**< The array of vertices for this object. The vertices are in the object's
1633 * coordinate system. That is, they are relative to the _location field.
1634 * This array always has a size based on _nVertices */
1635
1636 int* _viewMatrix; /**< Stores the View matrix for this object, if needed. Used by Draw() and 3D picking. */
1637
1638 bool _visible; /**< Whether or not the object is enabled for drawing */
1639
1640 /// \return The color material mode value of the material applied to this object, else 0.
1641 virtual GLS_EXPORT int ColorMaterialMode();
1642
1643 /** Allocate the model matrix, if needed */
1644 GLS_EXPORT void AllocateModelMatrix();
1645
1646 /** Applies dynamic rotation to object, saving the matrix stack
1647 * so that dynamic picking can occur
1648 * \return True if a rotation was performed. False otherwise.
1649 * If this method returns true, then the caller needs to do
1650 * a glPopMatrix to restore the stack after drawing
1651 */
1652 GLS_EXPORT bool ApplyDynamicRotation();
1653
1654 /** Creates and recalculates the _drawMatrix
1655 * If _rotation, _dynamicScale, or _dynamicTranslate change you must call CalcDrawMatrix()
1656 * If _dcsMatrix, _location, or _rotationPoint change you need to call CalcDrawMatrixIfExists()
1657 * These are normally called automatically for you by the API Methods that affect those values.
1658 * Sub-classes may override CalcDrawMatrix() to include additional transformations in the _drawMatrix.
1659 */
1660 virtual GLS_EXPORT void CalcDrawMatrix();
1661
1662 /** Recalculates the _drawMatrix if it exists.
1663 * See CalcDrawMatrix() for more info. */
1664 inline void CalcDrawMatrixIfExists()
1665 {
1666 if( _drawMatrix )
1667 {
1668 CalcDrawMatrix();
1669 }
1670 }
1671
1672 /** Applies the _drawMatrix to the modelMatrix.
1673 * If necessary derived classes can save other matrices.
1674 * \param newMatrices A set of matrices passed down to this object from its parent.
1675 */
1676 virtual GLS_EXPORT void CalculateMatrices( const OpenGLMatrices& newMatrices );
1677
1678 /// \param x X coordinate of pick point.
1679 /// \param y Y coordinate of pick point.
1680 /// \param nVerts Number of vertices to try.
1681 /// \param verts Vertex array to try.
1682 /// \param tolerance Picking tolerance.
1683 /// \return True if the point is inside the 2D extents of the given vertices.
1684 GLS_EXPORT bool InsideVertexExtents( float x, float y, unsigned int nVerts, Vertex* verts, float tolerance );
1685
1686 /// Used internally to determine if the user has modified the location.
1687 /// \param loc The location to set.
1688 inline void LastDrawMatrixLocation( const Vertex& loc ) { _lastDrawMatrixLocation = loc; }
1689
1690 /// Used internally to determine if the user has modified the location.
1691 /// \return The location where the object was last drawn.
1692 inline const Vertex& LastDrawMatrixLocation() { return _lastDrawMatrixLocation; }
1693
1694 /// Set whether or not Calculate() will be called on this object.
1695 /// \param val The new calculate value.
1696 inline void NeedCalculate( bool val ) { _needCalculate = val; }
1697
1698 /** Sets up the object for picking by dynamically rotating vertices
1699 * \param x X coordinate of pick point
1700 * \param y Y coordinate of pick point
1701 * \param z Z coordinate of pick point
1702 * \param vertices Vertex array to setup
1703 * \param vertex_cnt Number of vertices to setup
1704 * \param directionVector dynamic rotation vector
1705 */
1706 GLS_EXPORT void PickSetup( float x, float y, float z, Vertex* vertices, unsigned int vertex_cnt, const Vector& directionVector );
1707
1708 /** Restores the temporarily rotated vertices
1709 * \param vertices Vertex array to restore
1710 * \param vertex_cnt Number of vertices to restore
1711 */
1712 GLS_EXPORT void PickCleanup( Vertex* vertices, unsigned int vertex_cnt );
1713
1714#ifdef GLES
1715 /** Set a single attribute from the GLO file.
1716 * \param data The attribute to set and its associated data.
1717 */
1718 virtual GLS_EXPORT void SetFromGloData( GlsGloFileAttribute& data );
1719#endif
1720
1721 /** Finds three coplanar points and the surface normal, if possible. This calculation is performed using the
1722 * Vertices() of this object. Used in the editor to determine how to map a texture onto an object.
1723 * \param p1 Returns a point on the plane
1724 * \param p2 Returns a point on the plane
1725 * \param p3 Returns a point on the plane
1726 * \param planeVector Returns the surface normal of the plane
1727 * \return True if 3 coplanar points were found
1728 */
1729 public:
1730 virtual GLS_EXPORT bool GetPlaneVectorPoints( Vertex& p1, Vertex& p2, Vertex& p3, Vertex& planeVector );
1731
1732 /** Implements AttributeChangedNotifier::NotifyAttributeChanged.
1733 * Notify the class that the attribute has changed. Observers of the attribute will have their callbacks called
1734 * \param name the name of the attribute
1735 */
1736 GLS_EXPORT void NotifyAttributeChanged( const AttributeName& name ) DISTI_METHOD_OVERRIDE;
1737
1738 /** Sets the painter for this object. Can be NULL. If the painter is set, this object will call Invalidate() on the painter anytime it changes
1739 * in a way that affects its rendering.
1740 * \note This object only observers the painter, and does not delete it.
1741 * \param painter the painter that is drawing this class.
1742 */
1743 virtual GLS_EXPORT void SetPainter( GlsPainter* painter );
1744
1745 /// \return The painter for this object, or NULL if none. This is an observer pointer and should not be deleted.
1746 GLS_EXPORT virtual GlsPainter* GetPainter();
1747
1748 /** Invalidates the painter set on this object if that painter exists.
1749 * Typically called by user code when it modifies an object in such a
1750 * way where the painter invalidation system wouldn't work automatically
1751 * (for example, directly modifying vertex data).
1752 */
1753 GLS_EXPORT void InvalidatePainter();
1754
1755 /// Traverses upward in the hierarchy to determine if this object is visible in the scene.
1756 /// Overloaded for classes that handle child visibility without using the Visibility flag such as GlsMutexGroup.
1757 /// \param obj The object to start traversing from, defaults to this object if NULL.
1758 /// \return Whether or not the object is visible.
1759 GLS_EXPORT virtual bool IsVisibleInScene( const DisplayObject* obj = NULL ) const;
1760
1761 protected:
1762 /** Sets an attribute of this object using variable arguments
1763 * \param spec A GLS_Initializer tag
1764 * \param args A variable argument list
1765 */
1766 GLS_EXPORT virtual void SetValue( int spec, va_list& args );
1767
1768 private:
1769 void CopyGeometryInternal( const DisplayObject* src );
1770 void CopyPropertiesInternal( const DisplayObject* src );
1771 void CopyHierarchyPropertiesInternal( const DisplayObject* src, bool copyName );
1772
1773 DistiAttribDict* _attribDict; /**< Stores all of this object's metadata attributes */
1774
1775 Vector _boundingVolumeCenter; /**< Center of the bounding volume (relative to Location())*/
1776
1777 float _boundingVolumeRadius; /**< Radius of the bounding sphere */
1778
1779 CallbackMethodCallerBase* _callbackCaller; /**< The pointer to the callback caller for this object.
1780 * This is currently unrelated to the InputDevice callback */
1781
1782 bool _culled; /**< Whether or not this object is currently culled */
1783
1784 float _dynamicTranslate[ 3 ]; /* The current (dynamic) translation of the object, in logical units and relative to the object's DCS.
1785 * _dynamicTranslate[0] = x traslation
1786 * _dynamicTranslate[1] = y traslation
1787 * _dynamicTranslate[2] = z traslation */
1788
1789 float _dynamicScale[ 3 ]; /* The current (dynamic) scale of the object */
1790
1791 EditorObjectBase* _editorObject; /* Used in the editor to access editor functionality */
1792
1793 char* _instanceName; /**< A unique character string used to identify the object. This name
1794 * will correspond to the name of the C++ member variable generated for
1795 * this object in the output code. */
1796
1797 Vertex _lastDrawMatrixLocation; /**< The value of _location the last time CalcDrawMatrix() was called */
1798
1799 bool _lightingEnabled; /**< Stores the lighting enabled state */
1800
1801 bool _needCalculate; /* true if Calculate() needs be called on this object.
1802 * Defaults to true.
1803 * Calculate() may still be called in some situations */
1804
1805 DisplayFrame* _parent; /**< The display frame or component that contains this object */
1806
1807 Group* _parentGroup; /**< The group of which this object is a member */
1808
1809 GlsPainter* _painter; /** The painter, can be NULL, used for conditional rendering */
1810
1811 unsigned char _pickable; /**< The type of picking that is enabled for this object */
1812
1813 float _rotation[ 3 ]; /* The current (dynamic) rotation of the object, in degrees and relative to
1814 * the object's rotation point. Order of rotation is x, then y, then z
1815 * _rotation[0] = x rotation angle
1816 * _rotation[1] = y rotation angle
1817 * _rotation[2] = z rotation angle */
1818
1819 Vertex _rotationPoint; /* The location, in the object coordinate system, of the point to rotate
1820 * this object around when the object is dynamically rotated.
1821 * So when we want to rotate this object (not just rotate the view), this
1822 * is the point to rotate about. This point is relative to the _location,
1823 * which makes in in the objects coordinate system. */
1824
1825 GLS_EXPORT void DisplayColorMaterialModeError( const int mode );
1826 GLS_EXPORT int DisplayColorMaterialModeError();
1827
1828 void CommonConstructorInit( float x, float y, float z );
1829
1830 /** Callback for when DCS Matrix changes through the resource API */
1831 void OnDCSMatrixChanged();
1832
1833 /** Callback for when Vertices change through the resource API */
1834 void OnVerticesChanged();
1835
1836 /** Callback for when Texture coordinates change through the resource API */
1837 void OnTextureCoordsChanged();
1838
1839 /** Assignment operator not implemented. Use CloneObject() or the copy constructor instead. */
1840 DisplayObject& operator=( const DisplayObject& that ); // = delete
1841
1842 protected:
1843 /// \returns _textureIndex if not -1, otherwise returns the group texture index.
1844 GLS_EXPORT int GetApplicableTextureIndex();
1845
1846 /// \return _textureRepeat if _textureIndex is not -1, otherwise returns the group texture repeat setting.
1847 GLS_EXPORT int GetApplicableTextureRepeat();
1848
1849#ifdef GLES
1850 IGlsStateManager* _stateManager; ///< The state manager that interfaces with OpenGL and maintains its render state.
1851#endif
1852
1853#ifdef GLES20
1854 IGlsStateManagerES20* _stateManagerES20; ///< The state manager that interfaces with OpenGL ES 2.0 and maintains its render state.
1855#endif
1856};
1857
1858} // namespace disti
1859
1860#endif
disti::AttributeChangedNotifier
Definition: disti_metadata.h:521
disti::AttributeName
Definition: disti_metadata.h:87
disti::CallbackMethodCallerBase
Definition: callback_caller_base.h:56
disti::Culler
Definition: cull.h:50
disti::Culler::SphereOutsideFrustum
bool SphereOutsideFrustum(const Vector &center, const float radius) const
Definition: cull.h:98
disti::DisplayEvent
Definition: events.h:113
disti::DisplayFrame
Definition: display_frame.h:87
disti::DisplayObject
Definition: display.h:96
disti::DisplayObject::DynamicRotate
virtual void DynamicRotate(float x, float y, float z)
disti::DisplayObject::_projMatrix
GlsMatrixType * _projMatrix
Definition: display.h:1603
disti::DisplayObject::GeometryRefresh
void GeometryRefresh()
Invalidates the painter and refreshes the geometry on the next paint cycle.
disti::DisplayObject::WindowToLogical
bool WindowToLogical(const Vector &winLoc, Vector &logical, Vector *directionVector=NULL, const OpenGLMatrices &alternateMatrices=OpenGLMatrices())
disti::DisplayObject::Editor
const DisplayObjectEditor * Editor() const
disti::DisplayObject::CullTest
bool CullTest(const GlsMatrixType *matrix, const Culler &culler)
Definition: display.h:432
disti::DisplayObject::RotationPoint
virtual void RotationPoint(const Vertex &v)
disti::DisplayObject::AlphaMode
virtual int AlphaMode()
disti::DisplayObject::ObjectDepth
virtual float ObjectDepth()
disti::DisplayObject::GetFillColor
void GetFillColor(unsigned char &r, unsigned char &g, unsigned char &b, unsigned char &a)
disti::DisplayObject::_polygonMode
unsigned char _polygonMode
Definition: display.h:1601
disti::DisplayObject::SetupTexture
bool SetupTexture()
disti::DisplayObject::LightingEnabled
virtual void LightingEnabled(bool lighting)
disti::DisplayObject::CalculateParentBoundingBox
virtual void CalculateParentBoundingBox()
disti::DisplayObject::Attributes
const DistiAttribDict & Attributes() const
Definition: display.h:182
disti::DisplayObject::InstanceName
void InstanceName(const char *name)
disti::DisplayObject::DisplayObject
DisplayObject(float x, float y, float z)
disti::DisplayObject::CallbackCaller
void CallbackCaller(CallbackMethodCallerBase *cb)
disti::DisplayObject::SetBlendColor
void SetBlendColor(unsigned char color[])
disti::DisplayObject::_isBlinkedOff
bool _isBlinkedOff
Stores whether the object is presently blinked on or off.
Definition: display.h:1562
disti::DisplayObject::GetLocation
virtual void GetLocation(Vertex &v)
disti::DisplayObject::SetNormals
virtual void SetNormals(unsigned int nPoints, Vector *vertices)
disti::DisplayObject::PolygonMode
virtual int PolygonMode()
disti::DisplayObject::AllocateModelMatrix
void AllocateModelMatrix()
disti::DisplayObject::GetTransformedExtents
virtual void GetTransformedExtents(Vector &min, Vector &max, const GlsMatrixType &matrix, bool resetMinMax=true)
disti::DisplayObject::Shading
virtual int Shading()
disti::DisplayObject::TextureCoordinates
Vector * TextureCoordinates()
Definition: display.h:1266
disti::DisplayObject::SetupLighting
void SetupLighting()
disti::DisplayObject::MaterialIndices
virtual void MaterialIndices(DynamicArray< int > indices)
disti::DisplayObject::DynamicScale
virtual Vector DynamicScale()
disti::DisplayObject::LineWidth
virtual float LineWidth()
disti::DisplayObject::ApplyTextureEnvModeSettings
void ApplyTextureEnvModeSettings()
Updates the state manager's texture environment based on this object configuration.
disti::DisplayObject::HitUtil
virtual bool HitUtil(float x, float y, float z, float scale, Vertex *vertices, unsigned int vertex_cnt, const Vector &directionVector, Vector *collisionPoint)
disti::DisplayObject::GetTexturePointTransformationMatrix
bool GetTexturePointTransformationMatrix(GlsMatrixType &world2tex)
disti::DisplayObject::Set
void Set(int spec,...)
disti::DisplayObject::DynamicScale
void DynamicScale(const Vector &scale)
disti::DisplayObject::DcsMatrix
void DcsMatrix(const GlsMatrixType &matrix)
disti::DisplayObject::ViewMatrix
int * ViewMatrix()
disti::DisplayObject::_color
GlsColor _color
Definition: display.h:1564
disti::DisplayObject::TextureMagnificationFilter
virtual void TextureMagnificationFilter(const int filter)
disti::DisplayObject::_viewMatrix
int * _viewMatrix
Definition: display.h:1636
disti::DisplayObject::MaterialIndex
virtual void MaterialIndex(int index)
disti::DisplayObject::UserData
void UserData(void *data)
Definition: display.h:1382
disti::DisplayObject::RelativeAngle
virtual float RelativeAngle(const float x, const float y)
disti::DisplayObject::AntiAlias
virtual bool AntiAlias()
disti::DisplayObject::CopyGeometry
virtual void CopyGeometry(DisplayObject *src)
disti::DisplayObject::DrawMatrix
const GlsMatrixType * DrawMatrix()
Definition: display.h:511
disti::DisplayObject::Calculate
virtual void Calculate(double time)
disti::DisplayObject::_texCoord
Vector * _texCoord
Definition: display.h:1607
disti::DisplayObject::_dcsMatrix
GlsMatrixType _dcsMatrix
Definition: display.h:1568
disti::DisplayObject::Rotate
virtual void Rotate(const Vector &origin, float angle, int axis=Z_AXIS)
disti::DisplayObject::CalculateTextureCoordinates
virtual void CalculateTextureCoordinates()
disti::DisplayObject::GetExtentsDCS
void GetExtentsDCS(Vector &min, Vector &max)
disti::DisplayObject::TextureMinificationFilter
virtual void TextureMinificationFilter(const int filter)
disti::DisplayObject::GetPainter
virtual GlsPainter * GetPainter()
disti::DisplayObject::DynamicTranslateAxis
virtual void DynamicTranslateAxis(float amount, int axis, bool relative)
disti::DisplayObject::UpdateBoundingVolume
virtual void UpdateBoundingVolume()
disti::DisplayObject::MaterialIndex
virtual int MaterialIndex()
disti::DisplayObject::_vertices
Vertex * _vertices
Definition: display.h:1632
disti::DisplayObject::DCSToLogical
void DCSToLogical(Vector dcsPoint, Vector &logicalPoint, const GlsMatrixType *dcsMatrix=NULL)
disti::DisplayObject::Blinking
virtual void Blinking(const bool blink)
disti::DisplayObject::WorldVertex
virtual Vertex WorldVertex(unsigned int i)
disti::DisplayObject::VaListSetNormals
virtual void VaListSetNormals(unsigned int nPoints, va_list args)
disti::DisplayObject::_geometryRefresh
bool _geometryRefresh
Whether or not the geometry (VBOs etc.) needs to be updated on the GPU.
Definition: display.h:1539
disti::DisplayObject::SetBlendColor
virtual void SetBlendColor(const GlsColor &color)
disti::DisplayObject::_materialIndices
DynamicArray< int > _materialIndices
List of materials associated with this object.
Definition: display.h:1588
disti::DisplayObject::ReallocateVertices
virtual void ReallocateVertices(unsigned int numVertices, bool initializeNew, bool copyOld)
disti::DisplayObject::CallbackCaller
CallbackMethodCallerBase * CallbackCaller() const
Definition: display.h:313
disti::DisplayObject::DeleteVertex
virtual void DeleteVertex(unsigned int indexAfter) final
Definition: display.h:486
disti::DisplayObject::ApplyDynamicRotation
bool ApplyDynamicRotation()
disti::DisplayObject::CopyHierarchyProperties
virtual void CopyHierarchyProperties(DisplayObject *src, bool copyName)
disti::DisplayObject::AvailableAttributesEnum
AvailableAttributesEnum
Definition: display.h:131
disti::DisplayObject::InstanceName
const char * InstanceName() const
disti::DisplayObject::VaSetVertices
void VaSetVertices(unsigned int nPoints,...)
disti::DisplayObject::LineStippleMultiplier
virtual void LineStippleMultiplier(int mult)
disti::DisplayObject::ColorMaterialMode
virtual int ColorMaterialMode()
disti::DisplayObject::DepthTest
virtual void DepthTest(unsigned char zbuf)
disti::DisplayObject::_attributesAdded
bool _attributesAdded
Definition: display.h:1556
disti::DisplayObject::Parent
virtual void Parent(DisplayFrame *par)
disti::DisplayObject::SaveMatrices
void SaveMatrices()
disti::DisplayObject::VaListSetVertices
virtual void VaListSetVertices(unsigned int nPoints, va_list args)
disti::DisplayObject::TextureMappingTechnique
virtual int TextureMappingTechnique()
disti::DisplayObject::_antiAlias
bool _antiAlias
Definition: display.h:1554
disti::DisplayObject::TextureMinificationFilter
virtual int TextureMinificationFilter()
disti::DisplayObject::DynamicRotate
void DynamicRotate(const Vector &v)
disti::DisplayObject::GetBlendColor
void GetBlendColor(unsigned char &r, unsigned char &g, unsigned char &b, unsigned char &a)
disti::DisplayObject::PreDraw
virtual void PreDraw(const OpenGLMatrices &current, Culler &culler)
disti::DisplayObject::Draw
virtual void Draw()=0
disti::DisplayObject::GetResources
virtual void GetResources(std::ostream &outstr, GlsResourceFilter *filter=NULL)
disti::DisplayObject::NeedCalculate
bool NeedCalculate()
Definition: display.h:887
disti::DisplayObject::DeleteVertexAt
virtual void DeleteVertexAt(unsigned int index)
disti::DisplayObject::InstanceName
char * InstanceName()
disti::DisplayObject::AlphaMode
virtual void AlphaMode(int mode)
disti::DisplayObject::CalcDrawMatrix
virtual void CalcDrawMatrix()
disti::DisplayObject::LineStipplePattern
virtual void LineStipplePattern(int pattern)
disti::DisplayObject::SetAvailableAttributes
virtual void SetAvailableAttributes(unsigned int value)
disti::DisplayObject::Editor
DisplayObjectEditor * Editor()
disti::DisplayObject::LogicalToWindow
bool LogicalToWindow(const Vector &logical, Vector &winLoc, const OpenGLMatrices &alternateMatrices=OpenGLMatrices())
disti::DisplayObject::Pickable
virtual void Pickable(unsigned char pick)
disti::DisplayObject::LastDrawMatrixLocation
const Vertex & LastDrawMatrixLocation()
Definition: display.h:1692
disti::DisplayObject::Pick3D
virtual DisplayObject * Pick3D(const Vector &winLoc, const Vector &logicalCoords, float scale, const Vector &directionVector, Vector &collisionWinLoc, const OpenGLMatrices &drawnMatrices)
disti::DisplayObject::_lineWidth
float _lineWidth
Definition: display.h:1584
disti::DisplayObject::Z
void Z(const float z)
Definition: display.h:867
disti::DisplayObject::~DisplayObject
virtual ~DisplayObject()
disti::DisplayObject::ApplyTextureSettings
void ApplyTextureSettings(int textureIndex=-1)
disti::DisplayObject::NumberOfVertices
unsigned int NumberOfVertices() const
Definition: display.h:909
disti::DisplayObject::DcsMatrix
GlsMatrixType DcsMatrix() const
Definition: display.h:467
disti::DisplayObject::_userData
void * _userData
Definition: display.h:1630
disti::DisplayObject::FinishObject
virtual void FinishObject()
Definition: display.h:706
disti::DisplayObject::_location
Vertex _location
Definition: display.h:1586
disti::DisplayObject::Scale
virtual void Scale(float px, float py, float pz, Vertex *anchor, int handleBar=0)
disti::DisplayObject::SetFillColor
virtual void SetFillColor(const GlsColor &color)
disti::DisplayObject::_textureBlendColor
GlsColor _textureBlendColor
Definition: display.h:1610
disti::DisplayObject::WorldRotationPoint
virtual Vector WorldRotationPoint()
disti::DisplayObject::GetBlendColor
void GetBlendColor(unsigned char color[])
disti::DisplayObject::_needCalcDrawMatrix
bool _needCalcDrawMatrix
True if CalcDrawMatrix() needs to be called on this object.
Definition: display.h:1578
disti::DisplayObject::GetTextureCoordinates
Vector * GetTextureCoordinates()
Definition: display.h:1273
disti::DisplayObject::ModelMatrix
GlsMatrixType * ModelMatrix()
disti::DisplayObject::_normals
Vector * _normals
Definition: display.h:1592
disti::DisplayObject::NeedCalculate
void NeedCalculate(bool val)
Definition: display.h:1696
disti::DisplayObject::UserData
void * UserData() const
Definition: display.h:1377
disti::DisplayObject::WorldVertex
virtual void WorldVertex(unsigned int i, const Vertex &vert)
disti::DisplayObject::BoundingVolumeRadius
void BoundingVolumeRadius(float radius)
disti::DisplayObject::SetupAlpha
bool SetupAlpha()
disti::DisplayObject::SetVertexColor
virtual void SetVertexColor(unsigned int vertex, unsigned char CurrentFillColor[])
disti::DisplayObject::GetColor
virtual GlsColor GetColor()
disti::DisplayObject::Blinking
virtual bool Blinking()
disti::DisplayObject::Pickable
unsigned char Pickable()
Definition: display.h:986
disti::DisplayObject::SetupDepthTest
void SetupDepthTest()
disti::DisplayObject::_stateManager
IGlsStateManager * _stateManager
The state manager that interfaces with OpenGL and maintains its render state.
Definition: display.h:1850
disti::DisplayObject::GetCenter
virtual void GetCenter(Vector &center)
disti::DisplayObject::_nVertices
unsigned int _nVertices
Definition: display.h:1597
disti::DisplayObject::DynamicRotate
void DynamicRotate(float angle, int axis)
disti::DisplayObject::Visibility
bool Visibility() const
Definition: display.h:1448
disti::DisplayObject::BoundingVolumeCenter
void BoundingVolumeCenter(const Vector &center)
disti::DisplayObject::_polygonEnd
unsigned char _polygonEnd
Definition: display.h:1599
disti::DisplayObject::InsertVertex
virtual void InsertVertex(unsigned int indexAfter) final
Definition: display.h:763
disti::DisplayObject::_textureMinFilter
unsigned char _textureMinFilter
Definition: display.h:1618
disti::DisplayObject::DepthTest
virtual int DepthTest()
disti::DisplayObject::PolygonMode
virtual void PolygonMode(int mode)
disti::DisplayObject::Hit
virtual bool Hit(float x, float y, float z, float scale, const Vector &directionVector, Vector *collisionPoint)
disti::DisplayObject::CullBackFace
virtual void CullBackFace(const bool val)
disti::DisplayObject::RotationPoint
const Vertex & RotationPoint() const
Definition: display.h:1092
disti::DisplayObject::ParentGroup
Group * ParentGroup() const
Definition: display.h:955
disti::DisplayObject::DynamicTranslation
virtual Vector DynamicTranslation()
disti::DisplayObject::Z
float Z() const
Definition: display.h:855
disti::DisplayObject::PolygonEnd
virtual void PolygonEnd(const int end)
disti::DisplayObject::SetPainter
virtual void SetPainter(GlsPainter *painter)
disti::DisplayObject::TextureMappingTechnique
virtual void TextureMappingTechnique(const int map)
disti::DisplayObject::DynamicTranslate
virtual void DynamicTranslate(float x, float y, float z, bool relative=false)
disti::DisplayObject::DynamicRotation
virtual Vector DynamicRotation()
disti::DisplayObject::_visible
bool _visible
Definition: display.h:1638
disti::DisplayObject::DynamicRotateRelative
virtual void DynamicRotateRelative(float angle, int axis)
disti::DisplayObject::Translate
virtual void Translate(float tr[])
disti::DisplayObject::_nTex_vertices
unsigned int _nTex_vertices
Definition: display.h:1595
disti::DisplayObject::Y
float Y() const
Definition: display.h:852
disti::DisplayObject::GetLocation
virtual void GetLocation(float &x, float &y, float &z)
disti::DisplayObject::GetFillColor
void GetFillColor(unsigned char c4[])
disti::DisplayObject::SetManualBlinkElapsedTime
static void SetManualBlinkElapsedTime(double elapsedTime)
disti::DisplayObject::Vertices
virtual Vertex * Vertices()
Definition: display.h:1395
disti::DisplayObject::Location
virtual void Location(float x, float y, float z)
disti::DisplayObject::_depthTest
unsigned char _depthTest
Definition: display.h:1571
disti::DisplayObject::LineStipplePattern
virtual int LineStipplePattern()
disti::DisplayObject::GetExtents
virtual void GetExtents(float &x, float &y, float &z, float &x1, float &y1, float &z1)
disti::DisplayObject::Culled
bool Culled() const
Definition: display.h:422
disti::DisplayObject::BlinkedOff
virtual bool BlinkedOff()
disti::DisplayObject::WorldRotationPoint
virtual void WorldRotationPoint(const Vector &vert)
disti::DisplayObject::TextureMagnificationFilter
virtual int TextureMagnificationFilter()
disti::DisplayObject::SetValue
virtual void SetValue(int spec, va_list &args)
disti::DisplayObject::MaterialIndices
virtual DynamicArray< int > & MaterialIndices()
disti::DisplayObject::NotifyAttributeChanged
void NotifyAttributeChanged(const AttributeName &name) override
disti::DisplayObject::GetRotationPoint
virtual void GetRotationPoint(Vertex &v)
disti::DisplayObject::_textureMagFilter
unsigned char _textureMagFilter
Definition: display.h:1616
disti::DisplayObject::_textureMap
unsigned char _textureMap
Definition: display.h:1620
disti::DisplayObject::SetFillColor
void SetFillColor(unsigned char c4[])
Definition: display.h:692
disti::DisplayObject::VaSetTexCoords
void VaSetTexCoords(unsigned int nPoints,...)
disti::DisplayObject::_shading
unsigned char _shading
Definition: display.h:1605
disti::DisplayObject::GetColor
void GetColor(unsigned char &r, unsigned char &g, unsigned char &b, unsigned char &a)
disti::DisplayObject::handle
virtual DisplayObject * handle(DisplayEvent *ev)
disti::DisplayObject::DynamicRotate
void DynamicRotate(float angle[])
disti::DisplayObject::Normals
Vector * Normals()
Definition: display.h:892
disti::DisplayObject::TextureRepeat
virtual void TextureRepeat(const int rep)
disti::DisplayObject::Y
void Y(const float y)
Definition: display.h:863
disti::DisplayObject::VaSetNormals
void VaSetNormals(unsigned int nPoints,...)
disti::DisplayObject::RotationPoint
virtual void RotationPoint(float x, float y, float z)
disti::DisplayObject::LineStippleMultiplier
virtual int LineStippleMultiplier()
disti::DisplayObject::SetTexCoords
void SetTexCoords(unsigned int nPoints, Vertex *new_tex_coord)
Definition: display.h:1241
disti::DisplayObject::GetColor
void GetColor(unsigned char c4[])
disti::DisplayObject::_drawMatrix
GlsMatrixType * _drawMatrix
Definition: display.h:1573
disti::DisplayObject::AntiAlias
virtual void AntiAlias(bool alias)
disti::DisplayObject::NeedCalcDrawMatrix
bool NeedCalcDrawMatrix()
Definition: display.h:515
disti::DisplayObject::X
float X() const
Definition: display.h:849
disti::DisplayObject::PickSetup
void PickSetup(float x, float y, float z, Vertex *vertices, unsigned int vertex_cnt, const Vector &directionVector)
disti::DisplayObject::ProjMatrix
GlsMatrixType * ProjMatrix()
disti::DisplayObject::GetBlendColor
virtual GlsColor GetBlendColor()
disti::DisplayObject::Location
virtual const Vertex & Location() const
disti::DisplayObject::Visibility
virtual void Visibility(const bool vis)
disti::DisplayObject::LightingEnabled
virtual bool LightingEnabled()
disti::DisplayObject::CloneObject
virtual DisplayObject * CloneObject(bool generateNames=false)=0
disti::DisplayObject::DynamicTranslate
void DynamicTranslate(const Vector &amount)
disti::DisplayObject::PolygonEnd
virtual int PolygonEnd()
disti::DisplayObject::SetColor
virtual void SetColor(const GlsColor &color)
disti::DisplayObject::Location
virtual void Location(const Vertex &v)
disti::DisplayObject::DisplayObject
DisplayObject(const DisplayObject &object, const bool generateNames)
disti::DisplayObject::LogicalToDCS
void LogicalToDCS(Vector logicalPoint, Vector &objectLocal, const Vector *directionVector, const Vector &planeNormal=Vector(0, 0, 1), const Vector &planePoint=Vector(), const GlsMatrixType *dcsMatrix=NULL)
disti::DisplayObject::GetPlaneVectorPoints
virtual bool GetPlaneVectorPoints(Vertex &p1, Vertex &p2, Vertex &p3, Vertex &planeVector)
disti::DisplayObject::Visible
bool Visible() const
Definition: display.h:1443
disti::DisplayObject::TextureIndex
virtual int TextureIndex()
disti::DisplayObject::Attributes
DistiAttribDict & Attributes()
Definition: display.h:178
disti::DisplayObject::BlinkRate
virtual float BlinkRate()
disti::DisplayObject::SetupTextureIsNeeded
bool SetupTextureIsNeeded()
disti::DisplayObject::DynamicScale
virtual void DynamicScale(float x, float y, float z)
disti::DisplayObject::DynamicTranslate
void DynamicTranslate(const Vertex &amount, bool relative)
disti::DisplayObject::GetTexturePoints
virtual Vector * GetTexturePoints()
disti::DisplayObject::ObjectWidth
virtual float ObjectWidth()
disti::DisplayObject::Parent
DisplayFrame * Parent() const
Definition: display.h:945
disti::DisplayObject::SetVertices
virtual void SetVertices(unsigned int nPoints, Vertex *vertices)
disti::DisplayObject::Rotate
virtual void Rotate(const Vector &orig, float angle, const Vector &axis)
disti::DisplayObject::Editor
void Editor(DisplayObjectEditor *editor)
disti::DisplayObject::Destroy
void Destroy()
disti::DisplayObject::TextureIndex
virtual void TextureIndex(int textureIndex)
disti::DisplayObject::InsertVertexAt
virtual void InsertVertexAt(unsigned int index)
disti::DisplayObject::TranslateVertices
virtual void TranslateVertices(float x, float y, float z)
disti::DisplayObject::SetOrigin
virtual void SetOrigin(const Vertex &vert)
disti::DisplayObject::GetApplicableTextureRepeat
int GetApplicableTextureRepeat()
disti::DisplayObject::PickCleanup
void PickCleanup(Vertex *vertices, unsigned int vertex_cnt)
disti::DisplayObject::DcsMatrix
GlsMatrixType & DcsMatrix()
Definition: display.h:463
disti::DisplayObject::LineWidth
virtual void LineWidth(float width)
disti::DisplayObject::InvalidatePainter
void InvalidatePainter()
disti::DisplayObject::SetColor
void SetColor(unsigned char c4[])
Definition: display.h:367
disti::DisplayObject::LastDrawMatrixLocation
void LastDrawMatrixLocation(const Vertex &loc)
Definition: display.h:1688
disti::DisplayObject::CalcDrawMatrixIfExists
void CalcDrawMatrixIfExists()
Definition: display.h:1664
disti::DisplayObject::_blinkRate
float _blinkRate
Definition: display.h:1560
disti::DisplayObject::Resource
virtual DistiAttributeBase & Resource(const char *name)
disti::DisplayObject::SetupLineStyle
bool SetupLineStyle()
disti::DisplayObject::CullBackFace
virtual bool CullBackFace()
disti::DisplayObject::TextureRepeat
virtual bool TextureRepeat()
disti::DisplayObject::Create
bool Create(GlsGloFile &dataStream, Group *parent)
disti::DisplayObject::CalculateCollisionPoint
void CalculateCollisionPoint(const Vector &pickLoc, const Vector &directionVector, Vector *collisionPoint)
disti::DisplayObject::ObjectHeight
virtual float ObjectHeight()
disti::DisplayObject::GetApplicableTextureIndex
int GetApplicableTextureIndex()
disti::DisplayObject::BoundingVolumeCenter
const Vector & BoundingVolumeCenter() const
Definition: display.h:260
disti::DisplayObject::UseManualBlinkElapsedTime
static void UseManualBlinkElapsedTime(bool useManualTime)
disti::DisplayObject::SetFillColor
void SetFillColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
Definition: display.h:686
disti::DisplayObject::Translate
virtual void Translate(float x, float y, float z)
disti::DisplayObject::ParentGroup
virtual void ParentGroup(Group *group)
disti::DisplayObject::SetFromGloData
virtual void SetFromGloData(GlsGloFileAttribute &data)
disti::DisplayObject::DynamicTranslation
virtual float DynamicTranslation(int axis)
disti::DisplayObject::VaListSetTexCoords
virtual void VaListSetTexCoords(unsigned int nPoints, va_list args)
disti::DisplayObject::GenerateInstanceName
virtual void GenerateInstanceName()
disti::DisplayObject::Rotate
virtual void Rotate(float angle, int axis=Z_AXIS)
disti::DisplayObject::SetBlendColor
void SetBlendColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
disti::DisplayObject::_blinking
bool _blinking
Definition: display.h:1558
disti::DisplayObject::X
void X(const float x)
Definition: display.h:859
disti::DisplayObject::_lineStippleMultiplier
unsigned char _lineStippleMultiplier
Definition: display.h:1580
disti::DisplayObject::_modelMatrix
GlsMatrixType * _modelMatrix
Definition: display.h:1590
disti::DisplayObject::_texturePoints
Vector _texturePoints[4]
Definition: display.h:1622
disti::DisplayObject::_lineStipplePattern
unsigned short _lineStipplePattern
Definition: display.h:1582
disti::DisplayObject::SetColor
void SetColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
Definition: display.h:376
disti::DisplayObject::CalculateMatrices
virtual void CalculateMatrices(const OpenGLMatrices &newMatrices)
disti::DisplayObject::_alphaMode
int _alphaMode
Definition: display.h:1552
disti::DisplayObject::BoundingVolumeHit
bool BoundingVolumeHit(const Vector &start, const Vector &direction)
disti::DisplayObject::Shading
virtual void Shading(const int shading)
disti::DisplayObject::_cullBackFace
bool _cullBackFace
Definition: display.h:1566
disti::DisplayObject::InsideVertexExtents
bool InsideVertexExtents(float x, float y, unsigned int nVerts, Vertex *verts, float tolerance)
disti::DisplayObject::BlinkRate
virtual void BlinkRate(const float rate)
disti::DisplayObject::GetFillColor
virtual GlsColor GetFillColor()
disti::DisplayObject::Culled
void Culled(bool val)
Definition: display.h:426
disti::DisplayObject::ApplyTextureMinMagSettings
void ApplyTextureMinMagSettings()
Updates the state manager's texture minification and magnification filter based on this display's con...
disti::DisplayObject::_textureRepeat
unsigned char _textureRepeat
Definition: display.h:1628
disti::DisplayObject::SetTexCoords
virtual void SetTexCoords(unsigned int nPoints, Vector *new_tex_coord, bool isVectorArray=true)
disti::DisplayObject::IsVisibleInScene
virtual bool IsVisibleInScene(const DisplayObject *obj=NULL) const
disti::DisplayObject::BoundingVolumeRadius
float BoundingVolumeRadius() const
Definition: display.h:277
disti::DisplayObject::CopyProperties
virtual void CopyProperties(DisplayObject *src)
disti::DisplayObject::_textureIndex
int _textureIndex
Definition: display.h:1612
disti::DisplayObject::DynamicRotation
virtual float DynamicRotation(int axis)
disti::DistiAttribDict
Definition: disti_metadata.h:750
disti::DistiAttributeBase
Definition: disti_metadata.h:220
disti::DynamicArray< DisplayObjectPtr >
disti::EditorObjectBase
Definition: editor_object_base.h:49
disti::GlsColor
Definition: gls_color.h:54
disti::GlsGloFileAttribute
Definition: gls_glo_file.h:1243
disti::GlsGloFile
Definition: gls_glo_file.h:105
disti::GlsMatrixAffine< double >
disti::GlsMatrixAffine::Transform
void Transform(Vector &v) const
Definition: gls_matrix_affine.h:273
disti::GlsPainter
Definition: gls_painter.h:51
disti::GlsResourceFilter
Definition: gls_resources.h:51
disti::Group
Definition: group.h:53
disti::IGlsStateManagerES20
Definition: gls_state_manager_es20_interface.h:67
disti::IGlsStateManager
Definition: gls_state_manager_interface.h:69
disti::OpenGLMatrices
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:544
disti::VertexNoColor
Definition: vertex.h:85
disti::VertexNoColor::MagnitudeSquared
float MagnitudeSquared() const
Definition: vertex.h:338
disti::VertexNoColor::y
float y
The Y component.
Definition: vertex.h:88
disti::VertexNoColor::x
float x
The X component.
Definition: vertex.h:87
disti::VertexNoColor::z
float z
The Z component.
Definition: vertex.h:89
disti::Vertex
Definition: vertex.h:420
disti::WeakReferenceableMixin
Definition: weak_referenceable_mixin.h:53
cull.h
The disti::Culler class. Implements view frustum culling.
display_types.h
GL Studio Enumerations and constants.
NUM_TEXTURE_POINTS
#define NUM_TEXTURE_POINTS
Number of texture points per object.
Definition: display_types.h:47
disti_metadata.h
The disti metadata.
dynamic_array.h
The disti::DynamicArray class. A templated array of objects capable of dynamically growing.
editor_object_base.h
Defines a base class which editor objects can derive.
DISTI_DEPRECATED
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:488
DISTI_FINAL
#define DISTI_FINAL
Macro to wrap the final keyword, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:224
DISTI_METHOD_OVERRIDE
#define DISTI_METHOD_OVERRIDE
Macro to wrap the override keyword, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:222
gls_gl.h
The gls_gl.
GLS_EXPORT
#define GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:52
gls_matrix_affine.h
The GlsMatrixAffine class.
gls_painter.h
The GlsPainter interface.
gls_state_manager.h
The disti::GlsStateManager factory class. Creates an instance of a state manager that manages the GL ...
disti
Definition: bmpimage.h:47
disti::DisplayObjectArray
DynamicArray< DisplayObjectPtr > DisplayObjectArray
Typedef for a DynamicArray containing DisplayObjects.
Definition: display.h:85
disti::Z_AXIS
@ Z_AXIS
Definition: vertex.h:77
disti::DynamicIntArray
DynamicArray< int > DynamicIntArray
Typedef for a DynamicArray containing ints.
Definition: display.h:86
disti::Vector
VertexNoColor Vector
Definition: gls_font_base.h:69
disti::end
DistiAttribDict::const_iterator end(const DistiAttribDict &dict)
Definition: disti_metadata.h:975
disti::DisplayObjectPtr
DisplayObject * DisplayObjectPtr
Typedef for a DisplayObject pointer.
Definition: display.h:84
util.h
Generally useful defines, macros, enumerations and function prototypes.
MAX
#define MAX(A, B)
Definition: util.h:186
vertex.h
The disti::Vertex class. A class for manipulating 3D vertices.
weak_referenceable_mixin.h
weak reference and related classes