EntityHidden(), BufferWidth()...lotsa new commands

Blitz3D Forums/Blitz3D Programming/EntityHidden(), BufferWidth()...lotsa new commands


'Sibling' implies a hierarchel organization, when there is none here.



Yes there is. That's why I implied it. Your NextEntity and LastEntity functions follow links to the next and previous entities at the same level in the hierarchy.

To continue...

Light values are encoded in another structure addressed at light+576:
Lighttype Int at +0 (1=Point, 2=Spot, 3=directional) (yes, you can write this location).
Lightcolors are floats at +4,8,12,16 (RGBA) (These are the diffuse values in DirectX speak)
Light Global x,y,z position is stored at +52,56,60
Lightrange is a float at +88 stored as 1.0/lightrange.
lightconeangles are floats at +96,100 stored as radians. (multiply by 57.2957795 to get degrees)

This structure merits further investigation...

Light rotation effects floats at +64,68,72. I suspect these values are in fact the lights normalized global direction vector in x,y,z.

The float at +76 seems to control the maximum range of the light (for point and spot lights). This is not at all like LightRange (or the other attenuation parameters mentioned below) which define how the light falls off, this defines where the light stops altogether. Quite a useful one.

Additional attenuation parameters seem to be stored as floats at +84 and +92 though they are always zero by default. I suspect they correspond to the Constant and Quadratic attenuation terms in the lighting equation, so LightRange itself just alters the Linear term. (Try values between 0 and 1 for the Constant term and between 0.001 and 0.02 for the quadratic term).

There is another float at +80 which seems to alter the attenuation for spotlights in some way. I suspect it changes the the way light falls off between the inner and outer angles. (see article referenced below)

The values at +20,24,28,32 are floats that store the specular color of the light (RGBA). (lets you change the color/intensity of those nice shiny highlights enabled by EntityShininess)

The values at +36,40,44,48 are floats that define the ambient light level. (it seems you can specify an ambient light level for each light, as well as an overall ambient level in DX7)

Diffuse, ambient and specular colors all have an alpha component. I just need to figure out how to use them. They probably have limited applicability.

You can achieve some interesting results by tweaking some or all of these additional parameters. Shame they are not available natively because they all seem fully functional.

This article explains what is available DirectX wise. Yeah its DX8 but most of it seems to be applicable to DX7.
http://www.andypike.com/tutorials/directx8/007.asp
Then of course there is MSDN... http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndir3d/html/dx7light.asp

Might have a "poke" around on the materials side of things next.