GL Studio C++ Runtime API
gls_lod_group.h
Go to the documentation of this file.
1/// \file gls_lod_group.h
2/// \brief The disti::GlsLodGroup class.
3///
4/// \par Copyright Information
5///
6/// Copyright (c) 2017 by The DiSTI Corporation.<br>
7/// 12249 Science Drive; Suite 300<br>
8/// Orlando, Florida 32826<br>
9/// USA<br>
10/// <br>
11/// All rights reserved.<br>
12///
13/// This Software contains proprietary trade secrets of DiSTI and may not be
14/// reproduced, in whole or part, in any form, or by any means of electronic,
15/// mechanical, or otherwise, without the written permission of DiSTI. Said
16/// permission may be derived through the purchase of applicable DiSTI product
17/// licenses which detail the distribution rights of this content and any
18/// Derivative Works based on this or other copyrighted DiSTI Software.
19///
20/// NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21/// AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22/// PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23/// AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24/// IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25/// PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26///
27/// LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28/// IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29/// INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30/// DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31/// INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32/// INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33/// OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34/// EXCEED FIVE DOLLARS (US$5.00).
35///
36/// The aforementioned terms and restrictions are governed by the laws of the
37/// State of Florida and the United States of America.
38
39#ifndef DISTI_INCLUDED_GLS_LOD_GROUP_H
40#define DISTI_INCLUDED_GLS_LOD_GROUP_H
41
42#include <vector>
43
45#include "group.h"
46
47/// Provides support for creating DLLs.
48#if( defined( GLSGEN_EXPORT_GlsLodGroup ) || defined( GLSGEN_IMPORT_GlsLodGroup ) || defined( GLS_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
49 && defined( _MSC_VER )
50# if defined( GLSGEN_EXPORT_GlsLodGroup ) || defined( GLS_EXPORT_GENERATED )
51# define GLSGEN_GlsLodGroup_EXPORT __declspec( dllexport )
52# else
53# define GLSGEN_GlsLodGroup_EXPORT __declspec( dllimport )
54# endif
55#else
56# define GLSGEN_GlsLodGroup_EXPORT
57#endif
58///////////////////////////////////////////////////////////////////////////////
59
60/// Automatically link the runtime library plugin (on Windows).
61#define LIB_BASE_NAME "gls_lod_group"
62#include "gls_auto_lib.h"
63#undef LIB_BASE_NAME
64
65namespace disti
66{
67// Forward Declaration
68class GlsGloFileAttribute;
69
70/// SetValue enumerations
71typedef enum
72{
73 GLS_LOD_GROUP_DISTANCE_RANGE = GLS_LAST_INITIALIZER + 1,
74 GLS_LOD_GROUP_LOD_POSITIONS
76
77/**
78 The GlsLodGroup allows users to set different levels of detail (LOD) for its contents based on how far the group is from the camera.
79 The GlsLodGroup renders a single child, and chooses which child to render based on the distance from the current camera and the values
80 set on each LOD position in the editor. LODs are only used with perspective cameras.
81*/
82class GlsLodGroup : public Group
83{
84public:
85 DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
86 typedef Group _BaseClass; ///< Deprecated typedef for the base class.
87 typedef Group BaseClass; ///< Typedef for the base class.
88
89 friend class GlsLodGroupEditor;
90
91 /** Create a new GlsLodGroup.
92 * \param generateInstance Whether or not to generate an instance name
93 * for this inputdevice
94 */
95 GLSGEN_GlsLodGroup_EXPORT explicit GlsLodGroup( bool generateInstance = false );
96
97 /// Copy constructor
98 /// \param that The object to copy from.
99 /// \param generateNames Whether or not to generate an instance name.
100 GLSGEN_GlsLodGroup_EXPORT GlsLodGroup( const GlsLodGroup& that, const bool generateNames );
101
102 /// \return A pointer to a new GlsLodGroup object.
104
105 /// Unused, kept for backward compatibility.
106 /// \param cmd
107 /// \param arg
108 static GLSGEN_GlsLodGroup_EXPORT void GroupDebugCommand( const char* cmd, const char* arg );
109
110 //////////////////////////////////////////////////
111 // GlsLodGroup specific operations
112 //////////////////////////////////////////////////
113
114 /// \return The number of LOD positions defined in this object.
116
117 /// \return The normalized (0-100) position of the desired LOD index.
118 /// \param index The LOD index whose position is to be returned.
119 virtual GLSGEN_GlsLodGroup_EXPORT float GetLodPosition( int index );
120
121 //////////////////////////////////////////////////
122 // Overridden base class methods
123 // The base class methods are overridden so that the Group Class methods
124 // are not called, generally DisplayObject methods are called, there
125 // are a few exceptions.
126 //////////////////////////////////////////////////
127
131 GLSGEN_GlsLodGroup_EXPORT void InsertObject( DisplayObject* obj, bool reparent = true, bool recalculateBoundingbox = true, int loc = -1 ) DISTI_METHOD_OVERRIDE;
132
133protected:
135
136#ifdef GLES
137 /** Set a single attribute from the GLO file.
138 * \param data The attribute to set and its associated data.
139 */
141#endif
142
143 DynamicArray<float> _lodPositions; ///< List of LOD distances (0-100) where each state will be shown.
144 float _distanceRange; ///< The distance range to interpolate LOD positions over in logical units.
145 int _currentState; ///< The current child index being drawn.
146 int _previewState; ///< Editor only: the child index being drawn via object preview.
147 float _previewValue; ///< Editor only: the preview distance value.
148
149private:
150 // Disable implicit generated Members
153};
154
155} // namespace disti
156
157#endif
Definition: cull.h:49
Definition: display.h:95
Definition: gls_glo_file.h:1241
Definition: gls_lod_group.h:83
GlsLodGroup(bool generateInstance=false)
void InsertObject(DisplayObject *obj, bool reparent=true, bool recalculateBoundingbox=true, int loc=-1) DISTI_METHOD_OVERRIDE
void SetValue(int spec, va_list &args) DISTI_METHOD_OVERRIDE
static void GroupDebugCommand(const char *cmd, const char *arg)
float _distanceRange
The distance range to interpolate LOD positions over in logical units.
Definition: gls_lod_group.h:144
void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
int _previewState
Editor only: the child index being drawn via object preview.
Definition: gls_lod_group.h:146
void PreDraw(const OpenGLMatrices &parentMatrices, Culler &culler) DISTI_METHOD_OVERRIDE
static DisplayObject * CreateInstance()
void Draw() DISTI_METHOD_OVERRIDE
virtual float GetLodPosition(int index)
DynamicArray< float > _lodPositions
List of LOD distances (0-100) where each state will be shown.
Definition: gls_lod_group.h:143
int _currentState
The current child index being drawn.
Definition: gls_lod_group.h:145
float _previewValue
Editor only: the preview distance value.
Definition: gls_lod_group.h:147
virtual int NumLods()
Definition: group.h:52
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:540
The gls_auto_lib.
Macros and helper code to determine what subset of C++11/14/17 is available.
#define DISTI_SPECIAL_MEM_FUN_DELETE
Macro to wrap function deletion, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:245
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:487
#define DISTI_METHOD_OVERRIDE
Macro to wrap the override keyword, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:221
#define GLSGEN_GlsLodGroup_EXPORT
Provides support for creating DLLs.
Definition: gls_lod_group.h:56
The disti::Group class. Implements groups of objects.
Definition: bmpimage.h:46
GLS_LodGroup_Initializers
SetValue enumerations.
Definition: gls_lod_group.h:72