mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-18 20:00:56 +00:00
Blinn-Phong Specular Changes
Based on the work done here: http://www.garagegames.com/community/blogs/view/21032
This commit is contained in:
parent
f5246bb809
commit
17113d3ba5
25 changed files with 167 additions and 26 deletions
|
|
@ -116,6 +116,7 @@ Material::Material()
|
|||
mSpecular[i].set( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
|
||||
mSpecularPower[i] = 8.0f;
|
||||
mSpecularStrength[i] = 1.0f;
|
||||
mPixelSpecular[i] = false;
|
||||
|
||||
mParallaxScale[i] = 0.0f;
|
||||
|
|
@ -239,7 +240,10 @@ void Material::initPersistFields()
|
|||
"The color of the specular highlight when not using a specularMap." );
|
||||
|
||||
addField("specularPower", TypeF32, Offset(mSpecularPower, Material), MAX_STAGES,
|
||||
"The intensity of the specular highlight when not using a specularMap." );
|
||||
"The hardness of the specular highlight when not using a specularMap." );
|
||||
|
||||
addField("specularStrength", TypeF32, Offset(mSpecularStrength, Material), MAX_STAGES,
|
||||
"The strength of the specular highlight when not using a specularMap." );
|
||||
|
||||
addField("pixelSpecular", TypeBool, Offset(mPixelSpecular, Material), MAX_STAGES,
|
||||
"This enables per-pixel specular highlights controlled by the alpha channel of the "
|
||||
|
|
|
|||
|
|
@ -223,6 +223,7 @@ public:
|
|||
ColorF mSpecular[MAX_STAGES];
|
||||
|
||||
F32 mSpecularPower[MAX_STAGES];
|
||||
F32 mSpecularStrength[MAX_STAGES];
|
||||
bool mPixelSpecular[MAX_STAGES];
|
||||
|
||||
bool mVertLit[MAX_STAGES];
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ void ShaderConstHandles::init( GFXShader *shader, CustomMaterial* mat /*=NULL*/
|
|||
mToneMapTexSC = shader->getShaderConstHandle(ShaderGenVars::toneMap);
|
||||
mSpecularColorSC = shader->getShaderConstHandle(ShaderGenVars::specularColor);
|
||||
mSpecularPowerSC = shader->getShaderConstHandle(ShaderGenVars::specularPower);
|
||||
mSpecularStrengthSC = shader->getShaderConstHandle(ShaderGenVars::specularStrength);
|
||||
mParallaxInfoSC = shader->getShaderConstHandle("$parallaxInfo");
|
||||
mFogDataSC = shader->getShaderConstHandle(ShaderGenVars::fogData);
|
||||
mFogColorSC = shader->getShaderConstHandle(ShaderGenVars::fogColor);
|
||||
|
|
@ -993,6 +994,7 @@ void ProcessedShaderMaterial::_setShaderConstants(SceneRenderState * state, cons
|
|||
|
||||
shaderConsts->setSafe(handles->mSpecularColorSC, mMaterial->mSpecular[stageNum]);
|
||||
shaderConsts->setSafe(handles->mSpecularPowerSC, mMaterial->mSpecularPower[stageNum]);
|
||||
shaderConsts->setSafe(handles->mSpecularStrengthSC, mMaterial->mSpecularStrength[stageNum]);
|
||||
|
||||
shaderConsts->setSafe(handles->mParallaxInfoSC, mMaterial->mParallaxScale[stageNum]);
|
||||
shaderConsts->setSafe(handles->mMinnaertConstantSC, mMaterial->mMinnaertConstant[stageNum]);
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ public:
|
|||
GFXShaderConstHandle* mTexMatSC;
|
||||
GFXShaderConstHandle* mSpecularColorSC;
|
||||
GFXShaderConstHandle* mSpecularPowerSC;
|
||||
GFXShaderConstHandle* mSpecularStrengthSC;
|
||||
GFXShaderConstHandle* mParallaxInfoSC;
|
||||
GFXShaderConstHandle* mFogDataSC;
|
||||
GFXShaderConstHandle* mFogColorSC;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue