Im doing the learnopengl.com tutorials for lights and have some problems figuring out how to get the position of the light from the lightcomp into my code.
Im passing the normals in worldspace from the vertex shader to the fragment shader for making the calculation in the fragment shader:
So easy. It was all there. Sorry, didnt read properly …
uTDLights[0].position.xyz
As well as camera position for calculating specular light. For pulling the xyz position for the camera from the TDMatrix struct. Is it correct to write:
uTDMats[0].cam[0].xyz
At least it doesnt give me any error and behaves more or less as expected.
doesnt provide me of the position of the camera from the cam comp and I cannot find it in the documentation.
My calculation for ambient diffuse and specular behaves as expected as long i hardcode the camera position i worldspace but I guess I can pull the position from the camera comp the same way as I can get the light position?
In the example below I have hardcoded the position.