GL Studio SCECpp Runtime Library
gls_texture_palette.h
Go to the documentation of this file.
1 #ifndef _GLS_TEXTURE_PALETTE_H
2 #define _GLS_TEXTURE_PALETTE_H
3 
4 /*! \file gls_texture_palette.h
5 \brief This header defines the GlsTexturePalette class used 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_state_manager.h"
45 #include "gls_pointer_array.h"
46 #include "gls_image.h"
47 #include "gls_class_invariant.h"
48 
49 /** Stores a list of textures, each with its own
50  * texture handle. This allows the textures to be stored separately from the
51  * objects, which allows multiple objects to share the same textures.
52  * \invariant _imagePointers.Invariant(), invariant of each image in the arrray
53  */
55 {
56 public:
58 
59  /** intialization parameters for GlsTexturePalette */
61  {
62  const GlsUInt32 numInlineImages; /**< number of inline images in inlineImages array */
63  const GlsImage::InlineImage* const *inlineImages; /**< array of inline images to be inserted in palette
64  * else GLS_NULL if numInlineImages == 0, array can contain
65  * GLS_NULL entries for empty texture palette slots */
66 
67  #if defined( GLS_DEBUG )
68  /** Determine if the init 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  /** texture index used to indicate that an object does not have a texture */
79 
80  /** Create a new texture palette with the indicated number of entries
81  * \param initParameters initialization parameters for texture palette
82  * \pre initParameters.IsValid()
83  * \post object constructed
84  */
85  GlsTexturePalette( const InitParameters& initParameters );
86 
87  /** Destructor - shall never be called
88  * \pre none
89  * \post none
90  */
91  virtual ~GlsTexturePalette();
92 
93  /** Bind the texture at the given index, unless it is already bound. Set
94  * as the texture to be used for texturing polygons
95  * \param gl OpenGL State Manager to bind texture in
96  * \param index index < GetSize(), index != NO_TEXTURE, entry at index is _not_ GLS_NULL
97  * \pre index < GetSize(), index != NO_TEXTURE, entry at index is _not_ GLS_NULL
98  * \post texture at given index is bound to OpenGL
99  */
100  void BindTexture( GlsStateManager &gl, const GlsUInt32 index ) const;
101 
102  #if defined( GLS_DEBUG )
103  /** Get the number of entries in the texture palette ( GLS_DEBUG only )
104  * \return number of entries in the texture palette
105  * \pre none
106  * \post none
107  */
108  GlsUInt32 GetSize( void ) const;
109  #endif // GLS_DEBUG
110 
111 protected:
112  GlsPointerArray _imagePointers; /**< array of image pointers */
113 
114 private:
115  // Disable implicit generated Members
116  GlsTexturePalette& operator=( const GlsTexturePalette &rhs );
117  GlsTexturePalette( const GlsTexturePalette &src );
118 };
119 
120 #endif // _GLS_TEXTURE_PALETTE_H
This header defines GlsPointerArray which encapsulates an array of pointers in the GL Studio DO-178B ...
bool GlsBool
Definition: gls_types.h:96
Definition: gls_texture_palette.h:60
#define GLS_CLASS_INVARIANT_DECLARATION(ClassName)
Definition: gls_class_invariant.h:80
Definition: gls_state_manager.h:63
Definition: gls_pointer_array.h:51
GlsTexturePalette(const InitParameters &initParameters)
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...
This header defines any preprocessor defines needed to configure the GL Studio DO-178B Runtime Librar...
virtual ~GlsTexturePalette()
Definition: gls_texture_palette.h:54
const GlsUInt32 numInlineImages
Definition: gls_texture_palette.h:62
GlsPointerArray _imagePointers
Definition: gls_texture_palette.h:112
#define GLSUINT32_MAX
Definition: gls_types.h:75
const GlsImage::InlineImage *const * inlineImages
Definition: gls_texture_palette.h:63
This header defines a GLS_DEBUG only macro for facilitating evaluating class invariants in the GL Stu...
void BindTexture(GlsStateManager &gl, const GlsUInt32 index) const
This header defines the GlsImage class which encapsulates textures in the GL Studio DO-178B Runtime L...
static const GlsUInt32 NO_TEXTURE
Definition: gls_texture_palette.h:78
Definition: gls_image.h:90