GL Studio C++ Runtime API
gls_state_manager_es20_interface.h
Go to the documentation of this file.
1 /*! \file
2  \brief IGlsStateManager, interface to a state manager that manages the GL Studio
3 runtime library's use of the OpenGL context, minimizing unnecessary state changes.
4 
5  \par Copyright Information
6 
7  Copyright (c) 2017 by The DiSTI Corporation.<br>
8  11301 Corporate Blvd; Suite 100<br>
9  Orlando, Florida 32817<br>
10  USA<br>
11  <br>
12  All rights reserved.<br>
13 
14  This Software contains proprietary trade secrets of DiSTI and may not be
15 reproduced, in whole or part, in any form, or by any means of electronic,
16 mechanical, or otherwise, without the written permission of DiSTI. Said
17 permission may be derived through the purchase of applicable DiSTI product
18 licenses which detail the distribution rights of this content and any
19 Derivative Works based on this or other copyrighted DiSTI Software.
20 
21  NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
22 AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
23 PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
24 AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
25 IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
26 PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
27 
28  LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
29 IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
30 INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
31 DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
32 INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
33 INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
34 OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
35 EXCEED FIVE DOLLARS (US$5.00).
36 
37  The aforementioned terms and restrictions are governed by the laws of the
38 State of Florida and the United States of America. Use, distribution,
39 duplication, or disclosure by the U. S. Government is subject to
40 "Restricted Rights" as set forth in DFARS 252.227-7014(c)(1)(ii).
41 
42 */
43 
44 #ifndef DISTI_GLS_STATE_MANAGER_ES20_INTERFACE_H_INCLUDED
45 #define DISTI_GLS_STATE_MANAGER_ES20_INTERFACE_H_INCLUDED
46 
48 
49 #include "gls_es20_effect.h"
50 #include "gls_es20_effect_params.h"
51 
52 #ifndef LESS_MAX_LIGHTS
53 # define MAX_LIGHTS 8
54 #else
55 # define MAX_LIGHTS 6
56 #endif
57 
58 namespace disti
59 {
60 /** \interface IGlsStateManagerES20
61  * The interface to a state manager that manages the GL Studio
62  * runtime library's use of the OpenGL context, minimizing unnecessary state changes,
63  * and has support for managing shaders.
64  */
65 class IGlsStateManagerES20 : virtual public IGlsStateManager
66 {
67 public:
68  /** Structure used to replic8 the Fixed-Function lighting model */
70  {
71  GLfloat _ambient[ 4 ];
72  GLfloat _diffuse[ 4 ];
73  GLfloat _specular[ 4 ];
74  GLfloat _position[ 4 ];
75 
76  GLfloat _spotDirection[ 3 ];
77 
78  float _spotExponent;
79  float _spotCutoff;
80 
81  float _constantAttenuation;
82  float _linearAttenuation;
83  float _quadraticAttenuation;
84  };
85 
86  ////////////////////////////////////////////////////////////////
87  //
88  // Matrix Stack
89  //
90  ////////////////////////////////////////////////////////////////
91  GLS_EXPORT virtual GlsMatrixType& GetTopModelViewMatrix( void ) = 0;
92  GLS_EXPORT virtual GlsMatrixType& GetTopProjMatrix( void ) = 0;
93 
94  ////////////////////////////////////////////////////////////////
95  //
96  // The following methods manage the various OpenGL state calls
97  //
98  ////////////////////////////////////////////////////////////////
99  GLS_EXPORT virtual void TangentArrayEnabled( bool val ) = 0;
100  GLS_EXPORT virtual void BinormalArrayEnabled( bool val ) = 0;
101 
102  GLS_EXPORT virtual void TangentPointer( GLenum type, GLsizei stride, const GLvoid* pointer ) = 0;
103  GLS_EXPORT virtual void BinormalPointer( GLenum type, GLsizei stride, const GLvoid* pointer ) = 0;
104 
105  ////////////////////////////////////////////////////////////////
106  //
107  // The following methods manage the effects
108  //
109  ////////////////////////////////////////////////////////////////
110  GLS_EXPORT virtual gl_LightSourceParameters& GetLightSourceParameters( unsigned int index ) = 0;
111 
112  /** Enable the given custom shader program and push it to the top of the custom shader program stack
113  * \param effect custom shader program
114  * \param useProgramImmediately GL_TRUE if custom shader program should immediately be set as the active
115  * shader program else GL_FALSE to allow the state manager to set the program
116  * active when it is needed
117  * \pre number of custom shader programs is < CUSTOM_SHADER_PROGRAM_STACK_DEPTH
118  * \post the given custom shader program is at the top of the custom shader program stack and is enabled, it
119  * is set to the current active shader program if useProgramImmediately is GL_TRUE
120  */
121  GLS_EXPORT virtual void PushCustomShaderProgram( GlsEffect* effect, const GLboolean useProgramImmediately ) = 0;
122 
123  /** Pop the custom shader program stack enabling the next custom shader program on the stack if there is one
124  * \pre number of custom shader programs is > 0
125  * \post the custom shader program stack is popped enabling the next custom shader program on the stack if there is one
126  */
127  GLS_EXPORT virtual void PopCustomShaderProgram( void ) = 0;
128 
129  /** Returns true if there is at least one custom shader on the stack
130  */
131  GLS_EXPORT virtual bool HasCustomShader( void ) const = 0;
132 
133  /** Select the appropriate shader program based on the current settings and update
134  * the current shader program if needed
135  * \param forceUpdate GL_TRUE to force uniforms to be updated as if shader program changed
136  * \pre none
137  * \post appropriate shader program based on the current settings is active
138  */
139  GLS_EXPORT virtual void UpdateShaderProgram( const GLboolean forceUpdate ) = 0;
140 
141  /** Update the attributes for the current shader as needed
142  * \pre none
143  * \post Appropriate attributes for the current shader are updated
144  */
145  GLS_EXPORT virtual void UpdateShaderAttributes( void ) = 0;
146 
147  /** Update the uniforms for the current shader as needed
148  * \pre none
149  * \post Appropriate uniforms for the current shader are updated
150  */
151  GLS_EXPORT virtual void UpdateShaderUniforms( void ) = 0;
152 
153 protected:
154  /** empty ctor */
156 
157  /** empty dtor */
159 };
160 
161 } // namespace disti
162 
163 #endif // DISTI_GLS_STATE_MANAGER_ES20_INTERFACE_H_INCLUDED
virtual void PushCustomShaderProgram(GlsEffect *effect, const GLboolean useProgramImmediately)=0
Definition: gls_state_manager_es20_interface.h:65
Definition: gls_es20_effect.h:58
IGlsStateManager, interface to a state manager that manages the GL Studio runtime library's use of th...
virtual void UpdateShaderProgram(const GLboolean forceUpdate)=0
The disti::GlsEffect class. Holds information pertaining to shader programs and their uniform/attribu...
Definition: gls_state_manager_interface.h:66
Strings and other standard enumerations used in effects.
Definition: gls_state_manager_es20_interface.h:69
virtual void PopCustomShaderProgram(void)=0
IGlsStateManagerES20(void)
Definition: gls_state_manager_es20_interface.h:155
virtual void UpdateShaderUniforms(void)=0
virtual bool HasCustomShader(void) const =0
Definition: bmpimage.h:46
virtual void UpdateShaderAttributes(void)=0
~IGlsStateManagerES20()
Definition: gls_state_manager_es20_interface.h:158