TINYGL: Fixed reading outside of buffer

This commit is contained in:
Paweł Kołodziejski 2021-11-27 01:09:40 +01:00
parent 789825386a
commit 8422a9720e
No known key found for this signature in database
GPG Key ID: 0BDADC9E74440FF7

View File

@ -451,9 +451,12 @@ void tglLightfv(int light, int type, const float *v) {
p[0].op = TinyGL::OP_Light;
p[1].i = light;
p[2].i = type;
// TODO: 3 composants
for (int i = 0; i < 4; i++)
p[3 + i].f = v[i];
for (int i = 0; i < 4; i++) {
if (type != TGL_SPOT_DIRECTION)
p[3 + i].f = v[i];
else
p[3 + i].f = 0.0f;
}
TinyGL::gl_add_op(p);
}