terrFeatureHLSL.h
Engine/source/terrain/hlsl/terrFeatureHLSL.h
Classes:
class
A shared base class for terrain features which includes some helper functions.
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* _getDetailMapSampler(); 50 Var* _getDetailMapArray(); 51 Var* _getNormalMapSampler(); 52 Var* _getNormalMapArray(); 53 Var* _getOrmMapSampler(); 54 Var* _getOrmMapArray(); 55 Var* _getNormalMapTex(); 56 Var* _getORMConfigMapTex(); 57 58 static Var* _getUniformVar( const char *name, const char *type, ConstantSortPosition csp ); 59 60 Var* _getDetailIdStrengthParallax(); 61 Var* _getMacroIdStrengthParallax(); 62 63}; 64 65 66class TerrainBaseMapFeatHLSL : public TerrainFeatHLSL 67{ 68public: 69 70 virtual void processVert( Vector<ShaderComponent*> &componentList, 71 const MaterialFeatureData &fd ); 72 73 virtual void processPix( Vector<ShaderComponent*> &componentList, 74 const MaterialFeatureData &fd ); 75 76 virtual Resources getResources( const MaterialFeatureData &fd ); 77 78 virtual String getName() { return "Terrain Base Texture"; } 79 80 virtual U32 getOutputTargets( const MaterialFeatureData &fd ) const; 81}; 82 83 84class TerrainDetailMapFeatHLSL : public TerrainFeatHLSL 85{ 86protected: 87 88 ShaderIncludeDependency mTorqueDep; 89 ShaderIncludeDependency mTerrainDep; 90 91public: 92 93 TerrainDetailMapFeatHLSL(); 94 95 virtual void processVert( Vector<ShaderComponent*> &componentList, 96 const MaterialFeatureData &fd ); 97 98 virtual void processPix( Vector<ShaderComponent*> &componentList, 99 const MaterialFeatureData &fd ); 100 101 virtual Resources getResources( const MaterialFeatureData &fd ); 102 103 virtual String getName() { return "Terrain Detail Texture"; } 104 105 virtual U32 getOutputTargets( const MaterialFeatureData &fd ) const; 106}; 107 108 109class TerrainMacroMapFeatHLSL : public TerrainFeatHLSL 110{ 111protected: 112 113 ShaderIncludeDependency mTorqueDep; 114 ShaderIncludeDependency mTerrainDep; 115 116public: 117 118 TerrainMacroMapFeatHLSL(); 119 120 virtual void processVert( Vector<ShaderComponent*> &componentList, 121 const MaterialFeatureData &fd ); 122 123 virtual void processPix( Vector<ShaderComponent*> &componentList, 124 const MaterialFeatureData &fd ); 125 126 virtual Resources getResources( const MaterialFeatureData &fd ); 127 128 virtual String getName() { return "Terrain Macro Texture"; } 129 130 virtual U32 getOutputTargets( const MaterialFeatureData &fd ) const; 131}; 132 133 134class TerrainNormalMapFeatHLSL : public TerrainFeatHLSL 135{ 136public: 137 138 virtual void processVert( Vector<ShaderComponent*> &componentList, 139 const MaterialFeatureData &fd ); 140 141 virtual void processPix( Vector<ShaderComponent*> &componentList, 142 const MaterialFeatureData &fd ); 143 144 virtual Resources getResources( const MaterialFeatureData &fd ); 145 146 virtual String getName() { return "Terrain Normal Texture"; } 147}; 148 149class TerrainLightMapFeatHLSL : public TerrainFeatHLSL 150{ 151public: 152 153 virtual void processPix( Vector<ShaderComponent*> &componentList, 154 const MaterialFeatureData &fd ); 155 156 virtual Resources getResources( const MaterialFeatureData &fd ); 157 158 virtual String getName() { return "Terrain Lightmap Texture"; } 159}; 160 161class TerrainORMMapFeatHLSL : public TerrainFeatHLSL 162{ 163public: 164 165 virtual void processVert(Vector<ShaderComponent*> &componentList, 166 const MaterialFeatureData &fd); 167 168 virtual void processPix(Vector<ShaderComponent*> &componentList, 169 const MaterialFeatureData &fd); 170 171 virtual Resources getResources(const MaterialFeatureData &fd); 172 173 virtual U32 getOutputTargets(const MaterialFeatureData &fd) const; 174 virtual String getName() { return "Composite Matinfo map"; } 175}; 176 177class TerrainBlankInfoMapFeatHLSL : public TerrainFeatHLSL 178{ 179public: 180 181 virtual void processPix(Vector<ShaderComponent*> &componentList, 182 const MaterialFeatureData &fd); 183 184 virtual U32 getOutputTargets(const MaterialFeatureData &fd) const; 185 virtual String getName() { return "Blank Matinfo map"; } 186}; 187 188class TerrainHeightMapBlendHLSL : public TerrainFeatHLSL 189{ 190public: 191 192 virtual void processVert(Vector<ShaderComponent*>& componentList, 193 const MaterialFeatureData& fd); 194 195 virtual void processPix(Vector<ShaderComponent*>& componentList, 196 const MaterialFeatureData& fd); 197 198 virtual String getName() { return "Terrain Heightmap Blend"; } 199}; 200 201#endif // _TERRFEATUREHLSL_H_ 202