TBGL_UseLighting is "On" by default in LIST? "Off" in world?
Interference bettween low level and high level lights
The other issue I was running into, using the entity light, as opposed to the raw-lights...
For my ground, which is a LIST, I have used the samples provided, which has an undocumented use for lighting. Turning the light on an off within the list.
The problem is...
1. I have turned the light "Off" in the scene, prior to the creation of the list. (If I don't turn it off again in the list, it turns on. The light that is "On" in the list)
2. If I don't turn it ON at the end of the list, or if I turn it OFF... it kills the entity lights? (All list objects that follow are pure white. The phantom light that was created, apparently ambient 255,255,255 grows into the scene.)
3. Use-Light, without specifying a light source... renders light? If no light source has been specified... which light is being used to create the "Use light" in the list item or the level. I have set all light sources to, (UseLightSource xxx, 0), and light still renders. The entity light also does not seem to function the same on items in the list. Primitives are brighter, except those with texture, which render nearly black/grey with 255,255,255 light. (This is not ambient light, this is a phantom light that there is no control for.)
Sample code... minus the "Primitives" and M15 samples... (M15 with texture white 255,255,255 and M15 without texture colored 255,255,255)
' -- Create scene
'TBGL_SetupFog(255,255,255,1,0.5) ' -- Sets attributes of fog: R, G, B, Alpha, and density in percents
'TBGL_UseFog %TRUE ' -- Turns on with camera views in control area
' -- This is the "Entity Light"
TBGL_EntityCreateLight(%sScene, %eLight, 0, %TBGL_LIGHTTYPE_POINT)
' -- This entity light is set to ON. (Use light should not control this.)
TBGL_EntitySetUse(%sScene, %eLight, 1)
TBGL_EntitySetPos(%sScene, %eLight, 0, 200, 0)
TBGL_EntitySetTargetPos(%sScene, %eLight, 0, 0, 0)
' -- Everything should be pure black, (Well, ambient 50,50,50 until you fix that.)
'TBGL_EntitySetColor(%sScene, %eLight, 0, 0, 0)
' -- Everything should be full-color (Which is white in this case, except the bright blue water, which renders dark-bluegrey.)
TBGL_EntitySetColor(%sScene, %eLight, 255, 255, 255)
TBGL_UseVsync %FALSE ' -- No gain at the moment...
TBGL_SetDrawDistance(1000) ' -- Initial start-up view. Changes with camera in control area
' -- Default render for scene (Turning off RAW lights, so entity lights function correctly.)
' -- But this is destroyed by the use of LIST below...
' -- Create Ground
TBGL_LoadTexture("ground2.bmp", %iGround, %TBGL_TEX_MIPMAP)
' -- This "List" is rendering with light, though I have set it "Off" for the scene?
' -- If set to TRUE, the entity light does not reach into this model? (Same as not saying TRUE)
TBGL_BeginPoly %GL_QUADS ' -- NOTE: (-256 to +256 = 512)
TBGL_TexCoord2D 0, 1 ' -- (Up Left +x,+z)
TBGL_Vertex 255, 0, 255
TBGL_TexCoord2D 1, 1 ' -- (Up Right -x,+z)
TBGL_Vertex -255, 0, 255
TBGL_TexCoord2D 1, 0 ' -- (Low Right -x,-z)
TBGL_Vertex -255, 0, -255
TBGL_TexCoord2D 0, 0 ' -- (Low Left +x,-z)
TBGL_Vertex 255, 0, -255
' -- If this is not "TRUE", no entity light renders past this point, even if you turn it on.
' -- These do noting if the END of the list is not set to TRUE...
' -- They are turning the ENTITY light on and off... but they should not be controlling the entity light.
' -- Entity light is controlled by the Use Entity setting.
TBGL_EntityCreateDLSlot(%sScene, %eGround, 0, %listGround)
TBGL_EntitySetTexture(%sScene, %eGround, %iGround)
TBGL_EntitySetColor(%sScene, %eGround, 255, 255, 255)
TBGL_EntitySetScale(%sScene, %eGround, 1, 1, 1)
TBGL_EntitySetPos(%sScene, %eGround, 0, 0, 0)
TBGL_EntitySetUse(%sScene, %eGround, 1) ' -- Temp hide/show
I also left the "FOG" in there, which you can use to "See" that a RAW-Light at 0,0,0 in an entity world, sits at -200,40,-40 not at 0,0,0 at the center. You get a similar odd situation with fog, where it thickens as it nears light, and thins as it heads away from light. With an entity light at 0,200,0, which is 200 high at 0,0 center, reflecting on a floor that has an image... with FOG 255,255,255,1,1... The floor center below the light becomes white, all image washed away. While the edges of the floor/corners away from light, in the fog, become full color.
(That was what Eros was complaining about, where he could not see after leaving the start-line. The "Light" which I had set at 0,200,0 was at that location, and turning the objects into the color of the fog. Giving the illusion that the fog became 100% thick at that point, and you could not see anything.)
All this is from the "Sandbox 3" in the game-section. (With the exception of the modified code above, to experiment.)
As for now... it looks like FOG is not an option for entity lighting setups.
Until the ability to modify "Specular" for entity-lights is created... Entity lights are not an option. They erase the texture image and replace it with the color, as opposed to coloring the texture with the light color.
This also sets a nasty limitation of not mixing primitives with hand-created lists, and M15 lists, as they all seem to have their own light-handling concepts. (The same light being in separate locations, and rendered with some attributes on and some off, and creating their own phantom lighting without control.)
The only way around all of this... is to turn all lighting off, and use full-ambient light which has no direction, or shade issues.
I just wanted to note that this is not an issue with pure M15 files and the use of only Entity lighting, with the exception of the light overpowering the texture, and the ambient issue. (Both of those light issues should be resolved once those additional light controls are added.)
It was only the mixing of the non-element fog, with the element-lights and the mixing of non-M15 geometry which is reacting to the non-element lights, and altering the light use controls, which were the cause of "New" trouble. (I believe the alignment issue of light is due to entity creation being centered, while pure geometry seems to be 0,0,0 based off the bottom-left, non-centered.)