Torque3D Documentation / _generateds / terrFeatureHLSL.h

terrFeatureHLSL.h

Engine/source/terrain/hlsl/terrFeatureHLSL.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 _TERRFEATUREHLSL_H_
 25#define _TERRFEATUREHLSL_H_
 26
 27#ifndef _SHADERGEN_HLSL_SHADERFEATUREHLSL_H_
 28#include "shaderGen/HLSL/shaderFeatureHLSL.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 TerrainFeatHLSL : public ShaderFeatureHLSL
 38{
 39protected:
 40
 41   ShaderIncludeDependency mTorqueDep;
 42
 43public:
 44   TerrainFeatHLSL();
 45   Var* _getInDetailCoord(Vector<ShaderComponent*> &componentList );
 46
 47   Var* _getInMacroCoord(Vector<ShaderComponent*> &componentList );
 48
 49   Var* _getNormalMapTex();
 50
 51   static Var* _getUniformVar( const char *name, const char *type, ConstantSortPosition csp );
 52
 53   Var* _getDetailIdStrengthParallax();
 54   Var* _getMacroIdStrengthParallax();
 55
 56};
 57
 58
 59class TerrainBaseMapFeatHLSL : public TerrainFeatHLSL
 60{
 61public:
 62
 63   virtual void processVert( Vector<ShaderComponent*> &componentList,
 64                             const MaterialFeatureData &fd );
 65
 66   virtual void processPix( Vector<ShaderComponent*> &componentList, 
 67                            const MaterialFeatureData &fd );
 68          
 69   virtual Resources getResources( const MaterialFeatureData &fd );
 70
 71   virtual String getName() { return "Terrain Base Texture"; }
 72
 73   virtual U32 getOutputTargets( const MaterialFeatureData &fd ) const;
 74};
 75
 76
 77class TerrainDetailMapFeatHLSL : public TerrainFeatHLSL
 78{
 79protected:
 80
 81   ShaderIncludeDependency mTorqueDep;
 82   ShaderIncludeDependency mTerrainDep;
 83
 84public:
 85
 86   TerrainDetailMapFeatHLSL();
 87
 88   virtual void processVert(  Vector<ShaderComponent*> &componentList,
 89                              const MaterialFeatureData &fd );
 90
 91   virtual void processPix(   Vector<ShaderComponent*> &componentList, 
 92                              const MaterialFeatureData &fd );
 93
 94   virtual Resources getResources( const MaterialFeatureData &fd );
 95
 96   virtual String getName() { return "Terrain Detail Texture"; }
 97
 98   virtual U32 getOutputTargets( const MaterialFeatureData &fd ) const;
 99};
100
101
102class TerrainMacroMapFeatHLSL : public TerrainFeatHLSL
103{
104protected:
105
106   ShaderIncludeDependency mTorqueDep;
107   ShaderIncludeDependency mTerrainDep;
108
109public:
110
111   TerrainMacroMapFeatHLSL();
112
113   virtual void processVert(  Vector<ShaderComponent*> &componentList,
114                              const MaterialFeatureData &fd );
115
116   virtual void processPix(   Vector<ShaderComponent*> &componentList, 
117                              const MaterialFeatureData &fd );
118
119   virtual Resources getResources( const MaterialFeatureData &fd );
120
121   virtual String getName() { return "Terrain Macro Texture"; }
122
123   virtual U32 getOutputTargets( const MaterialFeatureData &fd ) const;
124};
125
126
127class TerrainNormalMapFeatHLSL : public TerrainFeatHLSL
128{
129public:
130
131   virtual void processVert(  Vector<ShaderComponent*> &componentList,
132                              const MaterialFeatureData &fd );
133
134   virtual void processPix(   Vector<ShaderComponent*> &componentList, 
135                              const MaterialFeatureData &fd );
136
137   virtual Resources getResources( const MaterialFeatureData &fd );
138
139   virtual String getName() { return "Terrain Normal Texture"; }
140};
141
142class TerrainLightMapFeatHLSL : public TerrainFeatHLSL
143{
144public:
145
146   virtual void processPix( Vector<ShaderComponent*> &componentList, 
147                            const MaterialFeatureData &fd );
148          
149   virtual Resources getResources( const MaterialFeatureData &fd );
150
151   virtual String getName() { return "Terrain Lightmap Texture"; }
152};
153
154
155class TerrainAdditiveFeatHLSL : public TerrainFeatHLSL
156{
157public:
158
159   virtual void processPix( Vector<ShaderComponent*> &componentList, 
160                            const MaterialFeatureData &fd );
161
162   virtual String getName() { return "Terrain Additive"; }
163};
164
165class TerrainBlankInfoMapFeatHLSL : public TerrainFeatHLSL
166{
167public:
168
169   virtual void processPix(Vector<ShaderComponent*> &componentList,
170      const MaterialFeatureData &fd);
171   
172   virtual U32 getOutputTargets(const MaterialFeatureData &fd) const;
173   virtual String getName() { return "Blank Matinfo map"; }
174};
175
176#endif // _TERRFEATUREHLSL_H_
177