bumpGLSL.h

Engine/source/shaderGen/GLSL/bumpGLSL.h

More...

Classes:

class

The Bumpmap feature will read the normal map and transform it by the inverse of the worldToTanget matrix.

class

This feature is used to render normals to the diffuse target for imposter rendering.

class

This feature either generates the cheap yet effective offset mapping style parallax or the much more expensive occlusion mapping technique based on the enabled feature flags.

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 _BUMP_GLSL_H_
 25#define _BUMP_GLSL_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
 34struct RenderPassData;
 35class MultiLine;
 36
 37
 38/// The Bumpmap feature will read the normal map and
 39/// transform it by the inverse of the worldToTanget 
 40/// matrix.  This normal is then used by subsequent
 41/// shader features.
 42class BumpFeatGLSL : public ShaderFeatureGLSL
 43{
 44public:
 45
 46   // ShaderFeatureGLSL
 47   virtual void processVert( Vector<ShaderComponent*> &componentList,
 48                             const MaterialFeatureData &fd );
 49   virtual void processPix( Vector<ShaderComponent*> &componentList, 
 50                            const MaterialFeatureData &fd );
 51   virtual Material::BlendOp getBlendOp(){ return Material::LerpAlpha; }  
 52   virtual Resources getResources( const MaterialFeatureData &fd );
 53   virtual void setTexData( Material::StageData &stageDat,
 54                            const MaterialFeatureData &fd,
 55                            RenderPassData &passData,
 56                            U32 &texIndex );
 57   virtual String getName() { return "Bumpmap"; }
 58};
 59
 60
 61/// This feature either generates the cheap yet effective offset
 62/// mapping style parallax or the much more expensive occlusion 
 63/// mapping technique based on the enabled feature flags.
 64class ParallaxFeatGLSL : public ShaderFeatureGLSL
 65{
 66protected:
 67
 68   static Var* _getUniformVar(   const char *name, 
 69                                 const char *type, 
 70                                 ConstantSortPosition csp );
 71
 72   ShaderIncludeDependency mIncludeDep;
 73
 74public:
 75
 76   ParallaxFeatGLSL();
 77
 78   // ShaderFeatureGLSL
 79   virtual void processVert(  Vector<ShaderComponent*> &componentList,
 80                              const MaterialFeatureData &fd );
 81   virtual void processPix(   Vector<ShaderComponent*> &componentList, 
 82                              const MaterialFeatureData &fd );
 83   virtual Resources getResources( const MaterialFeatureData &fd );
 84   virtual void setTexData(   Material::StageData &stageDat,
 85                              const MaterialFeatureData &fd,
 86                              RenderPassData &passData,
 87                              U32 &texIndex );
 88   virtual String getName() { return "Parallax"; }
 89};
 90
 91
 92/// This feature is used to render normals to the 
 93/// diffuse target for imposter rendering.
 94class NormalsOutFeatGLSL : public ShaderFeatureGLSL
 95{
 96public:
 97   
 98   // ShaderFeatureGLSL
 99   virtual void processVert(  Vector<ShaderComponent*> &componentList,
100                            const MaterialFeatureData &fd );
101   virtual void processPix( Vector<ShaderComponent*> &componentList, 
102                           const MaterialFeatureData &fd );
103   virtual Material::BlendOp getBlendOp(){ return Material::LerpAlpha; }  
104   virtual String getName() { return "NormalsOut"; }
105};
106
107#endif // _BUMP_GLSL_H_
108