GL Studio C++ Runtime API
gls_sorted_draw_group.h
Go to the documentation of this file.
1/// \file
2/// \brief A sorted drawable group.
3///
4/// \par Copyright Information
5///
6/// Copyright (c) 2022 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#ifndef GLS_SORTED_RENDER_GROUP_H_INCLUDED
40#define GLS_SORTED_RENDER_GROUP_H_INCLUDED
41
42#include "gls_sorted_drawable.h"
43#include "group.h"
44
45/// Provides support for creating DLLs.
46#if( defined( GLSGEN_EXPORT_GLSADVANCEDMESH ) || defined( GLSGEN_IMPORT_GLSADVANCEDMESH ) || defined( GLS_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
47 && defined( _MSC_VER )
48# if defined( GLSGEN_EXPORT_GLSADVANCEDMESH ) || defined( GLS_EXPORT_GENERATED )
49# define GLSGEN_GlsAdvancedMesh_EXPORT __declspec( dllexport )
50# else
51# define GLSGEN_GlsAdvancedMesh_EXPORT __declspec( dllimport )
52# endif
53#else
54# define GLSGEN_GlsAdvancedMesh_EXPORT
55#endif
56///////////////////////////////////////////////////////////////////////////////
57
58namespace disti
59{
60class GlsRenderEffect;
61class GlsGeometryResource;
62class GlsSortedDrawable;
63class GlsDeferredDrawGroup;
64
65/// \details This Group allows it's children to register into a list during Draw. The Group then sorts the list and draws the children.
67{
68public:
69 DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
70 typedef Group _BaseClass; ///< Deprecated typedef for the base class.
71 typedef Group BaseClass; ///< Typedef for the base class.
72
74
75 /// \details The DrawList class. Holds a list of objects for sorting and drawing.
77 {
78 friend class GlsSortedDrawGroup;
79
80 public:
81 /// Register the incoming drawable object with this list.
82 /// \param obj The new object to register.
84
85 protected:
86 typedef std::vector<GlsSortedDrawable*> EntryListT; ///< Typedef for a list of drawables.
87 typedef std::vector<GlsDeferredDrawGroup*> DeferredDrawListT; ///< Unused.
88 EntryListT drawEntryList; ///< List of drawables in sorted order.
89 EntryListT orderPreservedDrawList; ///< List of drawables in orginal order.
91 unsigned long drawEntryListCount; ///< Number of elements in the entry list.
92 unsigned long orderPreservedDrawListCount; ///< Number of elements in the original order list.
93
94 DrawList()
95 : drawEntryListCount( 0 )
96 , orderPreservedDrawListCount( 0 )
97 {}
98
99 /// Sort the list using GlsSortedDrawable::SortedDraw_Compare.
100 void Sort();
101
102 /// Optimize the nodes using GlsSortedDrawable::SortedDraw_MergeEffects.
103 /// Should only be called after the list is sorted.
104 void Optimize();
105
106 /// Draw the nodes.
107 void Draw();
108
109 /// Clear the list.
110 void Clear();
111 };
112
114
115 /// \return A pointer to the active GlsSortedDrawGroup::DrawList for the calling thread.
116 /// \note This will be NULL if there is no active DrawList.
118
119 /// Disable sorted draw to render normally.
120 /// Toggling this value between frames is a good way to debug any rendering issues.
121 /// \param value The sorting draw flag to set.
123
124 /// \return Whether or not objects should be drawn sorted, or in original order.
126
127protected:
128 /// Set the active GlsSortedDrawGroup::DrawList for the calling thread.
130
131 bool _sortedDrawDisabled; ///< If true, draw in original order rather than sorted order.
132 DrawList _drawList; ///< Holds sorting and object data.
133};
134
135} // end namespace disti
136
137#endif
Definition: display.h:96
Definition: gls_sorted_draw_group.h:77
DeferredDrawListT deferredDrawList
Unused.
Definition: gls_sorted_draw_group.h:90
EntryListT drawEntryList
List of drawables in sorted order.
Definition: gls_sorted_draw_group.h:88
std::vector< GlsDeferredDrawGroup * > DeferredDrawListT
Unused.
Definition: gls_sorted_draw_group.h:87
EntryListT orderPreservedDrawList
List of drawables in orginal order.
Definition: gls_sorted_draw_group.h:89
void RegisterDrawable(GlsSortedDrawable *obj)
std::vector< GlsSortedDrawable * > EntryListT
Typedef for a list of drawables.
Definition: gls_sorted_draw_group.h:86
unsigned long drawEntryListCount
Number of elements in the entry list.
Definition: gls_sorted_draw_group.h:91
unsigned long orderPreservedDrawListCount
Number of elements in the original order list.
Definition: gls_sorted_draw_group.h:92
void Sort()
Sort the list using GlsSortedDrawable::SortedDraw_Compare.
Definition: gls_sorted_draw_group.h:67
virtual void Draw() DISTI_METHOD_OVERRIDE
DrawList _drawList
Holds sorting and object data.
Definition: gls_sorted_draw_group.h:132
static DrawList * GetActiveDrawListPtr()
static void SetActiveDrawListPtr(DrawList *)
Set the active GlsSortedDrawGroup::DrawList for the calling thread.
bool _sortedDrawDisabled
If true, draw in original order rather than sorted order.
Definition: gls_sorted_draw_group.h:131
Definition: gls_sorted_drawable.h:48
Definition: group.h:53
#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_GlsAdvancedMesh_EXPORT
Provides support for creating DLLs.
Definition: gls_sorted_draw_group.h:54
A sorted drawable group.
The disti::Group class. Implements groups of objects.
Force inclusion of the DirectShow library.
Definition: bmpimage.h:47