| 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/// 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
66 namespace disti
67{
68// Forward Declaration
69 class GlsGloFileAttribute;
70
71/// SetValue enumerations
72 typedef enum
73{
74 GLS_LOD_GROUP_DISTANCE_RANGE = GLS_LAST_INITIALIZER + 1,
75 GLS_LOD_GROUP_LOD_POSITIONS
76} GLS_LodGroup_Initializers;
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*/
83 class GlsLodGroup : public Group
84{
85 public:
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.
104 static GLSGEN_GlsLodGroup_EXPORT DisplayObject* CreateInstance();
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.
116 virtual GLSGEN_GlsLodGroup_EXPORT int NumLods();
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
129 GLSGEN_GlsLodGroup_EXPORT void Draw() DISTI_METHOD_OVERRIDE;
130 GLSGEN_GlsLodGroup_EXPORT void PreDraw( const OpenGLMatrices& parentMatrices, Culler& culler ) DISTI_METHOD_OVERRIDE;
131 GLSGEN_GlsLodGroup_EXPORT void SetAvailableAttributes( unsigned int value ) DISTI_METHOD_OVERRIDE;
132 GLSGEN_GlsLodGroup_EXPORT void InsertObject( DisplayObject* obj, bool reparent = true, bool recalculateBoundingbox = true, int loc = -1 ) DISTI_METHOD_OVERRIDE;
133
134protected:
135 GLSGEN_GlsLodGroup_EXPORT void SetValue( int spec, va_list& args ) DISTI_METHOD_OVERRIDE;
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 */
141 GLSGEN_GlsLodGroup_EXPORT void SetFromGloData( GlsGloFileAttribute& data ) DISTI_METHOD_OVERRIDE;
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
150 private:
151 // Disable implicit generated Members
152 GlsLodGroup& operator=( const GlsLodGroup& rhs ) DISTI_SPECIAL_MEM_FUN_DELETE;
153 GlsLodGroup( const GlsLodGroup& src ) DISTI_SPECIAL_MEM_FUN_DELETE;
154};
155
156} // namespace disti
157
158#endif
disti::Culler
Definition: cull.h:50
disti::DisplayObject
Definition: display.h:96
disti::DynamicArray< float >
disti::GlsGloFileAttribute
Definition: gls_glo_file.h:1243
disti::GlsLodGroup
Definition: gls_lod_group.h:84
disti::GlsLodGroup::GlsLodGroup
GlsLodGroup(bool generateInstance=false)
disti::GlsLodGroup::InsertObject
void InsertObject(DisplayObject *obj, bool reparent=true, bool recalculateBoundingbox=true, int loc=-1) DISTI_METHOD_OVERRIDE
disti::GlsLodGroup::SetValue
void SetValue(int spec, va_list &args) DISTI_METHOD_OVERRIDE
disti::GlsLodGroup::GroupDebugCommand
static void GroupDebugCommand(const char *cmd, const char *arg)
disti::GlsLodGroup::_distanceRange
float _distanceRange
The distance range to interpolate LOD positions over in logical units.
Definition: gls_lod_group.h:145
disti::GlsLodGroup::SetFromGloData
void SetFromGloData(GlsGloFileAttribute &data) DISTI_METHOD_OVERRIDE
disti::GlsLodGroup::SetAvailableAttributes
void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
disti::GlsLodGroup::_previewState
int _previewState
Editor only: the child index being drawn via object preview.
Definition: gls_lod_group.h:147
disti::GlsLodGroup::PreDraw
void PreDraw(const OpenGLMatrices &parentMatrices, Culler &culler) DISTI_METHOD_OVERRIDE
disti::GlsLodGroup::CreateInstance
static DisplayObject * CreateInstance()
disti::GlsLodGroup::Draw
void Draw() DISTI_METHOD_OVERRIDE
disti::GlsLodGroup::GetLodPosition
virtual float GetLodPosition(int index)
disti::GlsLodGroup::_lodPositions
DynamicArray< float > _lodPositions
List of LOD distances (0-100) where each state will be shown.
Definition: gls_lod_group.h:144
disti::GlsLodGroup::_currentState
int _currentState
The current child index being drawn.
Definition: gls_lod_group.h:146
disti::GlsLodGroup::_previewValue
float _previewValue
Editor only: the preview distance value.
Definition: gls_lod_group.h:148
disti::GlsLodGroup::NumLods
virtual int NumLods()
disti::Group
Definition: group.h:53
disti::OpenGLMatrices
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:544
gls_auto_lib.h
The gls_auto_lib.
gls_cpp_lang_support.h
Macros and helper code to determine what subset of C++11/14/17 is available.
DISTI_SPECIAL_MEM_FUN_DELETE
#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:246
DISTI_DEPRECATED
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:488
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
GLSGEN_GlsLodGroup_EXPORT
#define GLSGEN_GlsLodGroup_EXPORT
Provides support for creating DLLs.
Definition: gls_lod_group.h:57
group.h
The disti::Group class. Implements groups of objects.
disti
Definition: bmpimage.h:47
disti::GLS_LodGroup_Initializers
GLS_LodGroup_Initializers
SetValue enumerations.
Definition: gls_lod_group.h:73