I'm using Fastlib's shadows system to add shadows to my game, but I've encountered an oddity that seemingly means I have 2 lights in the world.
In ShadowsSimple.bb or ShadowsMultiple.bb there is the following code:
If ShadowLightDefault=0 Then
ShadowLightDefault = CreateLight()
EndIf
This is creating a default light.
However in my main program I am setting up shadows as follows using a light and camera that I already have in my gameworld:
FirstShadow.Shadow = CreateShadow( UI\SHADOW_QUALITY )
ShadowRange FirstShadow, 50
ShadowPower FirstShadow, 0.6
ShadowColor FirstShadow, 180, 200, 255
FirstShadowTexture = ShadowTexture(FirstShadow)
ShadowLight FirstShadow , GAMEDATA\light1
EntityTexture GAMEDATA\Terrain , FirstShadowTexture , 0, 1
EntityTexture GAMEDATA\ground , FirstShadowTexture , 0, 1
CreateShadowCaster firstshadow , GAMEDATA\vehicle1\SHADOWMESH
UpdateShadows GAMEDATA\camera1
So it appears that although I'm setting my game's light as the shadowcaster, the auto-created light still exists, meaning that my gameworld is twice as bright as it should be, which had me confused for about 2 hours looking for the bug in my code.
It also appears that another camera is created by the shadow system, meaning I have 2 cameras in the world. Whether this causes any slowdown I don't know.
Mikhail, can you explain what I should do about this extra light? To delete it I seem to need to modify much of your shadow code so everytime you update Fastlibs it will break my game again.
|