Skip to content

Commit

Permalink
Merge pull request #1382 from Azaezel/alpha41/lightMounts
Browse files Browse the repository at this point in the history
handle mounted lights ghosting in and out
  • Loading branch information
Azaezel authored Feb 8, 2025
2 parents e77c4b3 + 4d66ae3 commit 0b477b5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
14 changes: 13 additions & 1 deletion Engine/source/T3D/lightBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ bool LightBase::onAdd()
// Update the light parameters.
_conformLights();
addToScene();

setProcessTick(true);
return true;
}

Expand Down Expand Up @@ -256,10 +256,22 @@ void LightBase::_onUnselected()

void LightBase::interpolateTick( F32 delta )
{
if (isMounted()) {
MatrixF mat;
mMount.object->getRenderMountTransform(delta, mMount.node, mMount.xfm, &mat);
mLight->setTransform(mat);
Parent::setTransform(mat);
}
}

void LightBase::processTick()
{
if (isMounted()) {
MatrixF mat;
mMount.object->getMountTransform(mMount.node, mMount.xfm, &mat);
mLight->setTransform(mat);
setTransform(mat);
}
}

void LightBase::advanceTime( F32 timeDelta )
Expand Down
4 changes: 2 additions & 2 deletions Engine/source/scene/sceneObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1236,10 +1236,10 @@ bool SceneObject::_setMountPID( void* object, const char* index, const char* dat

void SceneObject::resolveMountPID()
{
if ( mMountPID && !mMount.object )
if ( mMountPID )
{
SceneObject *obj = dynamic_cast< SceneObject* >( mMountPID->getObject() );
if ( obj )
if ( obj != mMount.object)
obj->mountObject( this, mMount.node, mMount.xfm );
}
}
Expand Down

0 comments on commit 0b477b5

Please sign in to comment.