diff options
Diffstat (limited to 'opengl')
-rw-r--r-- | opengl/libagl/light.cpp | 11 | ||||
-rw-r--r-- | opengl/libagl/matrix.cpp | 2 | ||||
-rw-r--r-- | opengl/libagl/primitives.cpp | 2 |
3 files changed, 11 insertions, 4 deletions
diff --git a/opengl/libagl/light.cpp b/opengl/libagl/light.cpp index 8ae32cc..f211bca 100644 --- a/opengl/libagl/light.cpp +++ b/opengl/libagl/light.cpp @@ -216,6 +216,8 @@ static inline void light_picker(ogles_context_t* c) static inline void validate_light_mvi(ogles_context_t* c) { uint32_t en = c->lighting.enabledLights; + // Vector from object to viewer, in eye coordinates + const vec4_t eyeViewer = { 0, 0, 0x1000, 0 }; while (en) { const int i = 31 - gglClz(en); en &= ~(1<<i); @@ -223,6 +225,9 @@ static inline void validate_light_mvi(ogles_context_t* c) c->transforms.mvui.point4(&c->transforms.mvui, &l.objPosition, &l.position); vnorm3(l.normalizedObjPosition.v, l.objPosition.v); + c->transforms.mvui.point4(&c->transforms.mvui, + &l.objViewer, &eyeViewer); + vnorm3(l.objViewer.v, l.objViewer.v); } } @@ -379,9 +384,9 @@ void lightVertex(ogles_context_t* c, vertex_t* v) // specular if (ggl_unlikely(s && l.implicitSpecular.v[3])) { vec4_t h; - h.x = d.x; - h.y = d.y; - h.z = d.z + 0x10000; + h.x = d.x + l.objViewer.x; + h.y = d.y + l.objViewer.y; + h.z = d.z + l.objViewer.z; vnorm3(h.v, h.v); s = dot3(n.v, h.v); s = (s<0) ? (twoSide?(-s):0) : s; diff --git a/opengl/libagl/matrix.cpp b/opengl/libagl/matrix.cpp index 0b68dc0..21ef50e 100644 --- a/opengl/libagl/matrix.cpp +++ b/opengl/libagl/matrix.cpp @@ -696,6 +696,8 @@ void ogles_viewport(ogles_context_t* c, f[2] = 0; f[6] = 0; f[10] = A; f[14] = B; f[3] = 0; f[7] = 0; f[11] = 0; f[15] = 1; c->transforms.dirty |= transform_state_t::VIEWPORT; + if (c->transforms.mvp4.flags & transform_t::FLAGS_2D_PROJECTION) + c->transforms.dirty |= transform_state_t::MVP; } // ---------------------------------------------------------------------------- diff --git a/opengl/libagl/primitives.cpp b/opengl/libagl/primitives.cpp index f164c02..769ec40 100644 --- a/opengl/libagl/primitives.cpp +++ b/opengl/libagl/primitives.cpp @@ -369,7 +369,7 @@ void compute_iterators_t::iterators0032(int32_t* it, int32_t c0, int32_t c1, int32_t c2) const { int64_t it64[3]; - iterators0032(it, c0, c1, c2); + iterators0032(it64, c0, c1, c2); it[0] = it64[0]; it[1] = it64[1]; it[2] = it64[2]; |