OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Direct3D11/include/OgreFixedFuncEmuShaderManager.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2011 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __FixedFuncEmuShaderManager_H__
29 #define __FixedFuncEmuShaderManager_H__
30 
31 #include "OgreTextureManager.h"
32 #include "OgreGpuProgramUsage.h"
33 #include "OgreFixedFuncState.h"
34 #include "OgreGpuProgram.h"
35 
36 namespace Ogre
37 {
38  class FixedFuncEmuShaderGenerator;
39 
40  class FixedFuncPrograms
41  {
42  #ifdef OGRE_DEBUG_MODE
43  public:
44  String ShaderSource;
45  #endif
46 
47  protected:
48  // Vertex program details
49  GpuProgramUsage * mVertexProgramUsage;
51  // Fragment program details
52  GpuProgramUsage * mFragmentProgramUsage;
54 
55  FixedFuncState mFixedFuncState;
56  void _setProgramParameter(const GpuProgramType type, const String paramName, const void * value, const size_t sizeInBytes);
57 
58  void _updateParameter( GpuProgramParametersSharedPtr & programParameters, const String paramName, const void * value, const size_t sizeInBytes );
59  void _setProgramintParameter(const GpuProgramType type, const String paramName, const int & value);
60  void _setProgramFloatParameter(const GpuProgramType type, const String paramName, const float & value);
61  void _setProgramMatrix4Parameter(const GpuProgramType type, const String paramName, const Matrix4 & value);
62  void _setProgramColorParameter(const GpuProgramType type, const String paramName, const ColourValue & value);
63  void _setProgramVector3Parameter(const GpuProgramType type, const String paramName, const Vector3 & value);
64  public:
65 
66  class FixedFuncProgramsParameters
67  {
68  public:
71  protected:
75 
76  bool mLightingEnabled;
79 
84  Real mFogEnd;
85 
88 
89  public:
92 
93 
94  const Matrix4 & getWorldMat() const;
95  void setWorldMat(const Matrix4 & val);
96  const Matrix4 & getProjectionMat() const;
97  void setProjectionMat(const Matrix4 & val);
98  const Matrix4 & getViewMat() const;
99  void setViewMat(const Matrix4 & val);
100  const LightList & getLights() const;
101  void setLights(const LightList & val);
102  const FogMode getFogMode() const;
103  void setFogMode(const FogMode val);
104  const ColourValue getFogColour() const;
105  void setFogColour(const ColourValue val);
106  const Real getFogDensitiy() const;
107  void setFogDensitiy(const Real val);
108  const Real getFogStart() const;
109  void setFogStart(const Real val);
110  const Real getFogEnd() const;
111  void setFogEnd(const Real val);
112  const bool getLightingEnabled() const;
113  void setLightingEnabled(const bool val);
114  const ColourValue & getLightAmbient() const;
115  void setLightAmbient(const ColourValue val);
116 
117  const TextureMatrixVector & getTextureMatrices() const;
118  void setTextureMatrix(const size_t index, const Matrix4 & val);
119 
120  void setTextureEnabled(const size_t index, const bool val);
121  bool isTextureStageEnabled(const size_t index) const;
122 
123  };
124 
126  virtual ~FixedFuncPrograms();
133  const FixedFuncState & getFixedFuncState() const;
134  void setFixedFuncState(const FixedFuncState & val);
135 
136  virtual void setFixedFuncProgramsParameters(const FixedFuncProgramsParameters & val) = 0;
137  };
138 
140  {
141  protected:
144 
149 
151 
152  FixedFuncPrograms * _createShaderPrograms(const String & generatorName,
153  const VertexBufferDeclaration & vertexBufferDeclaration,
154  FixedFuncState & fixedFuncState);
155  public:
157  virtual ~FixedFuncEmuShaderManager();
158 
161 
162  FixedFuncPrograms * getShaderPrograms(const String & generatorName,
163  const VertexBufferDeclaration & vertexBufferDeclaration,
164  FixedFuncState & fixedFuncState);
165 
166  };
167 }
168 #endif
GpuProgramUsage * getVertexProgramUsage() const
map< FixedFuncState, VertexBufferDeclaration2FixedFuncProgramsMap >::type State2Declaration2ProgramsMap
const TextureMatrixVector & getTextureMatrices() const
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:78
float Real
Software floating point type.
void setFixedFuncState(const FixedFuncState &val)
std::vector< T, A > type
FogMode
Fog modes.
Definition: OgreCommon.h:122
map< String, FixedFuncEmuShaderGenerator * >::type FixedFuncEmuShaderGeneratorMap
Class representing colour.
GpuProgramType
Enumerates the types of programs which can run on the GPU.
void unregisterGenerator(FixedFuncEmuShaderGenerator *generator)
void _setProgramMatrix4Parameter(const GpuProgramType type, const String paramName, const Matrix4 &value)
SharedPtr< GpuProgramParameters > GpuProgramParametersSharedPtr
Shared pointer used to hold references to GpuProgramParameters instances.
void registerGenerator(FixedFuncEmuShaderGenerator *generator)
void _setProgramParameter(const GpuProgramType type, const String paramName, const void *value, const size_t sizeInBytes)
const FixedFuncState & getFixedFuncState() const
void setTextureEnabled(const size_t index, const bool val)
void _setProgramFloatParameter(const GpuProgramType type, const String paramName, const float &value)
void setFragmentProgramUsage(GpuProgramUsage *val)
FixedFuncPrograms * _createShaderPrograms(const String &generatorName, const VertexBufferDeclaration &vertexBufferDeclaration, FixedFuncState &fixedFuncState)
bool isTextureStageEnabled(const size_t index) const
FixedFuncPrograms * getShaderPrograms(const String &generatorName, const VertexBufferDeclaration &vertexBufferDeclaration, FixedFuncState &fixedFuncState)
map< String, State2Declaration2ProgramsMap >::type Language2State2Declaration2ProgramsMap
void _setProgramColorParameter(const GpuProgramType type, const String paramName, const ColourValue &value)
Class defining a fixed function state.
GpuProgramUsage * getFragmentProgramUsage() const
This class makes the usage of a vertex and fragment programs (low-level or high-level), with a given set of parameters, explicit.
Language2State2Declaration2ProgramsMap mLanguage2State2Declaration2ProgramsMap
map< VertexBufferDeclaration, FixedFuncPrograms * >::type VertexBufferDeclaration2FixedFuncProgramsMap
void setVertexProgramUsage(GpuProgramUsage *val)
void _setProgramintParameter(const GpuProgramType type, const String paramName, const int &value)
std::map< K, V, P, A > type
void setTextureMatrix(const size_t index, const Matrix4 &val)
GpuProgramParametersSharedPtr & getVertexProgramUsageParameters()
_StringBase String
void _updateParameter(GpuProgramParametersSharedPtr &programParameters, const String paramName, const void *value, const size_t sizeInBytes)
void _setProgramVector3Parameter(const GpuProgramType type, const String paramName, const Vector3 &value)
GpuProgramParametersSharedPtr & getFragmentProgramUsageParameters()
virtual void setFixedFuncProgramsParameters(const FixedFuncProgramsParameters &val)=0