GL Studio C++ Runtime API
gls_es20_effect_factory_interface.h
Go to the documentation of this file.
1 /*! \file
2  \brief IGlsEffectFactory, interface to a factory for creating GlsEffect objects
3 
4  \par Copyright Information
5 
6  Copyright (c) 2017 by The DiSTI Corporation.<br>
7  11301 Corporate Blvd; Suite 100<br>
8  Orlando, Florida 32817<br>
9  USA<br>
10  <br>
11  All rights reserved.<br>
12 
13  This Software contains proprietary trade secrets of DiSTI and may not be
14 reproduced, in whole or part, in any form, or by any means of electronic,
15 mechanical, or otherwise, without the written permission of DiSTI. Said
16 permission may be derived through the purchase of applicable DiSTI product
17 licenses which detail the distribution rights of this content and any
18 Derivative Works based on this or other copyrighted DiSTI Software.
19 
20  NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21 AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22 PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23 AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24 IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25 PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26 
27  LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28 IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29 INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30 DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31 INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32 INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33 OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34 EXCEED FIVE DOLLARS (US$5.00).
35 
36  The aforementioned terms and restrictions are governed by the laws of the
37 State of Florida and the United States of America. Use, distribution,
38 duplication, or disclosure by the U. S. Government is subject to
39 "Restricted Rights" as set forth in DFARS 252.227-7014(c)(1)(ii).
40 
41 */
42 
43 #ifndef DISTI_GLS_ES20_EFFECT_FACTORY_INTERFACE_H_INCLUDED
44 #define DISTI_GLS_ES20_EFFECT_FACTORY_INTERFACE_H_INCLUDED
45 
46 #include "gls_es20_effect.h"
47 
48 namespace disti
49 {
50 /** \interface IGlsEffectFactory
51  * The interface to a factory for creating GlsEffect objects.
52  * Holds the standard and custom shaders, compiles effects,
53  * and maintains a list of effects for quick access.
54  */
56 {
57 public:
58  /** type of shader features bitfield */
59  typedef unsigned int ShaderBitfieldT;
60 
61  /** enumeration for bitfield describing shader capability */
63  {
64  SHADER_LIGHTING_BIT = 1 << 0,
65  SHADER_CLIP_PLANES_BIT = 1 << 1,
66  SHADER_TEXTURE_BLEND_BIT = 1 << 2,
67  SHADER_TEXTURE_MODULATE_BIT = 1 << 3,
68  SHADER_TEXTURE_ALPHA_BIT = 1 << 4,
69  SHADER_TEXTURE_REPLACE_BIT = 1 << 5,
70  SHADER_TEXTURE_REPLACE_RGB_BIT = 1 << 6,
71  SHADER_ALPHA_TEST_BIT = 1 << 7,
72  SHADER_TEXTURE_DECAL_BIT = 1 << 8,
73 
74  SHADER_DIFFUSE_MAP_BIT = 1 << 10,
75  SHADER_DIFFUSE_UVW_BIT = 1 << 11,
76 
77  SHADER_LIGHT_1_POINT = 1 << 20,
78  SHADER_LIGHT_2_POINT = 1 << 21,
79  SHADER_LIGHT_3_POINT = 1 << 22,
80  SHADER_LIGHT_4_POINT = 1 << 23,
81  SHADER_LIGHT_5_POINT = 1 << 24,
82  SHADER_LIGHT_6_POINT = 1 << 25,
83  SHADER_LIGHT_7_POINT = 1 << 26,
84  SHADER_LIGHT_8_POINT = 1 << 27,
85 
86  SHADER_NUM_LIGHTS_FIELD_OFFSET = 28, // Field of 4 bits starting at the offset
87  SHADER_NUM_LIGHTS_1 = 1 << SHADER_NUM_LIGHTS_FIELD_OFFSET,
88  SHADER_NUM_LIGHTS_2 = 2 << SHADER_NUM_LIGHTS_FIELD_OFFSET,
89  SHADER_NUM_LIGHTS_3 = 3 << SHADER_NUM_LIGHTS_FIELD_OFFSET,
90  SHADER_NUM_LIGHTS_4 = 4 << SHADER_NUM_LIGHTS_FIELD_OFFSET,
91  SHADER_NUM_LIGHTS_5 = 5 << SHADER_NUM_LIGHTS_FIELD_OFFSET,
92  SHADER_NUM_LIGHTS_6 = 6 << SHADER_NUM_LIGHTS_FIELD_OFFSET,
93  SHADER_NUM_LIGHTS_7 = 7 << SHADER_NUM_LIGHTS_FIELD_OFFSET,
94  SHADER_NUM_LIGHTS_8 = 8 << SHADER_NUM_LIGHTS_FIELD_OFFSET
95  };
96 
97  /** enumeration for bitfield describing max-like shader capability */
99  {
100  MAXLIKE_SHADER_VERTEX_COLOR_BIT = 1 << 9,
101 
102  MAXLIKE_SHADER_DIFFUSE_MAP_BIT = 1 << 10,
103  MAXLIKE_SHADER_DIFFUSE_UVW_BIT = 1 << 11,
104  MAXLIKE_SHADER_DIFFUSE_AMOUNT_BIT = 1 << 12,
105  MAXLIKE_SHADER_NORMAL_MAP_BIT = 1 << 13,
106  MAXLIKE_SHADER_NORMAL_UVW_BIT = 1 << 14,
107  MAXLIKE_SHADER_NORMAL_AMOUNT_BIT = 1 << 15,
108  MAXLIKE_SHADER_NORMAL_FLIP_G_BIT = 1 << 16,
109  MAXLIKE_SHADER_SPECULAR_MAP_BIT = 1 << 17,
110  MAXLIKE_SHADER_SPECULAR_UVW_BIT = 1 << 18,
111  MAXLIKE_SHADER_REFLECTION_MAP_BIT = 1 << 19,
112 
113  MAXLIKE_SHADER_LIGHT_1_POINT = 1 << 20,
114  MAXLIKE_SHADER_LIGHT_2_POINT = 1 << 21,
115  MAXLIKE_SHADER_LIGHT_3_POINT = 1 << 22,
116  MAXLIKE_SHADER_LIGHT_4_POINT = 1 << 23,
117  MAXLIKE_SHADER_LIGHT_5_POINT = 1 << 24,
118  MAXLIKE_SHADER_LIGHT_6_POINT = 1 << 25,
119  MAXLIKE_SHADER_LIGHT_7_POINT = 1 << 26,
120  MAXLIKE_SHADER_LIGHT_8_POINT = 1 << 27,
121 
122  MAXLIKE_SHADER_NUM_LIGHTS_FIELD_OFFSET = 28, // Field of 4 bits starting at the offset
123  MAXLIKE_SHADER_NUM_LIGHTS_1 = 1 << MAXLIKE_SHADER_NUM_LIGHTS_FIELD_OFFSET,
124  MAXLIKE_SHADER_NUM_LIGHTS_2 = 2 << MAXLIKE_SHADER_NUM_LIGHTS_FIELD_OFFSET,
125  MAXLIKE_SHADER_NUM_LIGHTS_3 = 3 << MAXLIKE_SHADER_NUM_LIGHTS_FIELD_OFFSET,
126  MAXLIKE_SHADER_NUM_LIGHTS_4 = 4 << MAXLIKE_SHADER_NUM_LIGHTS_FIELD_OFFSET,
127  MAXLIKE_SHADER_NUM_LIGHTS_5 = 5 << MAXLIKE_SHADER_NUM_LIGHTS_FIELD_OFFSET,
128  MAXLIKE_SHADER_NUM_LIGHTS_6 = 6 << MAXLIKE_SHADER_NUM_LIGHTS_FIELD_OFFSET,
129  MAXLIKE_SHADER_NUM_LIGHTS_7 = 7 << MAXLIKE_SHADER_NUM_LIGHTS_FIELD_OFFSET,
130  MAXLIKE_SHADER_NUM_LIGHTS_8 = 8 << MAXLIKE_SHADER_NUM_LIGHTS_FIELD_OFFSET
131  };
132 
133  /** Return a standard effect with the parameters specified.
134  * This method is called by the state manager automatically in response to standard draw calls.
135  * \param[in] bitfield a bitfield indicating the shader features requested (\see ShaderOptions_e)
136  * \returns An effect that meets the requirements of bitfield.
137  */
138  GLS_EXPORT virtual GlsEffect* GetStdEffect( ShaderBitfieldT bitfield ) = 0;
139 
140  /** Return a max-like effect with the parameters specified.
141  * \param[in] bitfield a bitfield indicating the shader features requested (\see MaxLikeShaderOptions_e)
142  * \returns An effect that meets the requirements of bitfield.
143  */
144  GLS_EXPORT virtual GlsEffect* GetMaxLikeEffect( ShaderBitfieldT bitfield ) = 0;
145 
146  /** Provide custom shaders to create a new effect.
147  * \param[in] vertShader the vertex shader source
148  * \param[in] fragShader the fragment shader source
149  * \returns The effect's ID in the effect factory.
150  */
151  GLS_EXPORT virtual GlsEffect* CreateCustomEffect( const char* vertShader, const char* fragShader ) = 0;
152 
153 protected:
154  /** empty ctor */
155  IGlsEffectFactory( void ) {}
156 
157  /** empty dtor */
159 };
160 
161 } // namespace disti
162 
163 #endif // DISTI_GLS_ES20_EFFECT_FACTORY_INTERFACE_H_INCLUDED
virtual GlsEffect * CreateCustomEffect(const char *vertShader, const char *fragShader)=0
Definition: gls_es20_effect.h:58
~IGlsEffectFactory()
Definition: gls_es20_effect_factory_interface.h:158
Definition: gls_es20_effect_factory_interface.h:55
The disti::GlsEffect class. Holds information pertaining to shader programs and their uniform/attribu...
virtual GlsEffect * GetMaxLikeEffect(ShaderBitfieldT bitfield)=0
IGlsEffectFactory(void)
Definition: gls_es20_effect_factory_interface.h:155
unsigned int ShaderBitfieldT
Definition: gls_es20_effect_factory_interface.h:59
ShaderOptions_e
Definition: gls_es20_effect_factory_interface.h:62
MaxLikeShaderOptions_e
Definition: gls_es20_effect_factory_interface.h:98
virtual GlsEffect * GetStdEffect(ShaderBitfieldT bitfield)=0
Definition: bmpimage.h:46