Working on shader const binding

This commit is contained in:
Areloch 2017-10-17 08:48:31 -05:00
parent ccdc93fc25
commit d674ac5817
11 changed files with 96 additions and 33 deletions

View file

@ -124,6 +124,8 @@ TSStatic::TSStatic()
mCollisionType = CollisionMesh;
mDecalType = CollisionMesh;
mOverrideColor = LinearColorF::BLACK;
}
TSStatic::~TSStatic()
@ -187,6 +189,9 @@ void TSStatic::initPersistFields()
addField( "originSort", TypeBool, Offset( mUseOriginSort, TSStatic ),
"Enables translucent sorting of the TSStatic by its origin instead of the bounds." );
addField("overrideColor", TypeColorF, Offset(mOverrideColor, TSStatic),
"@brief The skin applied to the shape.\n\n");
endGroup("Rendering");
addGroup( "Reflection" );
@ -306,8 +311,6 @@ bool TSStatic::onAdd()
if ( reflectorDesc )
mCubeReflector.registerReflector( this, reflectorDesc );
strudelCSB = new CustomShaderBindingData();
}
_updateShouldTick();
@ -630,7 +633,8 @@ void TSStatic::prepRenderImage( SceneRenderState* state )
rdata.setAccuTex(mAccuTex);
//Various arbitrary shader render bits to add
strudelCSB->setFloat("strudel", 0.25);
CustomShaderBindingData strudelCSB;
strudelCSB.setFloat4(StringTable->insert("overrideColor"), mOverrideColor);
rdata.addCustomShaderBinding(strudelCSB);
@ -800,6 +804,8 @@ U32 TSStatic::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
{
stream->writeRangedU32( reflectorDesc->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast );
}
stream->write(mOverrideColor);
return retMask;
}
@ -887,6 +893,8 @@ void TSStatic::unpackUpdate(NetConnection *con, BitStream *stream)
cubeDescId = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );
}
stream->read(&mOverrideColor);
if ( isProperlyAdded() )
_updateShouldTick();
}