You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With Pull Request #19 an empty light type was added to T3D. We should remove this empty light type in a manner that stills allows T3D to compile on Windows and Linux.
The text was updated successfully, but these errors were encountered:
Okay, after a bit of research (mostly by looking back in time on why this change has been done), here is a result:
First of all, yes, it does create an empty light type with index 0 (zero), but it doesn't used anywhere at all, as - skipped:
void LightInfo::packExtended( BitStream *stream ) const
{
for ( U32 i = 0; i < mExtended.size(); i++ )
if ( mExtended[ i ] )
mExtended[ i ]->packUpdate( stream );
}
When this bit of code is called (like from the ScatterSky::packUpdate(), it will call the pack function for all non-empty lights.
And it is possible to build the T3D on Linux without this change, but...
Second, lightShadowMap.cpp and lightMapParams.cpp are link-order-dependent as it uses global c-tors (right for LightInfoExType).
So, it's possible that on one platform the ShadowMapParams is constructed before LightMapParams, and on another - in different order. In this case those two builds will crash upon connect, as one will assume it is sending data for ShadowMapParams (index=0), but the other retrieving it as LightMapParams (but in this build ShadowMapParams has index=1 as linked in reversed order).
So it will either try to read more from the stream in unpack, or the unpacked data will be corrupted (as it used for wrong light type), anyway at some moment it will crash.
To sum up everything:
It can be left as is now, with empty light type (at index zero), as it doesn't add any overhead at all and there are no objects created with empty type.
Or, we can refactor the code not to construct LightInfoExType globally, and change it to be pointer instead and create it by using MODULEs.
As far as I remember, the whole "MODULE__" system in T3D was implemented exactly for this - to avoid such problems in the code. And I believe the _LightInfoExType* is the only thingy left unchanged.
With Pull Request #19 an empty light type was added to T3D. We should remove this empty light type in a manner that stills allows T3D to compile on Windows and Linux.
The text was updated successfully, but these errors were encountered: