OGRE  1.9
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreShaderFFPColour.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-2014 Torus Knot Software Ltd
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
14 
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
17 
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 THE SOFTWARE.
25 -----------------------------------------------------------------------------
26 */
27 #ifndef _ShaderFFPColur_
28 #define _ShaderFFPColur_
29 
31 #ifdef RTSHADER_SYSTEM_BUILD_CORE_SHADERS
33 #include "OgreShaderParameter.h"
34 
35 namespace Ogre {
36 namespace RTShader {
37 
48 class _OgreRTSSExport FFPColour : public SubRenderState
49 {
50 public:
51 
52  // Parameter stage flags of the colour component.
53  enum StageFlags
54  {
55  SF_VS_INPUT_DIFFUSE = 1 << 1,
56  SF_VS_INPUT_SPECULAR = 1 << 2,
57  SF_VS_OUTPUT_DIFFUSE = 1 << 3,
58  SF_VS_OUTPUT_SPECULAR = 1 << 4,
59  SF_PS_INPUT_DIFFUSE = 1 << 5,
60  SF_PS_INPUT_SPECULAR = 1 << 6,
61  SF_PS_OUTPUT_DIFFUSE = 1 << 7,
62  SF_PS_OUTPUT_SPECULAR = 1 << 8
63  };
64 
65 // Interface.
66 public:
67 
69  FFPColour();
70 
71 
75  virtual const String& getType() const;
76 
80  virtual int getExecutionOrder() const;
81 
85  virtual void copyFrom(const SubRenderState& rhs);
86 
90  virtual bool preAddToRenderState(const RenderState* renderState, Pass* srcPass, Pass* dstPass);
91 
98  void setResolveStageFlags(unsigned int flags) { mResolveStageFlags = flags; }
99 
103  unsigned int getResolveStageFlags() const { return mResolveStageFlags; }
104 
109  void addResolveStageMask(unsigned int mask) { mResolveStageFlags |= mask; }
110 
115  void removeResolveStageMask(unsigned int mask) { mResolveStageFlags &= ~mask; }
116 
117  static String Type;
118 
119 // Protected methods
120 protected:
121  virtual bool resolveParameters(ProgramSet* programSet);
122  virtual bool resolveDependencies(ProgramSet* programSet);
123  virtual bool addFunctionInvocations(ProgramSet* programSet);
124 
125 // Attributes.
126 protected:
127  // Vertex shader input diffuse component.
128  ParameterPtr mVSInputDiffuse;
129  // Vertex shader input specular component.
130  ParameterPtr mVSInputSpecular;
131  // Vertex shader output diffuse component.
132  ParameterPtr mVSOutputDiffuse;
133  // Vertex shader input specular component.
134  ParameterPtr mVSOutputSpecular;
135  // Pixel shader input diffuse component.
136  ParameterPtr mPSInputDiffuse;
137  // Pixel shader input specular component.
138  ParameterPtr mPSInputSpecular;
139  // Pixel shader output diffuse component.
140  ParameterPtr mPSOutputDiffuse;
141  // Pixel shader input specular component.
142  ParameterPtr mPSOutputSpecular;
143  // Stage flags that defines resolve parameters definitions.
144  unsigned int mResolveStageFlags;
145 };
146 
147 
152 class _OgreRTSSExport FFPColourFactory : public SubRenderStateFactory
153 {
154 public:
155 
159  virtual const String& getType() const;
160 
164  virtual SubRenderState* createInstance(ScriptCompiler* compiler, PropertyAbstractNode* prop, Pass* pass, SGScriptTranslator* translator);
165 
169  virtual void writeInstance(MaterialSerializer* ser, SubRenderState* subRenderState, Pass* srcPass, Pass* dstPass);
170 
171 
172 protected:
173 
177  virtual SubRenderState* createInstanceImpl();
178 
179 
180 };
181 
185 }
186 }
187 
188 #endif
189 #endif
SharedPtr< Parameter > ParameterPtr
#define _OgreRTSSExport
_StringBase String