mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-18 22:23:48 +00:00
Initial implementation of Custom Shader Features
This commit is contained in:
parent
54b4d2eaaf
commit
9a63761627
31 changed files with 1772 additions and 17 deletions
|
|
@ -172,6 +172,11 @@ void RenderBinManager::setupSGData( MeshRenderInst *ri, SceneData &data )
|
|||
data.lightmap = ri->lightmap;
|
||||
data.visibility = ri->visibility;
|
||||
data.materialHint = ri->materialHint;
|
||||
data.customShaderData.clear();
|
||||
for (U32 i = 0; i < ri->mCustomShaderData.size(); i++)
|
||||
{
|
||||
data.customShaderData.push_back(&ri->mCustomShaderData[i]);
|
||||
}
|
||||
}
|
||||
|
||||
DefineEngineMethod( RenderBinManager, getBinType, const char*, (),,
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@
|
|||
#include "materials/shaderData.h"
|
||||
#include "gfx/sim/cubemapData.h"
|
||||
|
||||
#include "materials/customShaderBindingData.h"
|
||||
|
||||
const MatInstanceHookType DeferredMatInstanceHook::Type( "Deferred" );
|
||||
const String RenderDeferredMgr::BufferName("deferred");
|
||||
const RenderInstType RenderDeferredMgr::RIT_Deferred("Deferred");
|
||||
|
|
@ -431,6 +433,12 @@ void RenderDeferredMgr::render( SceneRenderState *state )
|
|||
mat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
|
||||
}
|
||||
|
||||
//push along any overriden fields that are instance-specific as well
|
||||
if (passRI->mCustomShaderData.size() > 0)
|
||||
{
|
||||
mat->setCustomShaderData(passRI->mCustomShaderData);
|
||||
}
|
||||
|
||||
// If we're instanced then don't render yet.
|
||||
if ( mat->isInstanced() )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -251,6 +251,12 @@ void RenderGlowMgr::render( SceneRenderState *state )
|
|||
glowMat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
|
||||
}
|
||||
|
||||
//push along any overriden fields that are instance-specific as well
|
||||
if (passRI->mCustomShaderData.size() > 0)
|
||||
{
|
||||
mat->setCustomShaderData(passRI->mCustomShaderData);
|
||||
}
|
||||
|
||||
glowMat->setSceneInfo(state, sgData);
|
||||
glowMat->setBuffers(passRI->vertBuff, passRI->primBuff);
|
||||
|
||||
|
|
|
|||
|
|
@ -182,6 +182,12 @@ void RenderMeshMgr::render(SceneRenderState * state)
|
|||
mat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
|
||||
}
|
||||
|
||||
//push along any overriden fields that are instance-specific as well
|
||||
if (passRI->mCustomShaderData.size() > 0)
|
||||
{
|
||||
mat->setCustomShaderData(passRI->mCustomShaderData);
|
||||
}
|
||||
|
||||
setupSGData( passRI, sgData );
|
||||
mat->setSceneInfo( state, sgData );
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ class LightInfo;
|
|||
struct RenderInst;
|
||||
class MatrixSet;
|
||||
class GFXPrimitiveBufferHandle;
|
||||
class CustomShaderBindingData;
|
||||
|
||||
/// A RenderInstType hash value.
|
||||
typedef U32 RenderInstTypeHash;
|
||||
|
|
@ -382,6 +383,9 @@ struct MeshRenderInst : public RenderInst
|
|||
const char *objectName;
|
||||
#endif
|
||||
|
||||
//Custom Shader data
|
||||
Vector<CustomShaderBindingData> mCustomShaderData;
|
||||
|
||||
void clear();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -249,6 +249,12 @@ void RenderTranslucentMgr::render( SceneRenderState *state )
|
|||
mat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
|
||||
}
|
||||
|
||||
//push along any overriden fields that are instance-specific as well
|
||||
if (passRI->mCustomShaderData.size() > 0)
|
||||
{
|
||||
mat->setCustomShaderData(passRI->mCustomShaderData);
|
||||
}
|
||||
|
||||
// If we're instanced then don't render yet.
|
||||
if ( mat->isInstanced() )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue