mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 22:54:34 +00:00
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:
parent
5ed06fff9d
commit
8c5810adad
58 changed files with 353 additions and 117 deletions
|
|
@ -36,7 +36,8 @@ RenderBinManager::RenderBinManager( const RenderInstType& ritype, F32 renderOrde
|
|||
mRenderInstType( ritype ),
|
||||
mRenderOrder( renderOrder ),
|
||||
mProcessAddOrder( processAddOrder ),
|
||||
mRenderPass( NULL )
|
||||
mRenderPass( NULL ),
|
||||
mBasicOnly ( false )
|
||||
{
|
||||
VECTOR_SET_ASSOCIATION( mElementList );
|
||||
mElementList.reserve( 2048 );
|
||||
|
|
@ -60,6 +61,9 @@ void RenderBinManager::initPersistFields()
|
|||
addField("processAddOrder", TypeF32, Offset(mProcessAddOrder, RenderBinManager),
|
||||
"Defines the order for adding instances in relation to other bins." );
|
||||
|
||||
addField( "basicOnly", TypeBool, Offset(mBasicOnly, RenderBinManager),
|
||||
"Limites the render bin to basic lighting only." );
|
||||
|
||||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -128,6 +128,8 @@ protected:
|
|||
/// RenderInst if available, otherwise, return NULL.
|
||||
inline BaseMatInstance* getMaterial( RenderInst *inst ) const;
|
||||
|
||||
// Limits bin to rendering in basic lighting only.
|
||||
bool mBasicOnly;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -160,6 +162,7 @@ inline BaseMatInstance* RenderBinManager::getMaterial( RenderInst *inst ) const
|
|||
{
|
||||
if ( inst->type == RenderPassManager::RIT_Mesh ||
|
||||
inst->type == RenderPassManager::RIT_Decal ||
|
||||
inst->type == RenderPassManager::RIT_DecalRoad ||
|
||||
inst->type == RenderPassManager::RIT_Translucent )
|
||||
return static_cast<MeshRenderInst*>(inst)->matInst;
|
||||
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ void RenderGlowMgr::GlowMaterialHook::_overrideFeatures( ProcessedMaterial *mat,
|
|||
// the glow materials.
|
||||
fd.features.removeFeature( MFT_Fog );
|
||||
fd.features.removeFeature( MFT_HDROut );
|
||||
fd.features.addFeature( MFT_Imposter );
|
||||
}
|
||||
|
||||
RenderGlowMgr::RenderGlowMgr()
|
||||
|
|
@ -89,6 +90,7 @@ RenderGlowMgr::RenderGlowMgr()
|
|||
Point2I( 512, 512 ) )
|
||||
{
|
||||
notifyType( RenderPassManager::RIT_Decal );
|
||||
notifyType( RenderPassManager::RIT_DecalRoad );
|
||||
notifyType( RenderPassManager::RIT_Translucent );
|
||||
notifyType( RenderPassManager::RIT_Particle );
|
||||
|
||||
|
|
|
|||
|
|
@ -144,6 +144,14 @@ void RenderMeshMgr::render(SceneRenderState * state)
|
|||
if( !mat )
|
||||
mat = MATMGR->getWarningMatInstance();
|
||||
|
||||
// Check if bin is disabled in advanced lighting.
|
||||
// Allow forward rendering pass on custom materials.
|
||||
|
||||
if ( ( MATMGR->getPrePassEnabled() && mBasicOnly && !mat->isCustomMaterial() ) )
|
||||
{
|
||||
j++;
|
||||
continue;
|
||||
}
|
||||
|
||||
U32 matListEnd = j;
|
||||
lastMiscTex = sgData.miscTex;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
#include "renderObjectMgr.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "scene/sceneObject.h"
|
||||
#include "materials/materialManager.h"
|
||||
#include "scene/sceneRenderState.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT(RenderObjectMgr);
|
||||
|
||||
|
|
@ -66,6 +68,10 @@ void RenderObjectMgr::render( SceneRenderState *state )
|
|||
if(!mElementList.size())
|
||||
return;
|
||||
|
||||
// Check if bin is disabled in advanced lighting.
|
||||
if ( MATMGR->getPrePassEnabled() && mBasicOnly )
|
||||
return;
|
||||
|
||||
for( U32 i=0; i<mElementList.size(); i++ )
|
||||
{
|
||||
ObjectRenderInst *ri = static_cast<ObjectRenderInst*>(mElementList[i].inst);
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ const RenderInstType RenderPassManager::RIT_Terrain("Terrain");
|
|||
const RenderInstType RenderPassManager::RIT_Object("Object");
|
||||
const RenderInstType RenderPassManager::RIT_ObjectTranslucent("ObjectTranslucent");
|
||||
const RenderInstType RenderPassManager::RIT_Decal("Decal");
|
||||
const RenderInstType RenderPassManager::RIT_DecalRoad("DecalRoad");
|
||||
const RenderInstType RenderPassManager::RIT_Water("Water");
|
||||
const RenderInstType RenderPassManager::RIT_Foliage("Foliage");
|
||||
const RenderInstType RenderPassManager::RIT_VolumetricFog("ObjectVolumetricFog");
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ public:
|
|||
static const RenderInstType RIT_Object; // objects that do their own rendering
|
||||
static const RenderInstType RIT_ObjectTranslucent;// self rendering; but sorted with static const RenderInstType RIT_Translucent
|
||||
static const RenderInstType RIT_Decal;
|
||||
static const RenderInstType RIT_DecalRoad;
|
||||
static const RenderInstType RIT_Water;
|
||||
static const RenderInstType RIT_Foliage;
|
||||
static const RenderInstType RIT_VolumetricFog;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include "terrain/terrCell.h"
|
||||
#include "terrain/terrCellMaterial.h"
|
||||
#include "math/util/matrixSet.h"
|
||||
#include "materials/materialManager.h"
|
||||
|
||||
bool RenderTerrainMgr::smRenderWireframe = false;
|
||||
|
||||
|
|
@ -117,6 +118,10 @@ void RenderTerrainMgr::render( SceneRenderState *state )
|
|||
if ( mInstVector.empty() )
|
||||
return;
|
||||
|
||||
// Check if bin is disabled in advanced lighting.
|
||||
if ( MATMGR->getPrePassEnabled() && mBasicOnly )
|
||||
return;
|
||||
|
||||
PROFILE_SCOPE( RenderTerrainMgr_Render );
|
||||
|
||||
GFXTransformSaver saver;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue