DirectX9 Assistance Required

closed account (zb0S216C)
I'm working on a wrapper for DirectX9, and it's coming along nicely. My current objective is to construct a handler for lights. However, IDirect3DDevice9::SetLight( ) and IDirect3DDevice9::LightEnable( ) are confusing me. The first parameter of both methods don't make sense to me. As for MSDN, it simply isn't clear enough to be classed as a suitable solution.

IDirect3DDevice9::SetLight( ) Declaration:
HRESULT SetLight( DWORD Index, const D3DLIGHT9 *pLight );

MSDN's description of DWORD Index:
MSDN wrote:
Zero-based index of the set of lighting properties to set. If a set of lighting properties exists at this index, it is overwritten by the new properties specified in pLight. (sic)


IDirect3DDevice9::LightEnable( ) Declaration:
HRESULT LightEnable( DWORD LightIndex, BOOL bEnable );
MSDN wrote:
Zero-based index of the set of lighting parameters that are the target of this method. (sic)


What're these lighting parameters/properties they're referring to?

References:
IDirect3DDevice9::LightEnable( ): http://msdn.microsoft.com/en-us/library/bb174421(v=vs.85).aspx
IDirect3DDevice9::SetLight( ): http://msdn.microsoft.com/en-us/library/bb174436(v=vs.85).aspx


Wazzak
Last edited on
In LightEnable(), lightIndex just indexes the light you want to work on. When you call LightEnable() to turn on or off a particular light, how could the function know which light you are referring to? The D3DLIGHT object itself is not passed into the function, the light is identified by the index, and a light is linked to an index when you create that light with SetLight()
Last edited on
closed account (zb0S216C)
That clears things up :) Thanks, Quirk.

Wazzak
Topic archived. No new replies allowed.