Update GLSL Shadergen. Not used on DX9.

This commit is contained in:
LuisAntonRebollo 2014-04-17 17:44:49 +02:00
parent ba36617aec
commit 9221b4dd10
20 changed files with 1944 additions and 1128 deletions

View file

@ -25,9 +25,6 @@
#ifndef _SHADERFEATURE_H_
#include "shaderGen/shaderFeature.h"
#endif
#ifndef _MATERIALFEATUREDATA_H_
#include "materials/materialFeatureData.h"
#endif
struct LangElement;
struct MaterialFeatureData;
@ -54,13 +51,25 @@ public:
bool mapsToSampler,
Vector<ShaderComponent*> &componentList );
static Var* getInColor( const char *name,
const char *type,
Vector<ShaderComponent*> &componentList );
///
static Var* addOutVpos( MultiLine *meta,
Vector<ShaderComponent*> &componentList );
/// Returns the VPOS input register for the pixel shader.
static Var* getInVpos( MultiLine *meta,
Vector<ShaderComponent*> &componentList );
/// Returns the "objToTangentSpace" transform or creates one if this
/// is the first feature to need it.
Var* getOutObjToTangentSpace( Vector<ShaderComponent*> &componentList,
MultiLine *meta,
const MaterialFeatureData &fd );
/// Returns the existing output "worldToTangent" transform or
/// Returns the existing output "outWorldToTangent" transform or
/// creates one if this is the first feature to need it.
Var* getOutWorldToTangent( Vector<ShaderComponent*> &componentList,
MultiLine *meta,
@ -70,7 +79,7 @@ public:
/// adding it to the input connector if it doesn't exist.
static Var* getInWorldToTangent( Vector<ShaderComponent*> &componentList );
/// Returns the existing output "viewToTangent" transform or
/// Returns the existing output "outViewToTangent" transform or
/// creates one if this is the first feature to need it.
Var* getOutViewToTangent( Vector<ShaderComponent*> &componentList,
MultiLine *meta,
@ -81,17 +90,16 @@ public:
static Var* getInViewToTangent( Vector<ShaderComponent*> &componentList );
/// Calculates the world space position in the vertex shader and
/// assigns it to the passed language element. It does not pass /// it across the connector to the pixel shader.
/// assigns it to the passed language element. It does not pass
/// it across the connector to the pixel shader.
/// @see addOutWsPosition
void getWsPosition( Vector<ShaderComponent*> &componentList,
bool useInstancing,
MultiLine *meta,
LangElement *wsPosition );
/// Adds the "wsPosition" to the input connector if it doesn't exist.
Var* addOutWsPosition( Vector<ShaderComponent*> &componentList,
bool useInstancing,
MultiLine *meta );
@ -129,7 +137,6 @@ public:
bool useInstancing,
MultiLine *meta );
// ShaderFeature
Var* getVertTexCoord( const String &name );
LangElement* setupTexSpaceMat( Vector<ShaderComponent*> &componentList, Var **texSpaceMat );
@ -151,25 +158,27 @@ public:
virtual String getName() { return mName; }
};
class RenderTargetZeroGLSL : public ShaderFeatureGLSL
{
protected: ShaderFeature::OutputTarget mOutputTargetMask;
protected:
ShaderFeature::OutputTarget mOutputTargetMask;
String mFeatureName;
public:
RenderTargetZeroGLSL( const ShaderFeature::OutputTarget target )
: mOutputTargetMask( target )
{
char buffer[256]; dSprintf(buffer, sizeof(buffer), "Render Target Output = 0.0, output mask %04b", mOutputTargetMask);
mFeatureName = buffer; }
char buffer[256];
dSprintf(buffer, sizeof(buffer), "Render Target Output = 0.0, output mask %04b", mOutputTargetMask);
mFeatureName = buffer;
}
virtual String getName() { return mFeatureName; }
virtual void processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd );
virtual U32 getOutputTargets( const MaterialFeatureData &fd ) const { return
mOutputTargetMask; }
virtual U32 getOutputTargets( const MaterialFeatureData &fd ) const { return mOutputTargetMask; }
};
@ -190,11 +199,7 @@ public:
U32 stageNum,
const FeatureType &type,
const FeatureSet &features,
MaterialFeatureData *outFeatureData )
{
// This feature is always on!
outFeatureData->features.addFeature( type );
}
MaterialFeatureData *outFeatureData );
};
@ -297,7 +302,6 @@ public:
}
};
/// Diffuse vertex color
class DiffuseVertColorFeatureGLSL : public ShaderFeatureGLSL
{
@ -316,7 +320,6 @@ public:
}
};
/// Lightmap
class LightmapFeatGLSL : public ShaderFeatureGLSL
{
@ -491,7 +494,14 @@ public:
/// Visibility
class VisibilityFeatGLSL : public ShaderFeatureGLSL
{
protected:
ShaderIncludeDependency mTorqueDep;
public:
VisibilityFeatGLSL();
virtual void processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd );
@ -500,11 +510,6 @@ public:
virtual Resources getResources( const MaterialFeatureData &fd );
virtual void setTexData( Material::StageData &stageDat,
const MaterialFeatureData &fd,
RenderPassData &passData,
U32 &texIndex );
virtual Material::BlendOp getBlendOp() { return Material::None; }
virtual String getName()
@ -547,10 +552,10 @@ public:
}
};
/// This should be the final feature on most pixel shaders which
/// encodes the color for the current HDR target format.
/// @see HDRPostFx/// @see LightManager
/// @see HDRPostFx
/// @see LightManager
/// @see torque.glsl
class HDROutGLSL : public ShaderFeatureGLSL
{
@ -570,9 +575,9 @@ public:
virtual String getName() { return "HDR Output"; }
};
///
class FoliageFeatureGLSL : public ShaderFeatureGLSL{
class FoliageFeatureGLSL : public ShaderFeatureGLSL
{
protected:
ShaderIncludeDependency mDep;
@ -583,6 +588,7 @@ public:
virtual void processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd );
virtual void processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd );
@ -597,11 +603,10 @@ public:
const FeatureType &type,
const FeatureSet &features,
MaterialFeatureData *outFeatureData );
virtual ShaderFeatureConstHandles* createConstHandles( GFXShader *shader, SimObject *userObject );
};
///
class ParticleNormalFeatureGLSL : public ShaderFeatureGLSL
{
public:
@ -616,6 +621,9 @@ public:
};
/// Special feature for unpacking imposter verts.
/// @see RenderImposterMgr
class ImposterVertFeatureGLSL : public ShaderFeatureGLSL
{
protected:
@ -623,9 +631,12 @@ protected:
ShaderIncludeDependency mDep;
public:
ImposterVertFeatureGLSL();
ImposterVertFeatureGLSL();
virtual void processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd );
virtual void processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd );