| GL Studio C++ Runtime API

gls_advanced_mesh.h
Go to the documentation of this file.
1/*! \file
2 \brief The disti::GlsAdvancedMesh class.
3
4
5 \par Copyright Information
6
7 Copyright (c) 2017 by The DiSTI Corporation.<br>
8 11301 Corporate Blvd; Suite 100<br>
9 Orlando, Florida 32817<br>
10 USA<br>
11 <br>
12 All rights reserved.<br>
13
14 This Software contains proprietary trade secrets of DiSTI and may not be
15 reproduced, in whole or part, in any form, or by any means of electronic,
16 mechanical, or otherwise, without the written permission of DiSTI. Said
17 permission may be derived through the purchase of applicable DiSTI product
18 licenses which detail the distribution rights of this content and any
19 Derivative Works based on this or other copyrighted DiSTI Software.
20
21 NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
22 AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
23 PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
24 AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
25 IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
26 PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
27
28 LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
29 IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
30 INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
31 DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
32 INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
33 INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
34 OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
35 EXCEED FIVE DOLLARS (US$5.00).
36
37 The aforementioned terms and restrictions are governed by the laws of the
38 State of Florida and the United States of America.
39
40*/
41
42#ifndef INCLUDED_GLS_ADVANCED_MESH_H
43#define INCLUDED_GLS_ADVANCED_MESH_H
44
45#ifdef _WIN32
46# include <windows.h>
47#endif
48
49#include "gls_geometry_resource.h"
50#include "gls_geometry_resource_mesh.h"
51#include "gls_render_effect.h"
52#include "gls_resource_file_mgr.h"
53
54/// Provides support for creating DLLs.
55#if( defined( GLSGEN_EXPORT_GLSADVANCEDMESH ) || defined( GLSGEN_IMPORT_GLSADVANCEDMESH ) || defined( GLS_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
56 && defined( _MSC_VER )
57# if defined( GLSGEN_EXPORT_GLSADVANCEDMESH ) || defined( GLS_EXPORT_GENERATED )
58# define GLSGEN_GlsAdvancedMesh_EXPORT __declspec( dllexport )
59# else
60# define GLSGEN_GlsAdvancedMesh_EXPORT __declspec( dllimport )
61# endif
62#else
63# define GLSGEN_GlsAdvancedMesh_EXPORT
64#endif
65///////////////////////////////////////////////////////////////////////////////
66
67/// Automatically link the runtime library plugin (on Windows).
68#define LIB_BASE_NAME "gls_advanced_mesh"
69#include "gls_auto_lib.h"
70#undef LIB_BASE_NAME
71
72 namespace disti
73{
74#ifdef GLES
75 class GlsGloFileAttribute;
76#endif
77 class GlsResourceFileMgr;
78
79/// \details The GlsAdvancedMesh class. Implementation for high performance 3D models.
80 class GlsAdvancedMesh : public GlsGeometryResourceMesh
81{
82 public:
83 DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
84 typedef GlsGeometryResourceMesh _BaseClass; ///< Deprecated typedef for the base class.
85 typedef GlsGeometryResourceMesh BaseClass; ///< Typedef for the base class.
86 friend class GlsAdvancedMeshEditor;
87
88 /** Create a new GlsAdvancedMesh. */
89 GLSGEN_GlsAdvancedMesh_EXPORT GlsAdvancedMesh();
90
91 /** Create a new GlsAdvancedMesh.
92 \param type The type of Resource to create.
93 */
94 GLSGEN_GlsAdvancedMesh_EXPORT GlsAdvancedMesh( const GlsGeometryResource::TypeDesc& type );
95
96 /**
97 \param resource A pointer to a resource that this Mesh will link to
98 \pre resource must be valid
99 \post the resource interest count will be incremented.
100 */
101 GLSGEN_GlsAdvancedMesh_EXPORT GlsAdvancedMesh( GlsGeometryResource* resource );
102
103 /**
104 * Create from a resource id and reference to a resource manager
105 * \param resourceMgr - resource manager
106 * \param resourceId - the string identifier of the resource
107 */
108 GLSGEN_GlsAdvancedMesh_EXPORT GlsAdvancedMesh( GlsResourceFileMgr& resourceMgr, const char* resourceId );
109
110 /** Copy constructor for GlsAdvancedMesh
111 * \param that The GlsAdvancedMesh to be copied from
112 * \param generateNames Whether or not to generate a new instance name
113 */
114 GLSGEN_GlsAdvancedMesh_EXPORT GlsAdvancedMesh( const GlsAdvancedMesh& that, const bool generateNames );
115
116 /** Destructs a GlsAdvancedMesh object */
117 virtual GLSGEN_GlsAdvancedMesh_EXPORT ~GlsAdvancedMesh();
118
119 /// \return A pointer to a new GlsAdvancedMesh object.
120 static GLSGEN_GlsAdvancedMesh_EXPORT DisplayObject* CreateInstance();
121
122 //////////////////////////////////////////////////
123 // Overridden base class methods
124 //////////////////////////////////////////////////
125
126 virtual GLSGEN_GlsAdvancedMesh_EXPORT void SetAvailableAttributes( unsigned int value ) DISTI_METHOD_OVERRIDE;
127 virtual GLSGEN_GlsAdvancedMesh_EXPORT DisplayObject* CloneObject( bool generateNames = false ) DISTI_METHOD_OVERRIDE;
128 virtual GLSGEN_GlsAdvancedMesh_EXPORT void CopyProperties( DisplayObject* src ) DISTI_METHOD_OVERRIDE;
129 virtual GLSGEN_GlsAdvancedMesh_EXPORT void CopyGeometry( DisplayObject* src ) DISTI_METHOD_OVERRIDE;
130
131#ifndef GLES
132 virtual GLSGEN_GlsAdvancedMesh_EXPORT InterfaceListType* GetCppInterfaceDescription( InterfaceListType* addToThisList = NULL ) DISTI_METHOD_OVERRIDE;
133 virtual GLSGEN_GlsAdvancedMesh_EXPORT void GetCppInterfaceDescriptionFree( InterfaceListType* array ) DISTI_METHOD_OVERRIDE;
134#endif
135
136 virtual GLSGEN_GlsAdvancedMesh_EXPORT void PreDraw( const OpenGLMatrices& parentMatrices, Culler& culler ) DISTI_METHOD_OVERRIDE;
137
138 //////////////////////////////////////////////////
139 // GlsAdvancedMesh specific operations
140 //////////////////////////////////////////////////
141
142 /**
143 Grab a pointer to the Resource. We do not copy the resource, we now
144 have at least two AdvancedMeshs that have interest in the same Geometry.
145 \param value a valid GeometryResource object
146 \pre
147 \post Interest in any previous geometry is decremented
148 Interest in this new geometry in incremented
149 */
150 GLSGEN_GlsAdvancedMesh_EXPORT void SetGeometryResource( GlsGeometryResource* value );
151
152 /**
153 NOTE: THIS METHOD WAS RENAMED FROM GetGlsGeometryResource() BECAUSE THE INTERFACE CHANGED.
154 THE METHOD NO LONGER IMPLICITLY CALLS IncrementReference() SO THE CALLER SHOULD NOT
155 CALL DecrementReference() ANYMORE.
156
157 The the GlsGeometryResource for this mesh.
158
159 \return a pointer to the Geometry Resource
160 \pre _geometryResource must be allocated
161
162 NOTE: SEE COMMENTS ABOVE!!! */
163 inline GlsGeometryResource* GetGeometryResource()
164 {
165 return _geometryResource;
166 }
167
168 protected:
169 // GlsGeometryResourceMesh override
170 virtual GLSGEN_GlsAdvancedMesh_EXPORT GlsGeometryResource* GetRenderMesh() DISTI_METHOD_OVERRIDE;
171
172#ifdef GLES
173 /** Set a single attribute from the GLO file.
174 * \param data The attribute to set and its associated data.
175 */
176 virtual GLSGEN_GlsAdvancedMesh_EXPORT void SetFromGloData( GlsGloFileAttribute& data ) DISTI_METHOD_OVERRIDE;
177#endif
178
179 Vector _lastGeometryBoundingVolumeCenter; ///< Center location stored for culling.
180 float _lastGeometryBoundingVolumeRadius; ///< 3D bounding volume stored for culling.
181
182 /**
183 Access shall be through the GetGlsGeometryResource method
184 */
185 GlsGeometryResource* _geometryResource;
186};
187
188} // namespace disti
189
190#endif
disti::Culler
Definition: cull.h:50
disti::DisplayObject
Definition: display.h:96
disti::DynamicArray
Definition: dynamic_array.h:79
disti::GlsAdvancedMesh
Definition: gls_advanced_mesh.h:81
disti::GlsAdvancedMesh::SetAvailableAttributes
virtual void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
disti::GlsAdvancedMesh::SetGeometryResource
void SetGeometryResource(GlsGeometryResource *value)
disti::GlsAdvancedMesh::_lastGeometryBoundingVolumeRadius
float _lastGeometryBoundingVolumeRadius
3D bounding volume stored for culling.
Definition: gls_advanced_mesh.h:180
disti::GlsAdvancedMesh::CloneObject
virtual DisplayObject * CloneObject(bool generateNames=false) DISTI_METHOD_OVERRIDE
disti::GlsAdvancedMesh::SetFromGloData
virtual void SetFromGloData(GlsGloFileAttribute &data) DISTI_METHOD_OVERRIDE
disti::GlsAdvancedMesh::PreDraw
virtual void PreDraw(const OpenGLMatrices &parentMatrices, Culler &culler) DISTI_METHOD_OVERRIDE
disti::GlsAdvancedMesh::GetRenderMesh
virtual GlsGeometryResource * GetRenderMesh() DISTI_METHOD_OVERRIDE
disti::GlsAdvancedMesh::_geometryResource
GlsGeometryResource * _geometryResource
Definition: gls_advanced_mesh.h:185
disti::GlsAdvancedMesh::CreateInstance
static DisplayObject * CreateInstance()
disti::GlsAdvancedMesh::CopyGeometry
virtual void CopyGeometry(DisplayObject *src) DISTI_METHOD_OVERRIDE
disti::GlsAdvancedMesh::GetGeometryResource
GlsGeometryResource * GetGeometryResource()
Definition: gls_advanced_mesh.h:163
disti::GlsAdvancedMesh::CopyProperties
virtual void CopyProperties(DisplayObject *src) DISTI_METHOD_OVERRIDE
disti::GlsAdvancedMesh::_lastGeometryBoundingVolumeCenter
Vector _lastGeometryBoundingVolumeCenter
Center location stored for culling.
Definition: gls_advanced_mesh.h:179
disti::GlsGeometryResourceMesh
Definition: gls_geometry_resource_mesh.h:80
disti::GlsGeometryResource
Definition: gls_geometry_resource.h:87
disti::GlsGloFileAttribute
Definition: gls_glo_file.h:1243
disti::GlsResourceFileMgr
Definition: gls_resource_file_mgr.h:26
disti::OpenGLMatrices
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:544
disti::VertexNoColor
Definition: vertex.h:85
GLSGEN_GlsAdvancedMesh_EXPORT
#define GLSGEN_GlsAdvancedMesh_EXPORT
Provides support for creating DLLs.
Definition: gls_advanced_mesh.h:63
gls_auto_lib.h
The gls_auto_lib.
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
gls_geometry_resource.h
The disti::GlsGeometryResource class.
gls_geometry_resource_mesh.h
The disti::GlsGeometryResourceMesh class.
gls_render_effect.h
The disti::GlsRenderEffect class.
disti
Definition: bmpimage.h:47