Torque3D Documentation / _generateds / accuFeatureGLSL.h

accuFeatureGLSL.h

Engine/source/shaderGen/GLSL/accuFeatureGLSL.h

More...

Classes:

Detailed Description

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2012 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24#ifndef _ACCUFEATUREGLSL_H_
 25#define _ACCUFEATUREGLSL_H_
 26
 27#ifndef _SHADERGEN_GLSL_SHADERFEATUREGLSL_H_
 28#include "shaderGen/GLSL/shaderFeatureGLSL.h"
 29#endif
 30#ifndef _LANG_ELEMENT_H_
 31#include "shaderGen/langElement.h"
 32#endif
 33#ifndef _GFXDEVICE_H_
 34#include "gfx/gfxDevice.h"
 35#endif
 36#ifndef _FEATUREMGR_H_
 37#include "shaderGen/featureMgr.h"
 38#endif
 39#ifndef _MATERIALFEATURETYPES_H_
 40#include "materials/materialFeatureTypes.h"
 41#endif
 42#ifndef _MATERIALFEATUREDATA_H_
 43#include "materials/materialFeatureData.h"
 44#endif
 45
 46/// Accu texture
 47class AccuTexFeatGLSL : public ShaderFeatureGLSL
 48{
 49public:
 50
 51   //****************************************************************************
 52   // Accu Texture
 53   //****************************************************************************
 54   virtual void processVert(  Vector<ShaderComponent*> &componentList, 
 55                              const MaterialFeatureData &fd );
 56
 57   virtual void processPix(   Vector<ShaderComponent*> &componentList, 
 58                              const MaterialFeatureData &fd );
 59
 60   void getAccuVec( MultiLine *meta, LangElement *accuVec );
 61
 62   Var* addOutAccuVec( Vector<ShaderComponent*> &componentList, MultiLine *meta );
 63
 64   virtual Material::BlendOp getBlendOp(){ return Material::LerpAlpha; }
 65
 66   virtual Resources getResources( const MaterialFeatureData &fd )
 67   {
 68      Resources res; 
 69      res.numTex = 1;
 70      res.numTexReg = 1;
 71      return res;
 72   }
 73
 74   virtual void setTexData(   Material::StageData &stageDat,
 75                              const MaterialFeatureData &fd,
 76                              RenderPassData &passData,
 77                              U32 &texIndex );
 78
 79   virtual String getName()
 80   {
 81      return "Accu Texture";
 82   }
 83};
 84
 85class AccuScaleFeature : public ShaderFeatureGLSL
 86{
 87public:
 88   virtual void processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
 89   {
 90      // Find the constant value
 91      Var *accuScale = (Var *)( LangElement::find("accuScale") );
 92      if( accuScale == NULL )
 93      {
 94         accuScale = new Var;
 95         accuScale->setType( "float" );
 96         accuScale->setName( "accuScale" );
 97         accuScale->constSortPos = cspPotentialPrimitive;
 98         accuScale->uniform = true;
 99      }
100   }
101
102   virtual String getName() { return "Accu Scale"; }
103};
104
105class AccuDirectionFeature : public ShaderFeatureGLSL
106{
107public:
108   virtual void processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
109   {
110      // Find the constant value
111      Var *accuDirection = (Var *)( LangElement::find("accuDirection") );
112      if( accuDirection == NULL )
113      {
114         accuDirection = new Var;
115         accuDirection->setType( "float" );
116         accuDirection->setName( "accuDirection" );
117         accuDirection->constSortPos = cspPotentialPrimitive;
118         accuDirection->uniform = true;
119      }
120   }
121
122   virtual String getName() { return "Accu Direction"; }
123};
124
125class AccuStrengthFeature : public ShaderFeatureGLSL
126{
127public:
128   virtual void processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
129   {
130      // Find the constant value
131      Var *accuStrength = (Var *)( LangElement::find("accuStrength") );
132      if( accuStrength == NULL )
133      {
134         accuStrength = new Var;
135         accuStrength->setType( "float" );
136         accuStrength->setName( "accuStrength" );
137         accuStrength->constSortPos = cspPotentialPrimitive;
138         accuStrength->uniform = true;
139      }
140   }
141
142   virtual String getName() { return "Accu Strength"; }
143};
144
145class AccuCoverageFeature : public ShaderFeatureGLSL
146{
147public:
148   virtual void processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
149   {
150      // Find the constant value
151      Var *accuCoverage = (Var *)( LangElement::find("accuCoverage") );
152      if( accuCoverage == NULL )
153      {
154         accuCoverage = new Var;
155         accuCoverage->setType( "float" );
156         accuCoverage->setName( "accuCoverage" );
157         accuCoverage->constSortPos = cspPotentialPrimitive;
158         accuCoverage->uniform = true;
159      }
160   }
161
162   virtual String getName() { return "Accu Coverage"; }
163};
164
165
166class AccuSpecularFeature : public ShaderFeatureGLSL
167{
168public:
169   virtual void processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
170   {
171      // Find the constant value
172      Var *accuSpecular = (Var *)( LangElement::find("accuSpecular") );
173      if( accuSpecular == NULL )
174      {
175         accuSpecular = new Var;
176         accuSpecular->setType( "float" );
177         accuSpecular->setName( "accuSpecular" );
178         accuSpecular->constSortPos = cspPotentialPrimitive;
179         accuSpecular->uniform = true;
180      }
181   }
182
183   virtual String getName() { return "Accu Specular"; }
184};
185
186#endif
187