GL Studio C++ Runtime API
effect_directx_shader.h
1#ifndef INCLUDED_EFFECT_DIRECTX_SHADER_H
2#define INCLUDED_EFFECT_DIRECTX_SHADER_H
3
5#include "file_path_class.h"
6#include "gls_matrix_affine.h"
7#include "gls_render_effect.h"
8#include "material.h"
9
10#include <map>
11
12#ifdef GLES
13# include "gls_state_manager.h"
14#endif
15
16//////////////////// Provides support for creating DLLs ////////////////////////
17#if( defined( GLSGEN_EXPORT_GLSADVANCEDMESH ) || defined( GLSGEN_IMPORT_GLSADVANCEDMESH ) || defined( GLS_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
18 && defined( _MSC_VER )
19# if defined( GLSGEN_EXPORT_GLSADVANCEDMESH ) || defined( GLS_EXPORT_GENERATED )
20# define GLSGEN_GlsAdvancedMesh_EXPORT __declspec( dllexport )
21# else
22# define GLSGEN_GlsAdvancedMesh_EXPORT __declspec( dllimport )
23# endif
24#else
25# define GLSGEN_GlsAdvancedMesh_EXPORT
26#endif
27///////////////////////////////////////////////////////////////////////////////
28
29namespace disti
30{
31/// Render effect that supports DirectX effect scripts. This will not render anything special in the Editor or in the GLStudio runtime;
32/// it only holds the effect configuration for processing by the Lumen converter/generator.
33/// \deprecated The Lumen code generator is deprecated.
35{
36public:
37 static const std::string EFFECT_TYPE_NAME; ///< Backing storage for the human readable string for this effect type.
38
39 FilePathClass* _effectScriptPath; ///< File path to the script for this effect.
40
41 typedef std::map<std::string /* parameter name */, float> FloatParamsT; ///< Typedef for a map between strings and floats.
42 typedef std::map<std::string /* parameter name */, int> IntParamsT; ///< Typedef for a map between strings and ints.
43 typedef std::map<std::string /* parameter name */, GlsColor> ColorParamsT; ///< Typedef for a map between strings and Colors.
44 typedef std::map<std::string /* parameter name */, Vector> VectorParamsT; ///< Typedef for a map between strings and Vectors.
45 typedef std::map<std::string /* parameter name */, bool> BoolParamsT; ///< Typedef for a map between strings and bools.
46
47 FloatParamsT _floatParams; ///< Float parameter storage.
48 IntParamsT _intParams; ///< Int parameter storage.
49 ColorParamsT _colorParams; ///< Color parameter storage.
50 VectorParamsT _vectorParams; ///< Vector parameter storage.
51 BoolParamsT _boolParams; ///< Bool parameter storage.
52 IntParamsT _texture2DIndexParams; ///< 2D texture parameter storage.
53 IntParamsT _textureCUBEIndexParams; ///< Cube map parameter storage.
54
55protected:
56 unsigned int _ref_count; ///< Reference count
57
58 unsigned int _materialIndex; ///< The material index to use
59
60 /** Used for rendering the object in the editor; we'll just set up a basic grey */
62
63 /// Sets up _helperEffect.
64 /// \note Not normally called by users
66
67 DistiAttribDict* _attribDict; ///< The attribute dictionary for this object.
68
69 /// Called to add this object's attributes to the dictionary.
70 /// \note Not normally called by users.
72
73public:
74 static const int INVALID_INDEX = -1; ///< Value to represent an invalid texture index.
75
76 GLSGEN_GlsAdvancedMesh_EXPORT Effect_DirectXShader();
77 GLSGEN_GlsAdvancedMesh_EXPORT ~Effect_DirectXShader();
78
79 /// Copy constructor
80 GLSGEN_GlsAdvancedMesh_EXPORT Effect_DirectXShader( const Effect_DirectXShader& );
81
82 /// Assignment operator
83 /// \return The resulting object (this).
84 GLSGEN_GlsAdvancedMesh_EXPORT const Effect_DirectXShader& operator=( const Effect_DirectXShader& );
85
86 /// Equality operator
87 /// \return Whether or not the objects are the same.
88 GLSGEN_GlsAdvancedMesh_EXPORT bool operator==( const Effect_DirectXShader& ) const;
89
90 /// Inequality operator
91 /// \param o The object to compare to.
92 /// \return Whether or not the objects are not the same.
93 inline bool operator!=( const Effect_DirectXShader& o ) const { return !( *this == o ); }
94
95 /// Set the material index for this effect.
96 /// \param materialIndex The new material index for this effect.
97 inline void SetMaterialIndex( unsigned int materialIndex ) { _materialIndex = materialIndex; }
98
99 /// \return The current material index for this effect.
100 inline unsigned int GetMaterialIndex() const { return _materialIndex; }
101
102 /// Selects the shader to use based on the current effect parameters.
103 /// \note Not normally called by users.
104 GLSGEN_GlsAdvancedMesh_EXPORT void SelectShader();
105
106 /// \return A reference to the effect attribute dictionary.
108 {
109 if( !_attribDict )
110 {
112 }
113 return *_attribDict;
114 }
115
116 /// \return This effect's type as a readable string.
117 inline const std::string& EffectTypeName() DISTI_METHOD_OVERRIDE
118 {
119 return EFFECT_TYPE_NAME;
120 }
121
122 /////////////////////////////////////////////
123 // VertexAttribIndexLookup Interface
124 /////////////////////////////////////////////
125
127
128 ///////////////////////////////////////////////////////////////////////////
129 // GlsRenderEffect overrides
130 ///////////////////////////////////////////////////////////////////////////
133 virtual unsigned int GlsRenderEffect_ClassID() const DISTI_METHOD_OVERRIDE;
134 virtual void SetupEffect(
135 DynamicArray<Material>& materialPalette,
136 TexturePalette* texturePalette,
137 const TextureSettings& textureSettings,
138 float* viewToWorld3x3, // 3x3 matrix (float[9])
139 unsigned int maxLightNum,
140 unsigned int activeLightMask ) DISTI_METHOD_OVERRIDE;
141
143 virtual int Compare( const GlsRenderEffect* ) const DISTI_METHOD_OVERRIDE;
145};
146
147} // namespace disti
148
149#endif
Definition: disti_metadata.h:734
Definition: dynamic_array.h:79
Definition: effect_diff_norm_spec_refl.h:74
Definition: effect_directx_shader.h:35
std::map< std::string, int > IntParamsT
Typedef for a map between strings and ints.
Definition: effect_directx_shader.h:42
virtual void CleanupEffect() DISTI_METHOD_OVERRIDE
Remove the effect trom the OpenGL state.
unsigned int _materialIndex
The material index to use.
Definition: effect_directx_shader.h:58
DistiAttribDict & Attributes() DISTI_METHOD_OVERRIDE
Definition: effect_directx_shader.h:107
VectorParamsT _vectorParams
Vector parameter storage.
Definition: effect_directx_shader.h:50
IntParamsT _texture2DIndexParams
2D texture parameter storage.
Definition: effect_directx_shader.h:52
void SetMaterialIndex(unsigned int materialIndex)
Definition: effect_directx_shader.h:97
std::map< std::string, bool > BoolParamsT
Typedef for a map between strings and bools.
Definition: effect_directx_shader.h:45
unsigned int _ref_count
Reference count.
Definition: effect_directx_shader.h:56
unsigned int GetMaterialIndex() const
Definition: effect_directx_shader.h:100
std::map< std::string, Vector > VectorParamsT
Typedef for a map between strings and Vectors.
Definition: effect_directx_shader.h:44
const Effect_DirectXShader & operator=(const Effect_DirectXShader &)
BoolParamsT _boolParams
Bool parameter storage.
Definition: effect_directx_shader.h:51
static const std::string EFFECT_TYPE_NAME
Backing storage for the human readable string for this effect type.
Definition: effect_directx_shader.h:37
FilePathClass * _effectScriptPath
File path to the script for this effect.
Definition: effect_directx_shader.h:39
bool operator!=(const Effect_DirectXShader &o) const
Definition: effect_directx_shader.h:93
Effect_DiffNormSpecRefl * _helperEffect
Definition: effect_directx_shader.h:61
virtual int Compare(const GlsRenderEffect *) const DISTI_METHOD_OVERRIDE
std::map< std::string, GlsColor > ColorParamsT
Typedef for a map between strings and Colors.
Definition: effect_directx_shader.h:43
virtual void Release() DISTI_METHOD_OVERRIDE
Release a reference to this object.
virtual unsigned int GlsRenderEffect_ClassID() const DISTI_METHOD_OVERRIDE
static const int INVALID_INDEX
Value to represent an invalid texture index.
Definition: effect_directx_shader.h:74
bool operator==(const Effect_DirectXShader &) const
virtual GLint GetVertexAttribIndexForSemantic(int semanticEnum) DISTI_METHOD_OVERRIDE
DistiAttribDict * _attribDict
The attribute dictionary for this object.
Definition: effect_directx_shader.h:67
virtual void AddRef() DISTI_METHOD_OVERRIDE
Add to this object's reference count.
virtual void SetupEffect(DynamicArray< Material > &materialPalette, TexturePalette *texturePalette, const TextureSettings &textureSettings, float *viewToWorld3x3, unsigned int maxLightNum, unsigned int activeLightMask) DISTI_METHOD_OVERRIDE
virtual GlsRenderEffect * Clone() const DISTI_METHOD_OVERRIDE
IntParamsT _textureCUBEIndexParams
Cube map parameter storage.
Definition: effect_directx_shader.h:53
std::map< std::string, float > FloatParamsT
Typedef for a map between strings and floats.
Definition: effect_directx_shader.h:41
ColorParamsT _colorParams
Color parameter storage.
Definition: effect_directx_shader.h:49
FloatParamsT _floatParams
Float parameter storage.
Definition: effect_directx_shader.h:47
const std::string & EffectTypeName() DISTI_METHOD_OVERRIDE
Definition: effect_directx_shader.h:117
IntParamsT _intParams
Int parameter storage.
Definition: effect_directx_shader.h:48
Definition: file_path_class.h:63
Definition: gls_color.h:54
Definition: gls_render_effect.h:136
Definition: gls_render_effect.h:116
Definition: material.h:56
Definition: texture_palette.h:184
Definition: vertex.h:85
Render effect that supports diffuse, normal, specular, and reflection maps.
A class to handle file paths.
#define DISTI_METHOD_OVERRIDE
Macro to wrap the override keyword, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:214
The GlsMatrixAffine class.
The disti::GlsRenderEffect class.
The disti::GlsStateManager factory class. Creates an instance of a state manager that manages the GL ...
The disti::Material class.
Force inclusion of the DirectShow library.
Definition: bmpimage.h:47