GL Studio Safety Critical Embedded C++ Runtime Library
gls_clipping_group.h
Go to the documentation of this file.
1#ifndef INCLUDED_GLS_CLIPPING_GROUP_H
2#define INCLUDED_GLS_CLIPPING_GROUP_H
3
4/*! \file gls_clipping_group.h
5
6\brief This header defines the GlsClippingGroup class
7 in the GL Studio DO-178B Runtime Library.
8
9\par Copyright Information
10Copyright (C) 2019-2025 The DiSTI Corporation<br>
11Orlando, FL USA<br>
12All rights reserved.<br>
13
14 This file is copyrighted software and contains proprietary trade secrets of
15DiSTI, and embodies substantial creative efforts as well as confidential
16information, ideas, and expressions.
17
18 Permission to use, and copy this software and its documentation for any
19purpose is hereby granted per the Distribution Agreement and/or the Licensing
20Agreement signed with DiSTI. This permission is granted provided that:
21 1. The above copyright notice appears in all copies.
22 2. That both the copyright notice and this permission notice appear in
23 the supporting documentation.
24 3. That the names DiSTI and GL Studio not be used in advertising or
25 publicity pertaining to distribution of the software without specific,
26 written prior permission of DiSTI.
27
28 Permission to modify the software is granted, but not the right to
29distribute the source code whether modified, or non-modified. Modifying the
30software might invalidate the DO-178B certification package.
31
32 Permission to distribute binaries produced by compiling source code, or
33modified source code is granted, provided you:
34 1. Provide your name and address as the primary contact for the support
35 of your modified version.
36 2. Retain our contact information in regard to use of the base software.
37
38 DiSTI does not provide warranty for this software or guarantee that it
39satisfies any specification or requirement unless otherwise stated in a
40specific contractual arrangement between the customer and DiSTI.
41
42*** NOTICE *** This source code is not encompassed by the DO-178B certication
43package.
44
45*/
46
47#include "gls_include.h"
48
49#include "gls_class_invariant.h"
50#include "gls_group.h"
51
52/** This class facilitates regions that clip geometry within a given boundary
53 * \invariant base class invariant holds
54 */
56{
57public:
59
60 /** intialization parameters for a GlsClippingGroup */
62 {
63 GlsGroup::InitParameters groupInitParameters; /**< base class init parameters */
64
65 const GlsBool clippingActive; /**< determines if geometry will be clipped between blc and trc */
66 const GlsVector3D blc; /**< bottom left corner of the clip region in logical units */
67 const GlsVector3D trc; /**< top right corner of the clip region in logical units */
68
69 /** create a copy of the init parameters with the object array init
70 * objects array replaced with the given array of objects
71 * \param newObjects new array of ojects
72 * \return copy of given init parameters with object array init objects array replaced
73 * \pre newObjects != GLS_NULL,
74 * newObjects array has initParameters.groupInitParameters.objectArrayInitParameters.numObjects elements
75 * \post none
76 */
78
79#if defined( GLS_DEBUG )
80 /** Determine if the initialization parameters are valid ( GLS_DEBUG only )
81 * \return GLS_TRUE if valid else GLS_FALSE
82 * \pre none
83 * \post none
84 */
85 GlsBool IsValid( void ) const;
86#endif // GLS_DEBUG
87 };
88
89 /** Constructor - create an instance
90 * \param initParameters initialization parameters
91 * \param eventDispatcher event dispatcher for this object else GLS_NULL
92 * \pre initParameters.IsValid()
93 * \post instance created
94 */
95 GlsClippingGroup( InitParameters& initParameters, GlsEventDispatcher* const eventDispatcher );
96
97 /** Draws the objects in the clipping group.
98 * \param gl GL State manager for OpenGL into which object is drawn
99 * \param time the elaspsed time in seconds since program start
100 * \pre time >= 0.0
101 * \post contained objects are drawn to OpenGL if visible and not blinked off
102 */
103 virtual void Draw( GlsStateManager& gl, const GlsFloat64 time );
104
105 /** Perform a pick test of the given point in window coordinates against this object
106 * \param windowCoord point in question
107 * \param inputManager input manager managing input for this object
108 * \param parentDrawMatrix draw matrix used when rendering parent object
109 * \return object that is picked by given window coordinate else GLS_NULL
110 * \pre windowCoord.IsValid(), GLMatrixAffineFIsValid( parentDrawMatrix )
111 * \post none
112 */
113 virtual GlsDisplayObject* PickTest( const GlsVector2D& windowCoord, GlsInputManager& inputManager,
114 const GlsMatrixAffineD::GLMatrixAffineF& parentDrawMatrix );
115
116 /** Get the current active state for the clipping region
117 * \return GlsBool current active state
118 * \pre class invariant
119 * \post none
120 */
122
123 /** Set the current active state for the clipping region
124 * \param value GlsBool new active state to set
125 * \pre class invariant
126 * \post active state set to incoming value
127 */
128 void SetClippingActive( const GlsBool value );
129
130 /** Get the bottom left corner of the clipping region
131 * \return GlsVector3D current bottom left corner location
132 * \pre class invariant
133 * \post none
134 */
136
137 /** Set the bottom left corner of the clipping region
138 * \param value GlsVector3D new bottom left corner to set
139 * \pre class invariant
140 * \post none
141 */
142 void SetBlc( const GlsVector3D& value );
143
144 /** Get the top right corner of the clipping region
145 * \return GlsVector3D current top right corner location
146 * \pre class invariant
147 * \post none
148 */
150
151 /** Set the top right corner of the clipping region
152 * \param value GlsVector3D new top right corner to set
153 * \pre class invariant
154 * \post none
155 */
156 void SetTrc( const GlsVector3D& value );
157
158protected:
159 GlsBool _clippingActive; /**< determines if geometry will be clipped between blc and trc */
160 GlsVector3D _blc; /**< bottom left corner of the clip region in logical units */
161 GlsVector3D _trc; /**< top right corner of the clip region in logical units */
162
163 /** Destructor - shall never be called
164 * \pre none
165 * \post none
166 */
168
169 /* Recalculates the window picking region if needed
170 * \param inputManager input manager managing input for this object
171 * \param parentDrawMatrix draw matrix used when rendering parent object
172 * \pre _needCalcDrawMatrix == GLS_FALSE (_drawMatrix is up to date)
173 * \post _windowPickLowerLeft, _windowPickUpperRight, _windowPickUpperLeft,
174 * _windowPickLowerRight and _pickMatrix are recalculated
175 * if _windowPickRegionValid == GLS_FALSE,
176 */
177 virtual void CalcWindowPickRegion( GlsInputManager& inputManager,
178 const GlsMatrixAffineD::GLMatrixAffineF& parentDrawMatrix );
179
180 /** Draws the clipping polygon to the stencil buffer.
181 * \param gl GL State manager for OpenGL into which object is drawn
182 * \pre class invariant
183 * \post clipping polygon is drawn to OpenGL
184 */
186
187private:
188 typedef GlsGroup BaseClass; /**< base class alias */
189
190 // Disable implicit generated Members
191 GlsClippingGroup& operator=( const GlsClippingGroup& rhs );
193};
194
195#endif // _GLS_CLIPPING_GROUP_H
Definition: gls_clipping_group.h:56
virtual void CalcWindowPickRegion(GlsInputManager &inputManager, const GlsMatrixAffineD::GLMatrixAffineF &parentDrawMatrix)
virtual void Draw(GlsStateManager &gl, const GlsFloat64 time)
GlsVector3D GetTrc()
GlsVector3D _blc
Definition: gls_clipping_group.h:160
void SetClippingActive(const GlsBool value)
virtual GlsDisplayObject * PickTest(const GlsVector2D &windowCoord, GlsInputManager &inputManager, const GlsMatrixAffineD::GLMatrixAffineF &parentDrawMatrix)
void SetBlc(const GlsVector3D &value)
GlsClippingGroup(InitParameters &initParameters, GlsEventDispatcher *const eventDispatcher)
GlsVector3D GetBlc()
void SetTrc(const GlsVector3D &value)
GlsBool _clippingActive
Definition: gls_clipping_group.h:159
void DrawClippingPolygon(GlsStateManager &gl)
GlsBool GetClippingActive()
virtual ~GlsClippingGroup()
GlsVector3D _trc
Definition: gls_clipping_group.h:161
Definition: gls_display_object.h:65
Definition: gls_event.h:305
Definition: gls_group.h:53
Definition: gls_input_manager.h:54
GLfloat GLMatrixAffineF[DIMENSION *DIMENSION]
Definition: gls_matrix_affine_double.h:63
Definition: gls_state_manager.h:64
This header defines a GLS_DEBUG only macro for facilitating evaluating class invariants in the GL Stu...
#define GLS_CLASS_INVARIANT_DECLARATION(ClassName)
Definition: gls_class_invariant.h:80
This header defines the GlsGroup class in the GL Studio DO-178B Runtime Library.
This header defines any preprocessor defines needed to configure the GL Studio DO-178B Runtime Librar...
bool GlsBool
Definition: gls_types.h:96
double GlsFloat64
Definition: gls_types.h:87
Definition: gls_clipping_group.h:62
const GlsVector3D trc
Definition: gls_clipping_group.h:67
GlsGroup::InitParameters groupInitParameters
Definition: gls_clipping_group.h:63
InitParameters CopyWithObjectsArray(GlsDisplayObject *const *newObjects) const
const GlsVector3D blc
Definition: gls_clipping_group.h:66
const GlsBool clippingActive
Definition: gls_clipping_group.h:65
Definition: gls_group.h:59
Definition: gls_vertex.h:50
Definition: gls_vertex.h:66