mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-09 23:40:42 +00:00
Merge branch 'GarageGames/master' into ueberengine-dev
This commit is contained in:
commit
3831cd6ccf
185 changed files with 793 additions and 328 deletions
|
|
@ -502,7 +502,7 @@ void ConvexShape::prepRenderImage( SceneRenderState *state )
|
|||
}
|
||||
*/
|
||||
|
||||
if ( mVertexBuffer.isNull() )
|
||||
if ( mVertexBuffer.isNull() || !state)
|
||||
return;
|
||||
|
||||
// If we don't have a material instance after the override then
|
||||
|
|
|
|||
|
|
@ -1235,8 +1235,30 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|||
currentBatch = &batches.last();
|
||||
currentBatch->startDecal = i;
|
||||
currentBatch->decalCount = 1;
|
||||
currentBatch->iCount = decal->mIndxCount;
|
||||
currentBatch->vCount = decal->mVertCount;
|
||||
|
||||
// Shrink and warning: preventing a potential crash.
|
||||
currentBatch->iCount =
|
||||
(decal->mIndxCount > smMaxIndices) ? smMaxIndices : decal->mIndxCount;
|
||||
currentBatch->vCount =
|
||||
(decal->mVertCount > smMaxVerts) ? smMaxVerts : decal->mVertCount;
|
||||
#ifdef TORQUE_DEBUG
|
||||
// we didn't mean send a spam to the console
|
||||
static U32 countMsgIndx = 0;
|
||||
if ( (decal->mIndxCount > smMaxIndices) && ((countMsgIndx++ % 1024) == 0) ) {
|
||||
Con::warnf(
|
||||
"DecalManager::prepRenderImage() - Shrinked indices of decal."
|
||||
" Lost %u.", (decal->mIndxCount - smMaxIndices)
|
||||
);
|
||||
}
|
||||
static U32 countMsgVert = 0;
|
||||
if ( (decal->mVertCount > smMaxVerts) && ((countMsgVert++ % 1024) == 0) ) {
|
||||
Con::warnf(
|
||||
"DecalManager::prepRenderImage() - Shrinked vertices of decal."
|
||||
" Lost %u.", (decal->mVertCount - smMaxVerts)
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
currentBatch->mat = mat;
|
||||
currentBatch->matInst = decal->mDataBlock->getMaterialInstance();
|
||||
currentBatch->priority = decal->getRenderPriority();
|
||||
|
|
@ -1299,15 +1321,21 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|||
{
|
||||
DecalInstance *dinst = mDecalQueue[j];
|
||||
|
||||
for ( U32 k = 0; k < dinst->mIndxCount; k++ )
|
||||
const U32 indxCount =
|
||||
(dinst->mIndxCount > currentBatch.iCount) ?
|
||||
currentBatch.iCount : dinst->mIndxCount;
|
||||
for ( U32 k = 0; k < indxCount; k++ )
|
||||
{
|
||||
*( pbPtr + ioffset + k ) = dinst->mIndices[k] + voffset;
|
||||
}
|
||||
|
||||
ioffset += dinst->mIndxCount;
|
||||
ioffset += indxCount;
|
||||
|
||||
dMemcpy( vpPtr + voffset, dinst->mVerts, sizeof( DecalVertex ) * dinst->mVertCount );
|
||||
voffset += dinst->mVertCount;
|
||||
const U32 vertCount =
|
||||
(dinst->mVertCount > currentBatch.vCount) ?
|
||||
currentBatch.vCount : dinst->mVertCount;
|
||||
dMemcpy( vpPtr + voffset, dinst->mVerts, sizeof( DecalVertex ) * vertCount );
|
||||
voffset += vertCount;
|
||||
|
||||
// Ugly hack for ProjectedShadow!
|
||||
if ( (dinst->mFlags & CustomDecal) && dinst->mCustomTex != NULL )
|
||||
|
|
@ -1357,8 +1385,10 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|||
pb->lock( &pbPtr );
|
||||
|
||||
// Memcpy from system to video memory.
|
||||
dMemcpy( vpPtr, vertData, sizeof( DecalVertex ) * currentBatch.vCount );
|
||||
dMemcpy( pbPtr, indexData, sizeof( U16 ) * currentBatch.iCount );
|
||||
const U32 vpCount = sizeof( DecalVertex ) * currentBatch.vCount;
|
||||
dMemcpy( vpPtr, vertData, vpCount );
|
||||
const U32 pbCount = sizeof( U16 ) * currentBatch.iCount;
|
||||
dMemcpy( pbPtr, indexData, pbCount );
|
||||
|
||||
pb->unlock();
|
||||
vb->unlock();
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ void RenderMeshExample::prepRenderImage( SceneRenderState *state )
|
|||
createGeometry();
|
||||
|
||||
// If we have no material then skip out.
|
||||
if ( !mMaterialInst )
|
||||
if ( !mMaterialInst || !state)
|
||||
return;
|
||||
|
||||
// If we don't have a material instance after the override then
|
||||
|
|
|
|||
|
|
@ -195,6 +195,7 @@ bool LightAnimData::AnimValue<COUNT>::animate( F32 time, F32 *output )
|
|||
F32 scaledTime, lerpFactor, valueRange, keyFrameLerp;
|
||||
U32 posFrom, posTo;
|
||||
S32 keyFrameFrom, keyFrameTo;
|
||||
F32 initialValue = *output;
|
||||
|
||||
bool wasAnimated = false;
|
||||
|
||||
|
|
@ -215,13 +216,13 @@ bool LightAnimData::AnimValue<COUNT>::animate( F32 time, F32 *output )
|
|||
valueRange = ( value2[i] - value1[i] ) / 25.0f;
|
||||
|
||||
if ( !smooth[i] )
|
||||
output[i] = value1[i] + ( keyFrameFrom * valueRange );
|
||||
output[i] = (value1[i] + (keyFrameFrom * valueRange)) * initialValue;
|
||||
else
|
||||
{
|
||||
lerpFactor = scaledTime - posFrom;
|
||||
keyFrameLerp = ( keyFrameTo - keyFrameFrom ) * lerpFactor;
|
||||
|
||||
output[i] = value1[i] + ( ( keyFrameFrom + keyFrameLerp ) * valueRange );
|
||||
output[i] = (value1[i] + ((keyFrameFrom + keyFrameLerp) * valueRange)) * initialValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue