GL Studio C++ Runtime API
gls_es20_effect_factory_interface.h
Go to the documentation of this file.
1/// \file gls_es20_effect_factory_interface.h
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/// 12249 Science Drive; Suite 300<br>
8/// Orlando, Florida 32826<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.
38
39#ifndef DISTI_GLS_ES20_EFFECT_FACTORY_INTERFACE_H_INCLUDED
40#define DISTI_GLS_ES20_EFFECT_FACTORY_INTERFACE_H_INCLUDED
41
42#include "gls_es20_effect.h"
43
44namespace disti
45{
46/** \interface IGlsEffectFactory
47 * The interface to a factory for creating GlsEffect objects.
48 * Holds the standard and custom shaders, compiles effects,
49 * and maintains a list of effects for quick access.
50 */
52{
53public:
54 /** type of shader features bitfield */
55 typedef unsigned int ShaderBitfieldT;
56
57 /** enumeration for bitfield describing shader capability */
59 {
60 SHADER_LIGHTING_BIT = 1 << 0,
61 SHADER_CLIP_PLANES_BIT = 1 << 1,
62 SHADER_TEXTURE_BLEND_BIT = 1 << 2,
63 SHADER_TEXTURE_MODULATE_BIT = 1 << 3,
64 SHADER_TEXTURE_ALPHA_BIT = 1 << 4,
65 SHADER_TEXTURE_REPLACE_BIT = 1 << 5,
66 SHADER_TEXTURE_REPLACE_RGB_BIT = 1 << 6,
67 SHADER_ALPHA_TEST_BIT = 1 << 7,
68 SHADER_TEXTURE_DECAL_BIT = 1 << 8,
69
70 SHADER_DIFFUSE_MAP_BIT = 1 << 10,
71 SHADER_DIFFUSE_UVW_BIT = 1 << 11,
72 SHADER_LINE_STIPPLE_BIT = 1 << 12,
73 SHADER_POLYGON_STIPPLE_BIT = 1 << 13,
74
75 SHADER_LIGHT_1_POINT = 1 << 20,
76 SHADER_LIGHT_2_POINT = 1 << 21,
77 SHADER_LIGHT_3_POINT = 1 << 22,
78 SHADER_LIGHT_4_POINT = 1 << 23,
79 SHADER_LIGHT_5_POINT = 1 << 24,
80 SHADER_LIGHT_6_POINT = 1 << 25,
81 SHADER_LIGHT_7_POINT = 1 << 26,
82 SHADER_LIGHT_8_POINT = 1 << 27,
83
84 SHADER_NUM_LIGHTS_FIELD_OFFSET = 28, // Field of 4 bits starting at the offset
85 SHADER_NUM_LIGHTS_1 = 1 << SHADER_NUM_LIGHTS_FIELD_OFFSET,
86 SHADER_NUM_LIGHTS_2 = 2 << SHADER_NUM_LIGHTS_FIELD_OFFSET,
87 SHADER_NUM_LIGHTS_3 = 3 << SHADER_NUM_LIGHTS_FIELD_OFFSET,
88 SHADER_NUM_LIGHTS_4 = 4 << SHADER_NUM_LIGHTS_FIELD_OFFSET,
89 SHADER_NUM_LIGHTS_5 = 5 << SHADER_NUM_LIGHTS_FIELD_OFFSET,
90 SHADER_NUM_LIGHTS_6 = 6 << SHADER_NUM_LIGHTS_FIELD_OFFSET,
91 SHADER_NUM_LIGHTS_7 = 7 << SHADER_NUM_LIGHTS_FIELD_OFFSET,
92 SHADER_NUM_LIGHTS_8 = 8 << SHADER_NUM_LIGHTS_FIELD_OFFSET
93 };
94
95 /** enumeration for bitfield describing max-like shader capability */
97 {
98 MAXLIKE_SHADER_VERTEX_COLOR_BIT = 1 << 9,
99
100 MAXLIKE_SHADER_DIFFUSE_MAP_BIT = 1 << 10,
101 MAXLIKE_SHADER_DIFFUSE_UVW_BIT = 1 << 11,
102 MAXLIKE_SHADER_DIFFUSE_AMOUNT_BIT = 1 << 12,
103 MAXLIKE_SHADER_NORMAL_MAP_BIT = 1 << 13,
104 MAXLIKE_SHADER_NORMAL_UVW_BIT = 1 << 14,
105 MAXLIKE_SHADER_NORMAL_AMOUNT_BIT = 1 << 15,
106 MAXLIKE_SHADER_NORMAL_FLIP_G_BIT = 1 << 16,
107 MAXLIKE_SHADER_SPECULAR_MAP_BIT = 1 << 17,
108 MAXLIKE_SHADER_SPECULAR_UVW_BIT = 1 << 18,
109 MAXLIKE_SHADER_REFLECTION_MAP_BIT = 1 << 19,
110
111 MAXLIKE_SHADER_LIGHT_1_POINT = 1 << 20,
112 MAXLIKE_SHADER_LIGHT_2_POINT = 1 << 21,
113 MAXLIKE_SHADER_LIGHT_3_POINT = 1 << 22,
114 MAXLIKE_SHADER_LIGHT_4_POINT = 1 << 23,
115 MAXLIKE_SHADER_LIGHT_5_POINT = 1 << 24,
116 MAXLIKE_SHADER_LIGHT_6_POINT = 1 << 25,
117 MAXLIKE_SHADER_LIGHT_7_POINT = 1 << 26,
118 MAXLIKE_SHADER_LIGHT_8_POINT = 1 << 27,
119
120 MAXLIKE_SHADER_NUM_LIGHTS_FIELD_OFFSET = 28, // Field of 4 bits starting at the offset
121 MAXLIKE_SHADER_NUM_LIGHTS_1 = 1 << MAXLIKE_SHADER_NUM_LIGHTS_FIELD_OFFSET,
122 MAXLIKE_SHADER_NUM_LIGHTS_2 = 2 << MAXLIKE_SHADER_NUM_LIGHTS_FIELD_OFFSET,
123 MAXLIKE_SHADER_NUM_LIGHTS_3 = 3 << MAXLIKE_SHADER_NUM_LIGHTS_FIELD_OFFSET,
124 MAXLIKE_SHADER_NUM_LIGHTS_4 = 4 << MAXLIKE_SHADER_NUM_LIGHTS_FIELD_OFFSET,
125 MAXLIKE_SHADER_NUM_LIGHTS_5 = 5 << MAXLIKE_SHADER_NUM_LIGHTS_FIELD_OFFSET,
126 MAXLIKE_SHADER_NUM_LIGHTS_6 = 6 << MAXLIKE_SHADER_NUM_LIGHTS_FIELD_OFFSET,
127 MAXLIKE_SHADER_NUM_LIGHTS_7 = 7 << MAXLIKE_SHADER_NUM_LIGHTS_FIELD_OFFSET,
128 MAXLIKE_SHADER_NUM_LIGHTS_8 = 8 << MAXLIKE_SHADER_NUM_LIGHTS_FIELD_OFFSET
129 };
130
131 /** Return a standard effect with the parameters specified.
132 * This method is called by the state manager automatically in response to standard draw calls.
133 * \param[in] bitfield a bitfield indicating the shader features requested (\see ShaderOptions_e)
134 * \returns An effect that meets the requirements of bitfield.
135 */
137
138 /** Return a max-like effect with the parameters specified.
139 * \param[in] bitfield a bitfield indicating the shader features requested (\see MaxLikeShaderOptions_e)
140 * \returns An effect that meets the requirements of bitfield.
141 */
143
144 /** Provide custom shaders to create a new effect.
145 * \param[in] vertShader the vertex shader source
146 * \param[in] fragShader the fragment shader source
147 * \returns The effect's ID in the effect factory.
148 */
149 GLS_EXPORT virtual GlsEffect* CreateCustomEffect( const char* vertShader, const char* fragShader ) = 0;
150
151protected:
152 /** empty ctor */
154
155 /** empty dtor */
157};
158
159} // namespace disti
160
161#endif // DISTI_GLS_ES20_EFFECT_FACTORY_INTERFACE_H_INCLUDED
Definition: gls_es20_effect.h:56
Definition: gls_es20_effect_factory_interface.h:52
MaxLikeShaderOptions_e
Definition: gls_es20_effect_factory_interface.h:97
~IGlsEffectFactory()
Definition: gls_es20_effect_factory_interface.h:156
virtual GlsEffect * GetStdEffect(ShaderBitfieldT bitfield)=0
ShaderOptions_e
Definition: gls_es20_effect_factory_interface.h:59
virtual GlsEffect * CreateCustomEffect(const char *vertShader, const char *fragShader)=0
IGlsEffectFactory()
Definition: gls_es20_effect_factory_interface.h:153
virtual GlsEffect * GetMaxLikeEffect(ShaderBitfieldT bitfield)=0
unsigned int ShaderBitfieldT
Definition: gls_es20_effect_factory_interface.h:55
The disti::GlsEffect class. Holds information pertaining to shader programs and their uniform/attribu...
#define GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:50
Definition: bmpimage.h:46