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  DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
85  typedef Group _BaseClass;
86  typedef Group BaseClass;
87 
88  friend class GlsLodGroupEditor;
89 
90  /** Create a new GlsLodGroup.
91  * \param generateInstance Whether or not to generate an instance name
92  * for this inputdevice
93  */
94  GLSGEN_GlsLodGroup_EXPORT explicit GlsLodGroup( bool generateInstance = false );
95 
96  GLSGEN_GlsLodGroup_EXPORT GlsLodGroup( const GlsLodGroup& that, const bool generateNames );
97 
98  static GLSGEN_GlsLodGroup_EXPORT DisplayObject* CreateInstance();
99 
100  static GLSGEN_GlsLodGroup_EXPORT void GroupDebugCommand( const char* cmd, const char* arg );
101 
102  //////////////////////////////////////////////////
103  // GlsLodGroup specific operations
104  //////////////////////////////////////////////////
105 
106  virtual GLSGEN_GlsLodGroup_EXPORT int NumLods();
107  virtual GLSGEN_GlsLodGroup_EXPORT float GetLodPosition( int index );
108 
109  //////////////////////////////////////////////////
110  // Overridden base class methods
111  // The base class methods are overridden so that the Group Class methods
112  // are not called, generally DisplayObject methods are called, there
113  // are a few exceptions.
114  //////////////////////////////////////////////////
115 
116  /** See base class */
117  GLSGEN_GlsLodGroup_EXPORT void Draw() DISTI_METHOD_OVERRIDE;
118 
119  /** See base class */
120  GLSGEN_GlsLodGroup_EXPORT void PreDraw( const OpenGLMatrices& parentMatrices, Culler& culler ) DISTI_METHOD_OVERRIDE;
121 
122  /** See base class */
123  GLSGEN_GlsLodGroup_EXPORT void SetAvailableAttributes( unsigned int value ) DISTI_METHOD_OVERRIDE;
124 
125  /** See base class */
126  GLSGEN_GlsLodGroup_EXPORT void InsertObject( DisplayObject* obj, bool reparent = true, bool recalculateBoundingbox = true, int loc = -1 ) DISTI_METHOD_OVERRIDE;
127 
128 protected:
129  /* See base class */
130  GLSGEN_GlsLodGroup_EXPORT void SetValue( int spec, va_list& args ) DISTI_METHOD_OVERRIDE;
131 
132 #ifdef GLES
133  /** Set a single attribute from the GLO file.
134  * \param data The attribute to set and its associated data.
135  */
136  GLSGEN_GlsLodGroup_EXPORT void SetFromGloData( GlsGloFileAttribute& data ) DISTI_METHOD_OVERRIDE;
137 #endif
138 
139 private:
140  // Disable implicit generated Members
141  GlsLodGroup& operator=( const GlsLodGroup& rhs ) DISTI_SPECIAL_MEM_FUN_DELETE;
142  GlsLodGroup( const GlsLodGroup& src ) DISTI_SPECIAL_MEM_FUN_DELETE;
143 
144  DynamicArray<float> _lodPositions;
145  float _distanceRange;
146  int _currentState;
147  int _previewState;
148  float _previewValue;
149 };
150 
151 } // namespace disti
152 
153 #endif
Definition: cull.h:49
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:436
The disti::Group class. Implements groups of objects.
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:473
void PreDraw(const OpenGLMatrices &parentMatrices, Culler &culler) DISTI_METHOD_OVERRIDE
Definition: display.h:98
void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
Definition: gls_glo_file.h:988
void SetValue(int spec, va_list &args) DISTI_METHOD_OVERRIDE
The gls_auto_lib.
Definition: group.h:52
GlsLodGroup(bool generateInstance=false)
void Draw() DISTI_METHOD_OVERRIDE
void InsertObject(DisplayObject *obj, bool reparent=true, bool recalculateBoundingbox=true, int loc=-1) DISTI_METHOD_OVERRIDE
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