GL Studio C++ Runtime API
gls_lod_group.h
Go to the documentation of this file.
1 /*! \file
2  \brief The disti::GlsLodGroup class.
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 _GlsLodGroup_H
41 #define _GlsLodGroup_H
42 
43 #include <vector>
44 
45 #include "gls_cpp_lang_support.h"
46 #include "group.h"
47 
48 //////////////////// Provides support for creating DLLs ////////////////////////
49 #if( defined( GLSGEN_EXPORT_GlsLodGroup ) || defined( GLSGEN_IMPORT_GlsLodGroup ) || defined( GLS_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
50  && defined( _MSC_VER )
51 # if defined( GLSGEN_EXPORT_GlsLodGroup ) || defined( GLS_EXPORT_GENERATED )
52 # define GLSGEN_GlsLodGroup_EXPORT __declspec( dllexport )
53 # else
54 # define GLSGEN_GlsLodGroup_EXPORT __declspec( dllimport )
55 # endif
56 #else
57 # define GLSGEN_GlsLodGroup_EXPORT
58 #endif
59 ///////////////////////////////////////////////////////////////////////////////
60 
61 #define LIB_BASE_NAME "gls_lod_group"
62 #include "gls_auto_lib.h"
63 #undef LIB_BASE_NAME
64 
65 namespace disti
66 {
67 // Forward Declaration
68 class GlsGloFileAttribute;
69 
70 typedef enum
71 {
72  GLS_LOD_GROUP_DISTANCE_RANGE = GLS_LAST_INITIALIZER + 1,
73  GLS_LOD_GROUP_LOD_POSITIONS
74 } GLS_LodGroup_Initializers;
75 
76 /**
77  The GlsLodGroup allows users to set different levels of detail (LOD) for its contents based on how far the group is from the camera.
78  The GlsLodGroup renders a single child, and chooses which child to render based on the distance from the current camera and the values
79  set on each LOD position in the editor. LODs are only used with perspective cameras.
80 */
81 class GlsLodGroup : public Group
82 {
83 public:
84  typedef Group _BaseClass;
85 
86  friend class GlsLodGroupEditor;
87 
88  /** Create a new GlsLodGroup.
89  * \param generateInstance Whether or not to generate an instance name
90  * for this inputdevice
91  */
92  GLSGEN_GlsLodGroup_EXPORT GlsLodGroup( bool generateInstance = false );
93 
94  GLSGEN_GlsLodGroup_EXPORT GlsLodGroup( const GlsLodGroup& that, const bool generateNames );
95 
96  /** Destructs a GlsLodGroup object */
97  virtual GLSGEN_GlsLodGroup_EXPORT ~GlsLodGroup();
98 
99  static GLSGEN_GlsLodGroup_EXPORT DisplayObject* CreateInstance();
100 
101  static GLSGEN_GlsLodGroup_EXPORT void GroupDebugCommand( const char* cmd, const char* arg );
102 
103  virtual GLSGEN_GlsLodGroup_EXPORT void SetAvailableAttributes( unsigned int value );
104 
105  //////////////////////////////////////////////////
106  // Overridden base class methods
107  // The base class methods are overridden so that the Group Class methods
108  // are not called, generally DisplayObject methods are called, there
109  // are a few exceptions.
110  //////////////////////////////////////////////////
111 
112  virtual GLSGEN_GlsLodGroup_EXPORT void Draw( void );
113  virtual GLSGEN_GlsLodGroup_EXPORT void PreDraw( const OpenGLMatrices& parentMatrices, Culler& culler );
114 
115  virtual GLSGEN_GlsLodGroup_EXPORT int NumLods();
116 
117  /** Adds the specified object into the group, at the end of the list
118  * \param obj A pointer to the object to add
119  * \param reparent Whether or not the object parent should be set to this group
120  * \param recalculateBoundingbox Whether or not to recalculate the bounding box
121  * \param loc Where to insert it (defaults to -1 which means at the end of the list)
122  */
123  virtual GLSGEN_GlsLodGroup_EXPORT void InsertObject( DisplayObject* obj, bool reparent = true, bool recalculateBoundingbox = true, int loc = -1 );
124 
125  virtual GLSGEN_GlsLodGroup_EXPORT float GetLodPosition( int index );
126 
127 protected:
128  /* See base class */
129  virtual GLSGEN_GlsLodGroup_EXPORT void SetValue( int spec, va_list& args );
130 
131 #ifdef GLES
132  /** Set a single attribute from the GLO file.
133  * \param data The attribute to set and its associated data.
134  */
135  virtual GLSGEN_GlsLodGroup_EXPORT void SetFromGloData( GlsGloFileAttribute& data );
136 #endif
137  //////////////////////////////////////////////////
138  // GlsLodGroup specific operations
139  //////////////////////////////////////////////////
140 
141 private:
142  // Disable implicit generated Members
143  GlsLodGroup& operator=( const GlsLodGroup& rhs );
144  GlsLodGroup( const GlsLodGroup& src );
145 
146  DynamicArray<float> _lodPositions;
147  float _distanceRange;
148  int _currentState;
149  int _previewState;
150  float _previewValue;
151 };
152 
153 } // namespace disti
154 
155 #endif
Definition: cull.h:49
The disti::Group class. Implements groups of objects.
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:276
virtual void SetAvailableAttributes(unsigned int value)
Definition: display.h:98
virtual void Draw(void)
Definition: gls_glo_file.h:982
virtual void SetValue(int spec, va_list &args)
virtual ~GlsLodGroup()
The gls_auto_lib.
Definition: group.h:52
GlsLodGroup(bool generateInstance=false)
virtual void PreDraw(const OpenGLMatrices &parentMatrices, Culler &culler)
Macros and helper code to determine what subset of C++11/14/17 is available.
Definition: gls_lod_group.h:81
Definition: bmpimage.h:46
virtual void InsertObject(DisplayObject *obj, bool reparent=true, bool recalculateBoundingbox=true, int loc=-1)