GL Studio SCECpp Runtime Library
gls_polygon.h
Go to the documentation of this file.
1 #ifndef _GLS_POLYGON_H
2 #define _GLS_POLYGON_H
3 
4 /*! \file gls_polygon.h
5 \brief This header defines the GlsPolygon class in
6  the GL Studio DO-178B Runtime Library.
7 
8 \par Copyright Information
9 Copyright (C) 1999-2012 The DiSTI Corporation<br>
10 Orlando, FL USA<br>
11 All rights reserved.<br>
12 
13  This file is copyrighted software and contains proprietary trade secrets of
14 DiSTI, and embodies substantial creative efforts as well as confidential
15 information, ideas, and expressions.
16 
17  Permission to use, and copy this software and its documentation for any
18 purpose is hereby granted per the Distribution Agreement and/or the Licensing
19 Agreement signed with DiSTI. This permission is granted provided that:
20  1. The above copyright notice appears in all copies.
21  2. That both the copyright notice and this permission notice appear in
22  the supporting documentation.
23  3. That the names DiSTI and GL Studio not be used in advertising or
24  publicity pertaining to distribution of the software without specific,
25  written prior permission of DiSTI.
26 
27  Permission to modify the software is granted, but not the right to
28 distribute the source code whether modified, or non-modified. Modifying the
29 software might invalidate the DO-178B certification package.
30 
31  Permission to distribute binaries produced by compiling source code, or
32 modified source code is granted, provided you:
33  1. Provide your name and address as the primary contact for the support
34  of your modified version.
35  2. Retain our contact information in regard to use of the base software.
36 
37  DiSTI does not provide warranty for this software or guarantee that it
38 satisfies any specification or requirement unless otherwise stated in a
39 specific contractual arrangement between the customer and DiSTI.
40 
41 */
42 
43 #include "gls_include.h"
44 #include "gls_render_object.h"
45 #include "gls_vertex.h"
47 #include "gls_state_manager.h"
48 #include "gls_class_invariant.h"
49 
50 /** The GlsPolygon abstracts an ordered set of two or more textured
51  * vertices.
52  * \invariant base class invariant holds,
53  * _vertices.Invariant()
54  */
56 {
57 public:
59 
60  /** initialization parameters for the GlsPolygon */
62  {
63  const GlsRenderObject::InitParameters renderInitParameters; /**< base class initialization */
64 
66 
67  #if defined( GLS_DEBUG )
68  /** Determine if the initialization parameters are valid ( GLS_DEBUG only )
69  * \return GLS_TRUE if valid else GLS_FALSE
70  * \pre none
71  * \post none
72  */
73  GlsBool IsValid( void ) const;
74  #endif // GLS_DEBUG
75  };
76 
77  /** Constructor - create instance
78  * \param initParameters initialization parametets
79  * \param eventDispatcher event dispatcher for this object else GLS_NULL
80  * \pre initParameters.IsValid()
81  * \post instance created
82  */
83  GlsPolygon( const InitParameters &initParameters, GlsEventDispatcher* const eventDispatcher );
84 
85  /** Draws this polygon
86  * \param gl GL State manager for OpenGL into which polygon is drawn
87  * \param time the elaspsed time in seconds since program start
88  * \pre time >= 0.0
89  * \post polygon is drawn to OpenGL if visible and not blinked off
90  */
91  virtual void Draw( GlsStateManager &gl, const GlsFloat64 time );
92 
93  /** Offset the texture on the object
94  * \param offset x, y offset for texture
95  * \pre offset.IsValid()
96  * \post offset is added to the texture coordinates
97  */
98  virtual void OffsetTexture( const GlsVector2D &offset );
99 
100  /** Set one of the vertices in the polygon
101  * \param index index of desired vertex
102  * \param vertex new value of desired vertex
103  * \pre index is less than the number of vertices in the polygon,
104  * vertex.IsValid()
105  * \post vertex at desired index has new value
106  */
107  void SetVertex( const GlsUInt32 index, const GlsTextureVertex &vertex );
108 
109 protected:
110  GlsTextureVertexArray _vertices; /**< array of vertices for polygon */
111 
112  /** Destructor - shall never be called
113  * \pre none
114  * \post none
115  */
116  virtual ~GlsPolygon();
117 
118 private:
119  typedef GlsRenderObject _BaseClass; /**< base class alias */
120 
121  // Disable implicit generated Members
122  GlsPolygon& operator=( const GlsPolygon &rhs );
123  GlsPolygon( const GlsPolygon &src );
124 };
125 
126 #endif // _GLS_POLYGON_H
Definition: gls_render_object.h:69
bool GlsBool
Definition: gls_types.h:96
#define GLS_CLASS_INVARIANT_DECLARATION(ClassName)
Definition: gls_class_invariant.h:80
Definition: gls_state_manager.h:63
Definition: gls_texture_vertex_array.h:61
This header defines GlsTextureVertexArray which encapsulates an array of GlsTextureVertex 's in the G...
void SetVertex(const GlsUInt32 index, const GlsTextureVertex &vertex)
GlsPolygon(const InitParameters &initParameters, GlsEventDispatcher *const eventDispatcher)
virtual void Draw(GlsStateManager &gl, const GlsFloat64 time)
unsigned int GlsUInt32
Definition: gls_types.h:73
This header defines the GL State Manager class for managing the GL state in the GL Studio DO-178B Run...
virtual ~GlsPolygon()
Definition: gls_event.h:304
This header defines any preprocessor defines needed to configure the GL Studio DO-178B Runtime Librar...
This header defines an abstract class for a display object that is directly rendered to OpenGL (not a...
This header defines a GLS_DEBUG only macro for facilitating evaluating class invariants in the GL Stu...
GlsTextureVertexArray _vertices
Definition: gls_polygon.h:110
double GlsFloat64
Definition: gls_types.h:87
Definition: gls_render_object.h:82
Definition: gls_vertex.h:49
virtual void OffsetTexture(const GlsVector2D &offset)
const GlsTextureVertexArray::InitParameters verticesInitParameters
Definition: gls_polygon.h:65
Definition: gls_polygon.h:61
const GlsRenderObject::InitParameters renderInitParameters
Definition: gls_polygon.h:63
Definition: gls_texture_vertex_array.h:55
Definition: gls_vertex.h:116
This header defines classes for working with 2D and 3D vectors, vertices and textured vertices in the...
Definition: gls_polygon.h:55