Torque3D Documentation / _generateds / terrFeatureGLSL.h

terrFeatureGLSL.h

Engine/source/terrain/glsl/terrFeatureGLSL.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 _TERRFEATUREGLSL_H_
 25#define _TERRFEATUREGLSL_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
 34
 35/// A shared base class for terrain features which
 36/// includes some helper functions.
 37class TerrainFeatGLSL : public ShaderFeatureGLSL
 38{
 39protected:
 40   ShaderIncludeDependency mTorqueDep;
 41   
 42public:
 43   TerrainFeatGLSL();
 44   Var* _getInDetailCoord(Vector<ShaderComponent*> &componentList );
 45   
 46   Var* _getInMacroCoord(Vector<ShaderComponent*> &componentList );
 47
 48   Var* _getDetailMapSampler();
 49   Var* _getNormalMapSampler();
 50   Var* _getOrmMapSampler();
 51
 52   static Var* _getUniformVar( const char *name, const char *type, ConstantSortPosition csp );
 53   
 54   Var* _getDetailIdStrengthParallax();
 55   Var* _getMacroIdStrengthParallax();
 56      
 57};
 58
 59
 60class TerrainBaseMapFeatGLSL : public TerrainFeatGLSL
 61{
 62public:
 63
 64   virtual void processVert( Vector<ShaderComponent*> &componentList,
 65                             const MaterialFeatureData &fd );
 66
 67   virtual void processPix( Vector<ShaderComponent*> &componentList, 
 68                            const MaterialFeatureData &fd );
 69          
 70   virtual Resources getResources( const MaterialFeatureData &fd );
 71
 72   virtual String getName() { return "Terrain Base Texture"; }
 73
 74   virtual U32 getOutputTargets( const MaterialFeatureData &fd ) const;
 75};
 76
 77
 78class TerrainDetailMapFeatGLSL : public TerrainFeatGLSL
 79{
 80protected:
 81
 82   ShaderIncludeDependency mTorqueDep;
 83   ShaderIncludeDependency mTerrainDep;
 84
 85public:
 86
 87   TerrainDetailMapFeatGLSL();
 88
 89   virtual void processVert(  Vector<ShaderComponent*> &componentList,
 90                              const MaterialFeatureData &fd );
 91
 92   virtual void processPix(   Vector<ShaderComponent*> &componentList, 
 93                              const MaterialFeatureData &fd );
 94
 95   virtual Resources getResources( const MaterialFeatureData &fd );
 96
 97   virtual String getName() { return "Terrain Detail Texture"; }
 98
 99   virtual U32 getOutputTargets( const MaterialFeatureData &fd ) const;
100};
101
102
103class TerrainMacroMapFeatGLSL : public TerrainFeatGLSL
104{
105protected:
106
107   ShaderIncludeDependency mTorqueDep;
108   ShaderIncludeDependency mTerrainDep;
109
110public:
111
112   TerrainMacroMapFeatGLSL();
113
114   virtual void processVert(  Vector<ShaderComponent*> &componentList,
115                              const MaterialFeatureData &fd );
116
117   virtual void processPix(   Vector<ShaderComponent*> &componentList, 
118                              const MaterialFeatureData &fd );
119
120   virtual Resources getResources( const MaterialFeatureData &fd );
121
122   virtual String getName() { return "Terrain Macro Texture"; }
123
124   virtual U32 getOutputTargets( const MaterialFeatureData &fd ) const;
125};
126
127
128class TerrainNormalMapFeatGLSL : public TerrainFeatGLSL
129{
130public:
131
132   virtual void processVert(  Vector<ShaderComponent*> &componentList,
133                            const MaterialFeatureData &fd );
134   
135   virtual void processPix(   Vector<ShaderComponent*> &componentList, 
136                           const MaterialFeatureData &fd );
137   
138   virtual Resources getResources( const MaterialFeatureData &fd );
139   
140   virtual String getName() { return "Terrain Normal Texture"; }
141};
142
143class TerrainLightMapFeatGLSL : public TerrainFeatGLSL
144{
145public:
146
147   virtual void processPix( Vector<ShaderComponent*> &componentList, 
148                            const MaterialFeatureData &fd );
149          
150   virtual Resources getResources( const MaterialFeatureData &fd );
151
152   virtual String getName() { return "Terrain Lightmap Texture"; }
153};
154
155class TerrainORMMapFeatGLSL : public TerrainFeatGLSL
156{
157public:
158
159   virtual void processVert(Vector<ShaderComponent*> &componentList,
160      const MaterialFeatureData &fd);
161
162   virtual void processPix(Vector<ShaderComponent*> &componentList,
163      const MaterialFeatureData &fd);
164
165   virtual Resources getResources(const MaterialFeatureData &fd);
166
167   virtual U32 getOutputTargets(const MaterialFeatureData &fd) const;
168   virtual String getName() { return "Composite Matinfo map"; }
169};
170
171class TerrainBlankInfoMapFeatGLSL : public ShaderFeatureGLSL
172{
173public:
174
175   virtual void processPix(Vector<ShaderComponent*> &componentList,
176      const MaterialFeatureData &fd);
177
178   virtual U32 getOutputTargets(const MaterialFeatureData &fd) const;
179   virtual String getName() { return "Blank Matinfo map"; }
180};
181
182class TerrainHeightMapBlendGLSL : public TerrainFeatGLSL
183{
184public:
185
186   virtual void processVert(Vector<ShaderComponent*>& componentList,
187      const MaterialFeatureData& fd);
188
189   virtual void processPix(Vector<ShaderComponent*>& componentList,
190      const MaterialFeatureData& fd);
191
192   virtual String getName() { return "Terrain Heightmap Blend"; }
193};
194
195#endif // _TERRFEATUREGLSL_H_
196