GL Studio SCECpp Runtime Library
gls_texture_vertex_array.h
Go to the documentation of this file.
1 #ifndef _GLS_TEXTURE_VERTEX_ARRAY_H
2 #define _GLS_TEXTURE_VERTEX_ARRAY_H
3 
4 /*! \file gls_texture_vertex_array.h
5 
6 \brief This header defines GlsTextureVertexArray which encapsulates an array of
7  GlsTextureVertex 's
8  in the GL Studio DO-178B Runtime Library.
9 
10 \par Copyright Information
11 Copyright (C) 1999-2012 The DiSTI Corporation<br>
12 Orlando, FL USA<br>
13 All rights reserved.<br>
14 
15  This file is copyrighted software and contains proprietary trade secrets of
16 DiSTI, and embodies substantial creative efforts as well as confidential
17 information, ideas, and expressions.
18 
19  Permission to use, and copy this software and its documentation for any
20 purpose is hereby granted per the Distribution Agreement and/or the Licensing
21 Agreement signed with DiSTI. This permission is granted provided that:
22  1. The above copyright notice appears in all copies.
23  2. That both the copyright notice and this permission notice appear in
24  the supporting documentation.
25  3. That the names DiSTI and GL Studio not be used in advertising or
26  publicity pertaining to distribution of the software without specific,
27  written prior permission of DiSTI.
28 
29  Permission to modify the software is granted, but not the right to
30 distribute the source code whether modified, or non-modified. Modifying the
31 software might invalidate the DO-178B certification package.
32 
33  Permission to distribute binaries produced by compiling source code, or
34 modified source code is granted, provided you:
35  1. Provide your name and address as the primary contact for the support
36  of your modified version.
37  2. Retain our contact information in regard to use of the base software.
38 
39  DiSTI does not provide warranty for this software or guarantee that it
40 satisfies any specification or requirement unless otherwise stated in a
41 specific contractual arrangement between the customer and DiSTI.
42 
43 */
44 
45 #include "gls_include.h"
46 #include "gls_vertex.h"
47 #include "gls_class_invariant.h"
48 
49 class GlsStateManager;
50 
51 /** This class encapsulates an array of one or more GlsTextureVertex 's.
52  * \invariant _numVertices > 0, _vertices != GLS_NULL,
53  * every vertex in the array is valid
54  */
56 {
57 public:
59 
60  /** initialization parameters for GlsTextureVertexArray */
62  {
63  const GlsUInt32 numVertices; /**< number of vertices in vertices array ( >0 ) */
64  const GlsTextureVertex* const vertices; /**< initial vertices */
65 
66  #if defined( GLS_DEBUG )
67  /** Determine if the initialization parameters are valid ( GLS_DEBUG only )
68  * \return GLS_TRUE if valid else GLS_FALSE
69  * \pre none
70  * \post none
71  */
72  GlsBool IsValid( void ) const;
73  #endif // GLS_DEBUG
74  };
75 
76  /** Constructor - create an instance
77  * \param initParameters initialization parameters
78  * \pre initParameters.IsValid()
79  * \post instance is created
80  */
81  GlsTextureVertexArray( const InitParameters &initParameters );
82 
83  /** Destructor - shall never be called
84  * \pre none
85  * \post none
86  */
87  virtual ~GlsTextureVertexArray();
88 
89  /** Set a vertex in the array
90  * \param index index to desired vertex to set
91  * \param v new value for vertex
92  * \pre index < number of elements in array, v.IsValid()
93  * \post vertex at given index is set to v
94  */
95  void SetVertex( const GlsUInt32 index, const GlsTextureVertex &v );
96 
97  #if defined( GLS_DEBUG )
98  /** Get a const ref to the vertex at the given index ( GLS_DEBUG only )
99  * \param index index of desired vertex
100  * \return const ref to vertex at given index
101  * \pre index < number of elements in array
102  * \post none
103  */
104  const GlsTextureVertex& GetVertex( const GlsUInt32 index ) const;
105  #endif // GLS_DEBUG
106 
107  #if defined( GLS_DEBUG )
108  /** Get the number of texture vertices in the array ( >0 ) ( GLS_DEBUG only )
109  * \pre none
110  * \post none
111  * \return number of texture vertices in the array ( >0 )
112  */
113  GlsUInt32 GetSize( void ) const;
114  #endif // GLS_DEBUG
115 
116  /** Output the vertices in the array to GL
117  * \param gl GL state manager to receive verts
118  * \param doTextureCoordinates GLS_TRUE to send texture coordinates with each vert else GLS_FALSE
119  * \param doVertexColors GLS_TRUE to send vertex colors with each vert else GLS_FALSE
120  * \pre called inside a GL begin/end pair
121  * \post vertices are output to GL
122  */
123  void OutputVertices( GlsStateManager &gl, const GlsBool doTextureCoordinates, const GlsBool doVertexColors ) const;
124 
125  /** Output three vertices in the array to GL
126  * \param gl GL state manager to receive verts
127  * \param v1Index index of first vertex to send
128  * \param v2Index index of second vertex to send
129  * \param v3Index index of third vertex to send
130  * \param doTextureCoordinates GLS_TRUE to send texture coordinates with each vert else GLS_FALSE
131  * \param doVertexColors GLS_TRUE to send vertex colors with each vert else GLS_FALSE
132  * \pre called inside a GL begin/end pair,
133  * v1Index < _numVertices, v2Index < _numVertices, v3Index < _numVertices
134  * \post vertices are output to GL
135  */
137  const GlsUInt32 v1Index, const GlsUInt32 v2Index, const GlsUInt32 v3Index,
138  const GlsBool doTextureCoordinates, const GlsBool doVertexColors ) const;
139 
140  /** Offset all of texture coordinates in the array by a given 2D vector
141  * \param offset 2D offset vector
142  * \pre offset.IsValid()
143  * \post texture coordinates in the array are offset by the vector
144  */
145  void OffsetTextureCoordinates( const GlsVector2D &offset );
146 
147 protected:
148  const GlsUInt32 _numVertices; /**< number of vertices in vertices array */
149  GlsTextureVertex* const _vertices; /**< array of vertices */
150 
151 private:
152  // Disable implicit generated Members
153  GlsTextureVertexArray& operator=( const GlsTextureVertexArray &rhs );
155 };
156 
157 #endif // _GLS_TEXTURE_VERTEX_ARRAY_H
bool GlsBool
Definition: gls_types.h:96
GlsTextureVertexArray(const InitParameters &initParameters)
#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
void OutputVertices(GlsStateManager &gl, const GlsBool doTextureCoordinates, const GlsBool doVertexColors) const
unsigned int GlsUInt32
Definition: gls_types.h:73
This header defines any preprocessor defines needed to configure the GL Studio DO-178B Runtime Librar...
void OffsetTextureCoordinates(const GlsVector2D &offset)
void OutputTriangle(GlsStateManager &gl, const GlsUInt32 v1Index, const GlsUInt32 v2Index, const GlsUInt32 v3Index, const GlsBool doTextureCoordinates, const GlsBool doVertexColors) const
This header defines a GLS_DEBUG only macro for facilitating evaluating class invariants in the GL Stu...
GlsTextureVertex *const _vertices
Definition: gls_texture_vertex_array.h:149
Definition: gls_vertex.h:49
Definition: gls_texture_vertex_array.h:55
Definition: gls_vertex.h:116
const GlsTextureVertex *const vertices
Definition: gls_texture_vertex_array.h:64
This header defines classes for working with 2D and 3D vectors, vertices and textured vertices in the...
void SetVertex(const GlsUInt32 index, const GlsTextureVertex &v)
virtual ~GlsTextureVertexArray()
const GlsUInt32 numVertices
Definition: gls_texture_vertex_array.h:63
const GlsUInt32 _numVertices
Definition: gls_texture_vertex_array.h:148