OGRE  2.0
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 
34 namespace Ogre {
35 namespace RTShader {
36 
47 class _OgreRTSSExport FFPColour : public SubRenderState
48 {
49 public:
50 
51  // Parameter stage flags of the colour component.
52  enum StageFlags
53  {
54  SF_VS_INPUT_DIFFUSE = 1 << 1,
55  SF_VS_INPUT_SPECULAR = 1 << 2,
56  SF_VS_OUTPUT_DIFFUSE = 1 << 3,
57  SF_VS_OUTPUT_SPECULAR = 1 << 4,
58  SF_PS_INPUT_DIFFUSE = 1 << 5,
59  SF_PS_INPUT_SPECULAR = 1 << 6,
60  SF_PS_OUTPUT_DIFFUSE = 1 << 7,
61  SF_PS_OUTPUT_SPECULAR = 1 << 8
62  };
63 
64 // Interface.
65 public:
66 
68  FFPColour();
69 
70 
74  virtual const String& getType() const;
75 
79  virtual int getExecutionOrder() const;
80 
84  virtual void copyFrom(const SubRenderState& rhs);
85 
89  virtual bool preAddToRenderState(const RenderState* renderState, Pass* srcPass, Pass* dstPass);
90 
97  void setResolveStageFlags(unsigned int flags) { mResolveStageFlags = flags; }
98 
102  unsigned int getResolveStageFlags() const { return mResolveStageFlags; }
103 
108  void addResolveStageMask(unsigned int mask) { mResolveStageFlags |= mask; }
109 
114  void removeResolveStageMask(unsigned int mask) { mResolveStageFlags &= ~mask; }
115 
116  static String Type;
117 
118 // Protected methods
119 protected:
120  virtual bool resolveParameters(ProgramSet* programSet);
121  virtual bool resolveDependencies(ProgramSet* programSet);
122  virtual bool addFunctionInvocations(ProgramSet* programSet);
123 
124 // Attributes.
125 protected:
126  // Vertex shader input diffuse component.
127  ParameterPtr mVSInputDiffuse;
128  // Vertex shader input specular component.
129  ParameterPtr mVSInputSpecular;
130  // Vertex shader output diffuse component.
131  ParameterPtr mVSOutputDiffuse;
132  // Vertex shader input specular component.
133  ParameterPtr mVSOutputSpecular;
134  // Pixel shader input diffuse component.
135  ParameterPtr mPSInputDiffuse;
136  // Pixel shader input specular component.
137  ParameterPtr mPSInputSpecular;
138  // Pixel shader output diffuse component.
139  ParameterPtr mPSOutputDiffuse;
140  // Pixel shader input specular component.
141  ParameterPtr mPSOutputSpecular;
142  // Stage flags that defines resolve parameters definitions.
143  unsigned int mResolveStageFlags;
144 };
145 
146 
151 class _OgreRTSSExport FFPColourFactory : public SubRenderStateFactory
152 {
153 public:
154 
158  virtual const String& getType() const;
159 
163  virtual SubRenderState* createInstance(ScriptCompiler* compiler, PropertyAbstractNode* prop, Pass* pass, SGScriptTranslator* translator);
164 
168  virtual void writeInstance(MaterialSerializer* ser, SubRenderState* subRenderState, Pass* srcPass, Pass* dstPass);
169 
170 
171 protected:
172 
176  virtual SubRenderState* createInstanceImpl();
177 
178 
179 };
180 
184 }
185 }
186 
187 #endif
188 #endif
#define _OgreRTSSExport
SharedPtr< Parameter > ParameterPtr
_StringBase String
Definition: OgreCommon.h:53