GL Studio Safety Critical Embedded C++ Runtime Library
gls_vertex.h
Go to the documentation of this file.
1#ifndef _GLS_VERTEX_H
2#define _GLS_VERTEX_H
3
4/*! \file gls_vertex.h
5\brief This header defines classes for working with 2D and 3D vectors,
6 vertices and textured vertices in
7 the GL Studio DO-178B Runtime Library.
8
9\par Copyright Information
10Copyright (C) 1999-2012 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*/
43
44#include "gls_include.h"
45#include "gls_types.h"
46#include "gls_color.h"
47
48/** A 2D coordinate */
50{
51 GlsFloat32 x; /**< x coordinate */
52 GlsFloat32 y; /**< y coordinate */
53
54 #if defined( GLS_DEBUG )
55 /** Determine if this 2D vector has valid components
56 * \return GLS_TRUE if valid else GLS_FALSE
57 * \pre none
58 * \post none
59 */
60 GlsBool IsValid( void ) const;
61 #endif // GLS_DEBUG
62};
63
64/** A 3D coordinate */
66{
67 GlsFloat32 x; /**< x coordinate */
68 GlsFloat32 y; /**< y coordinate */
69 GlsFloat32 z; /**< z coordinate */
70
71 #if defined( GLS_DEBUG )
72 /** Determine if this 3D vector has valid components
73 * \return GLS_TRUE if valid else GLS_FALSE
74 * \pre none
75 * \post none
76 */
77 GlsBool IsValid( void ) const;
78 #endif // GLS_DEBUG
79};
80
81/** A homogeneous 3D coordinate */
83{
84 GlsFloat32 x; /**< x coordinate */
85 GlsFloat32 y; /**< y coordinate */
86 GlsFloat32 z; /**< z coordinate */
87 GlsFloat32 w; /**< w coordinate */
88
89 #if defined( GLS_DEBUG )
90 /** Determine if this homogeneous 3D vector has valid components
91 * \return GLS_TRUE if valid else GLS_FALSE
92 * \pre none
93 * \post none
94 */
95 GlsBool IsValid( void ) const;
96 #endif // GLS_DEBUG
97};
98
99/** A 3D coordinate in space with an RGBA color value */
101{
102 GlsVector3D coordinate; /**< 3D coordinate */
103 GlsColor color; /**< color associated with the coordinate */
104
105 #if defined( GLS_DEBUG )
106 /** Determine if this vertex is valid
107 * \pre none
108 * \post none
109 * \return GLS_TRUE if valid else GLS_FALSE
110 */
111 GlsBool IsValid( void ) const;
112 #endif // GLS_DEBUG
113};
114
115/** A vertex with its corresponding texture coordinate */
117{
118 GlsVertex vertex; /**< coord, color */
119 GlsVector2D textureCoordinate; /**< texture coordinate */
120
121 #if defined( GLS_DEBUG )
122 /** Determine if this texture vertex has valid components
123 * \return GLS_TRUE if valid else GLS_FALSE
124 * \pre none
125 * \post none
126 */
127 GlsBool IsValid( void ) const;
128 #endif // GLS_DEBUG
129};
130
131#if defined( GLS_DEBUG )
132#pragma BullseyeCoverage save off
133/* Determine if this 2D vector has valid components ( GLS_DEBUG only )
134 * \return GLS_TRUE if valid else GLS_FALSE
135 * \pre none
136 * \post none
137 */
138inline GlsBool GlsVector2D::IsValid( void ) const
139{
140 return( GlsFloatIsValid( x ) && GlsFloatIsValid( y ) );
141}
142#pragma BullseyeCoverage restore
143#endif // GLS_DEBUG
144
145#if defined( GLS_DEBUG )
146#pragma BullseyeCoverage save off
147/* Determine if this 3D vector has valid components ( GLS_DEBUG only )
148 * \return GLS_TRUE if valid else GLS_FALSE
149 * \pre none
150 * \post none
151 */
152inline GlsBool GlsVector3D::IsValid( void ) const
153{
154 return( GlsFloatIsValid( x ) && GlsFloatIsValid( y ) && GlsFloatIsValid( z ) );
155}
156#pragma BullseyeCoverage restore
157#endif // GLS_DEBUG
158
159#if defined( GLS_DEBUG )
160#pragma BullseyeCoverage save off
161/* Determine if this homogeneous 3D vector has valid components ( GLS_DEBUG only )
162 * \return GLS_TRUE if valid else GLS_FALSE
163 * \pre none
164 * \post none
165 */
166inline GlsBool GlsHomogeneousVector3D::IsValid( void ) const
167{
168 return( GlsFloatIsValid( x ) && GlsFloatIsValid( y ) && GlsFloatIsValid( z ) && GlsFloatIsValid( w ) );
169}
170#pragma BullseyeCoverage restore
171#endif // GLS_DEBUG
172
173#if defined( GLS_DEBUG )
174#pragma BullseyeCoverage save off
175/* Determine if this vertex is valid ( GLS_DEBUG only )
176 * \pre none
177 * \post none
178 * \return GLS_TRUE if valid else GLS_FALSE
179 */
180inline GlsBool GlsVertex::IsValid( void ) const
181{
182 return( coordinate.IsValid() && color.IsValid() );
183}
184#pragma BullseyeCoverage restore
185#endif // GLS_DEBUG
186
187#if defined( GLS_DEBUG )
188#pragma BullseyeCoverage save off
189/* Determine if this texture vertex has valid components ( GLS_DEBUG only )
190 * \return GLS_TRUE if valid else GLS_FALSE
191 * \pre none
192 * \post none
193 */
194inline GlsBool GlsTextureVertex::IsValid( void ) const
195{
196 return( vertex.IsValid() && textureCoordinate.IsValid() );
197}
198#pragma BullseyeCoverage restore
199#endif // GLS_DEBUG
200
201#endif // _GLS_VERTEX_H
This header defines a 4 component RGBA color for use in the GL Studio DO-178B Runtime Library.
This header defines any preprocessor defines needed to configure the GL Studio DO-178B Runtime Librar...
This header defines the basic types used by the GL Studio DO-178B Runtime Library.
bool GlsBool
Definition: gls_types.h:96
float GlsFloat32
Definition: gls_types.h:78
Definition: gls_color.h:48
Definition: gls_vertex.h:83
GlsFloat32 y
Definition: gls_vertex.h:85
GlsFloat32 w
Definition: gls_vertex.h:87
GlsFloat32 x
Definition: gls_vertex.h:84
GlsFloat32 z
Definition: gls_vertex.h:86
Definition: gls_vertex.h:117
GlsVector2D textureCoordinate
Definition: gls_vertex.h:119
GlsVertex vertex
Definition: gls_vertex.h:118
Definition: gls_vertex.h:50
GlsFloat32 y
Definition: gls_vertex.h:52
GlsFloat32 x
Definition: gls_vertex.h:51
Definition: gls_vertex.h:66
GlsFloat32 y
Definition: gls_vertex.h:68
GlsFloat32 z
Definition: gls_vertex.h:69
GlsFloat32 x
Definition: gls_vertex.h:67
Definition: gls_vertex.h:101
GlsColor color
Definition: gls_vertex.h:103
GlsVector3D coordinate
Definition: gls_vertex.h:102