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