mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-24 09:03:48 +00:00
Merge branch 'CustomShaderFeatures' of https://github.com/Areloch/Torque3D into development
This commit is contained in:
commit
741fcaed5a
37 changed files with 1365 additions and 38 deletions
|
|
@ -151,27 +151,35 @@ S32 FN_CDECL RenderBinManager::cmpKeyFunc(const void* p1, const void* p2)
|
|||
return ( test1 == 0 ) ? S32(mse1->key2) - S32(mse2->key2) : test1;
|
||||
}
|
||||
|
||||
void RenderBinManager::setupSGData( MeshRenderInst *ri, SceneData &data )
|
||||
void RenderBinManager::setupSGData(MeshRenderInst *ri, SceneData &data)
|
||||
{
|
||||
PROFILE_SCOPE( RenderBinManager_setupSGData );
|
||||
PROFILE_SCOPE(RenderBinManager_setupSGData);
|
||||
|
||||
// NOTE: We do not reset or clear the scene state
|
||||
// here as the caller has initialized non-RI members
|
||||
// himself and we must preserve them.
|
||||
//
|
||||
// It also saves a bunch of CPU as this is called for
|
||||
// every MeshRenderInst in every pass.
|
||||
// NOTE: We do not reset or clear the scene state
|
||||
// here as the caller has initialized non-RI members
|
||||
// himself and we must preserve them.
|
||||
//
|
||||
// It also saves a bunch of CPU as this is called for
|
||||
// every MeshRenderInst in every pass.
|
||||
|
||||
dMemcpy( data.lights, ri->lights, sizeof( data.lights ) );
|
||||
data.objTrans = ri->objectToWorld;
|
||||
data.backBuffTex = ri->backBuffTex;
|
||||
data.cubemap = ri->cubemap;
|
||||
data.miscTex = ri->miscTex;
|
||||
data.reflectTex = ri->reflectTex;
|
||||
data.accuTex = ri->accuTex;
|
||||
data.lightmap = ri->lightmap;
|
||||
data.visibility = ri->visibility;
|
||||
data.materialHint = ri->materialHint;
|
||||
dMemcpy(data.lights, ri->lights, sizeof(data.lights));
|
||||
data.objTrans = ri->objectToWorld;
|
||||
data.backBuffTex = ri->backBuffTex;
|
||||
data.cubemap = ri->cubemap;
|
||||
data.miscTex = ri->miscTex;
|
||||
data.reflectTex = ri->reflectTex;
|
||||
data.accuTex = ri->accuTex;
|
||||
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]);
|
||||
}
|
||||
|
||||
bool bl = true;
|
||||
}
|
||||
|
||||
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");
|
||||
|
|
@ -422,6 +424,13 @@ void RenderDeferredMgr::render( SceneRenderState *state )
|
|||
mat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
|
||||
}
|
||||
|
||||
//-JR
|
||||
//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,13 @@ void RenderGlowMgr::render( SceneRenderState *state )
|
|||
glowMat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
|
||||
}
|
||||
|
||||
//-JR
|
||||
//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,13 @@ void RenderMeshMgr::render(SceneRenderState * state)
|
|||
mat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
|
||||
}
|
||||
|
||||
//-JR
|
||||
//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 );
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ class MatrixSet;
|
|||
class GFXPrimitiveBufferHandle;
|
||||
class CubemapData;
|
||||
|
||||
class CustomShaderBindingData;
|
||||
|
||||
/// A RenderInstType hash value.
|
||||
typedef U32 RenderInstTypeHash;
|
||||
|
||||
|
|
@ -393,6 +395,9 @@ struct MeshRenderInst : public RenderInst
|
|||
const char *objectName;
|
||||
#endif
|
||||
|
||||
//Custom Shader data
|
||||
Vector<CustomShaderBindingData> mCustomShaderData;
|
||||
|
||||
void clear();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -256,6 +256,13 @@ void RenderTranslucentMgr::render( SceneRenderState *state )
|
|||
mat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
|
||||
}
|
||||
|
||||
//-JR
|
||||
//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