The final step (barring any overlooked missing bits, requested refactors, and of course, rolling in dependencies already submitted as PRs) consists of:

renderPrePassMgr.cpp related:
A) shifting .addFeature( MFT_XYZ); calls from ProcessedShaderMaterial::_determineFeatures to ProcessedPrePassMaterial::_determineFeatures
B) mimicking the "// set the XXX if different" entries from RenderMeshMgr::render in RenderPrePassMgr::render
C) fleshing out ProcessedPrePassMaterial::getNumStages() so that it shares a 1:1 correlation with ProcessedShaderMaterial::getNumStages()
D) causing inline void Swizzle<T, mapLength>::ToBuffer( void *destination, const void *source, const dsize_t size )  to silently fail rather than fatally assert if a source or destination buffer is not yet ready to be filled. (support for #customTarget scripted render targets)

Reflections:
A) removing reflectRenderState.disableAdvancedLightingBins(true); entries. this would otherwise early out from prepass and provide no color data whatsoever.
B) removing the fd.features.addFeature( MFT_ForwardShading ); entry forcing all materials to be forward lit when reflected.
C) 2 things best described bluntly as working hacks:
C1) when reflected, a scattersky is rotated PI along it's z then x axis in order to draw properly.
C2) along similar lines, in terraincellmaterial, we shut off culling if it's a prepass material.

Skies: scattersky is given a pair of rotations for reflection purposes, all sky objects are given a z value for depth testing.
This commit is contained in:
Azaezel 2016-02-16 02:50:49 -06:00
parent 5ed06fff9d
commit 8c5810adad
58 changed files with 353 additions and 117 deletions

View file

@ -162,6 +162,9 @@ Material::Material()
mSeqFramePerSec[i] = 0.0f;
mSeqSegSize[i] = 0.0f;
// Deferred Shading
mMatInfoFlags[i] = 0.0f;
}
dMemset(mCellIndex, 0, sizeof(mCellIndex));
@ -170,6 +173,9 @@ Material::Material()
dMemset(mNormalMapAtlas, 0, sizeof(mNormalMapAtlas));
dMemset(mUseAnisotropic, 0, sizeof(mUseAnisotropic));
// Deferred Shading : Metalness
dMemset(mUseMetalness, 0, sizeof(mUseMetalness));
mImposterLimits = Point4F::Zero;
mDoubleSided = false;
@ -204,6 +210,9 @@ Material::Material()
mDirectSoundOcclusion = 1.f;
mReverbSoundOcclusion = 1.0;
// Deferred Shading
mIsSky = false;
}
void Material::initPersistFields()
@ -289,10 +298,7 @@ void Material::initPersistFields()
addField( "useAnisotropic", TypeBool, Offset(mUseAnisotropic, Material), MAX_STAGES,
"Use anisotropic filtering for the textures of this stage." );
addField("envMap", TypeImageFilename, Offset(mEnvMapFilename, Material), MAX_STAGES,
"The name of an environment map cube map to apply to this material." );
addField("vertLit", TypeBool, Offset(mVertLit, Material), MAX_STAGES,
"If true the vertex color is used for lighting." );
@ -379,9 +385,6 @@ void Material::initPersistFields()
addProtectedField("bumpTex", TypeImageFilename, Offset(mNormalMapFilename, Material),
defaultProtectedSetNotEmptyFn, emptyStringProtectedGetFn, MAX_STAGES,
"For backwards compatibility.\n@see normalMap\n");
addProtectedField("envTex", TypeImageFilename, Offset(mEnvMapFilename, Material),
defaultProtectedSetNotEmptyFn, emptyStringProtectedGetFn, MAX_STAGES,
"For backwards compatibility.\n@see envMap\n");
addProtectedField("colorMultiply", TypeColorF, Offset(mDiffuse, Material),
defaultProtectedSetNotEmptyFn, emptyStringProtectedGetFn, MAX_STAGES,
"For backwards compatibility.\n@see diffuseColor\n");
@ -417,6 +420,9 @@ void Material::initPersistFields()
addField("dynamicCubemap", TypeBool, Offset(mDynamicCubemap, Material),
"Enables the material to use the dynamic cubemap from the ShapeBase object its applied to." );
addField("isSky", TypeBool, Offset(mIsSky, Material),
"Sky support. Alters draw dimensions." );
addGroup( "Behavioral" );
addField( "showFootprints", TypeBool, Offset( mShowFootprints, Material ),