Closed ghost closed 3 years ago
Hey, I had a play round with this. Just inverting the y position seemed to work for me, IIRC opengl y coordinate is backwards to what you might think. E.g something like:
vec2 coord = vec2(gl_TexCoord[0].x, 1.0 - gl_TexCoord[0].y);
vec2 pixelPos = visibleRect.xy + (visibleRect.zw * coord);
(Also the new D2 textures look mint!)
Thanks, that's it. Visually, I could see it was something like this.
Fixed in last push. It's now using a simpler shader that has lighting in the alpha channel.
A new lighting implementation was added that uses shaders. An array is passed to the shader with the position of the light, intensity and radius (with the closest lights to the player). It's working well for just 1 light (the player's, which is always centered in the texture) but not for floor lights, such as the ones in D1's caves:
The shader is loaded from ShaderManager.cpp - the Level shader
levelText
. and the primitives passed to it are set in Level.cpp's draw function:There must be something I'm missing. I can't get the lights to draw over the water.
PS: zoom kind of breaks light because of how it's drawn. try first to get it working on 100% zoom only.