terrFeatureGLSL.h
Engine/source/terrain/glsl/terrFeatureGLSL.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 _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* _getNormalMapTex(); 49 50 static Var* _getUniformVar( const char *name, const char *type, ConstantSortPosition csp ); 51 52 Var* _getDetailIdStrengthParallax(); 53 Var* _getMacroIdStrengthParallax(); 54 55}; 56 57 58class TerrainBaseMapFeatGLSL : public TerrainFeatGLSL 59{ 60public: 61 62 virtual void processVert( Vector<ShaderComponent*> &componentList, 63 const MaterialFeatureData &fd ); 64 65 virtual void processPix( Vector<ShaderComponent*> &componentList, 66 const MaterialFeatureData &fd ); 67 68 virtual Resources getResources( const MaterialFeatureData &fd ); 69 70 virtual String getName() { return "Terrain Base Texture"; } 71 72 virtual U32 getOutputTargets( const MaterialFeatureData &fd ) const; 73}; 74 75 76class TerrainDetailMapFeatGLSL : public TerrainFeatGLSL 77{ 78protected: 79 80 ShaderIncludeDependency mTorqueDep; 81 ShaderIncludeDependency mTerrainDep; 82 83public: 84 85 TerrainDetailMapFeatGLSL(); 86 87 virtual void processVert( Vector<ShaderComponent*> &componentList, 88 const MaterialFeatureData &fd ); 89 90 virtual void processPix( Vector<ShaderComponent*> &componentList, 91 const MaterialFeatureData &fd ); 92 93 virtual Resources getResources( const MaterialFeatureData &fd ); 94 95 virtual String getName() { return "Terrain Detail Texture"; } 96 97 virtual U32 getOutputTargets( const MaterialFeatureData &fd ) const; 98}; 99 100 101class TerrainMacroMapFeatGLSL : public TerrainFeatGLSL 102{ 103protected: 104 105 ShaderIncludeDependency mTorqueDep; 106 ShaderIncludeDependency mTerrainDep; 107 108public: 109 110 TerrainMacroMapFeatGLSL(); 111 112 virtual void processVert( Vector<ShaderComponent*> &componentList, 113 const MaterialFeatureData &fd ); 114 115 virtual void processPix( Vector<ShaderComponent*> &componentList, 116 const MaterialFeatureData &fd ); 117 118 virtual Resources getResources( const MaterialFeatureData &fd ); 119 120 virtual String getName() { return "Terrain Macro Texture"; } 121 122 virtual U32 getOutputTargets( const MaterialFeatureData &fd ) const; 123}; 124 125 126class TerrainNormalMapFeatGLSL : public TerrainFeatGLSL 127{ 128public: 129 130 virtual void processVert( Vector<ShaderComponent*> &componentList, 131 const MaterialFeatureData &fd ); 132 133 virtual void processPix( Vector<ShaderComponent*> &componentList, 134 const MaterialFeatureData &fd ); 135 136 virtual Resources getResources( const MaterialFeatureData &fd ); 137 138 virtual String getName() { return "Terrain Normal Texture"; } 139}; 140 141class TerrainLightMapFeatGLSL : public TerrainFeatGLSL 142{ 143public: 144 145 virtual void processPix( Vector<ShaderComponent*> &componentList, 146 const MaterialFeatureData &fd ); 147 148 virtual Resources getResources( const MaterialFeatureData &fd ); 149 150 virtual String getName() { return "Terrain Lightmap Texture"; } 151}; 152 153 154class TerrainAdditiveFeatGLSL : public TerrainFeatGLSL 155{ 156public: 157 158 virtual void processPix( Vector<ShaderComponent*> &componentList, 159 const MaterialFeatureData &fd ); 160 161 virtual String getName() { return "Terrain Additive"; } 162}; 163 164class TerrainBlankInfoMapFeatGLSL : public ShaderFeatureGLSL 165{ 166public: 167 168 virtual void processPix(Vector<ShaderComponent*> &componentList, 169 const MaterialFeatureData &fd); 170 171 virtual U32 getOutputTargets(const MaterialFeatureData &fd) const; 172 virtual String getName() { return "Blank Matinfo map"; } 173}; 174 175#endif // _TERRFEATUREGLSL_H_ 176
