mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-24 11:36:22 +00:00
TINYGL: Fixed a problem with shadows.
This commit is contained in:
parent
d31c3e7744
commit
9be1423802
@ -213,10 +213,10 @@ void glopFrustum(GLContext *c, GLParam *p) {
|
||||
C = -(farp + nearp) / (farp - nearp);
|
||||
D = (float)(-(2.0 * farp * nearp) / (farp - nearp));
|
||||
|
||||
m.set(0,0, x); m.set(1,0, 0); m.set(2,0, A); m.set(3,0, 0);
|
||||
m.set(0,1, 0); m.set(1,1, y); m.set(2,1, B); m.set(3,1, 0);
|
||||
m.set(0,2, 0); m.set(1,2, 0); m.set(2,2, C); m.set(3,2, D);
|
||||
m.set(0,3, 0); m.set(1,3, 0); m.set(2,3, -1); m.set(3,3, 0);
|
||||
m.set(0, 0, x); m.set(0, 1, 0); m.set(0, 2, A); m.set(0, 3, 0);
|
||||
m.set(1, 0, 0); m.set(1, 1, y); m.set(1, 2, B); m.set(1, 3, 0);
|
||||
m.set(2, 0, 0); m.set(2, 1, 0); m.set(2, 2, C); m.set(2, 3, D);
|
||||
m.set(3, 0, 0); m.set(3, 1, 0); m.set(3, 2, -1); m.set(3, 3, 0);
|
||||
|
||||
*c->matrix_stack_ptr[c->matrix_mode] *= m;
|
||||
|
||||
|
@ -69,7 +69,7 @@ void glopBegin(GLContext *c, GLParam *p) {
|
||||
c->matrix_model_projection = (*c->matrix_stack_ptr[1]) * (*c->matrix_stack_ptr[0]);
|
||||
// test to accelerate computation
|
||||
c->matrix_model_projection_no_w_transform = 0;
|
||||
if (c->matrix_model_projection.get(0,3) == 0.0 && c->matrix_model_projection.get(1,3) == 0.0 && c->matrix_model_projection.get(2,3) == 0.0)
|
||||
if (c->matrix_model_projection.get(3,0) == 0.0 && c->matrix_model_projection.get(3,1) == 0.0 && c->matrix_model_projection.get(3,2) == 0.0)
|
||||
c->matrix_model_projection_no_w_transform = 1;
|
||||
}
|
||||
|
||||
@ -128,11 +128,15 @@ static inline void gl_vertex_transform(GLContext *c, GLVertex *v) {
|
||||
|
||||
// projection coordinates
|
||||
m = c->matrix_stack_ptr[1];
|
||||
v->pc = m->transform(v->ec);
|
||||
|
||||
/*
|
||||
// NOTE: this transformation is not an ordinary matrix vector multiplication.
|
||||
v->pc = Vector4(v->ec.getX() * m->get(0, 0) + v->ec.getY() * m->get(1, 0) + v->ec.getZ() * m->get(2, 0) + v->ec.getW() * m->get(3, 0),
|
||||
v->ec.getX() * m->get(0, 1) + v->ec.getY() * m->get(1, 1) + v->ec.getZ() * m->get(2, 1) + v->ec.getW() * m->get(3, 1),
|
||||
v->ec.getX() * m->get(0, 2) + v->ec.getY() * m->get(1, 2) + v->ec.getZ() * m->get(2, 2) + v->ec.getW() * m->get(3, 2),
|
||||
v->ec.getX() * m->get(0, 3) + v->ec.getY() * m->get(1, 3) + v->ec.getZ() * m->get(2, 3) + v->ec.getW() * m->get(3, 3));
|
||||
*/
|
||||
|
||||
m = &c->matrix_model_view_inv;
|
||||
n = &c->current_normal;
|
||||
|
@ -200,9 +200,9 @@ Matrix4 Matrix4::rotation(float t, int u) {
|
||||
|
||||
Vector3 Matrix4::transform(const Vector3 &vector) const {
|
||||
return Vector3(
|
||||
vector.getX() * get(0, 0) + vector.getY() * get(1, 0) + vector.getZ() * get(2, 0) + get(3, 0),
|
||||
vector.getX() * get(0, 1) + vector.getY() * get(1, 1) + vector.getZ() * get(2, 1) + get(3, 1),
|
||||
vector.getX() * get(0, 2) + vector.getY() * get(1, 2) + vector.getZ() * get(2, 2) + get(3, 2));
|
||||
vector.getX() * get(0, 0) + vector.getY() * get(0, 1) + vector.getZ() * get(0, 2) + get(0, 3),
|
||||
vector.getX() * get(1, 0) + vector.getY() * get(1, 1) + vector.getZ() * get(1, 2) + get(1, 3),
|
||||
vector.getX() * get(2, 0) + vector.getY() * get(2, 1) + vector.getZ() * get(2, 2) + get(2, 3));
|
||||
}
|
||||
|
||||
Vector3 Matrix4::transform3x3(const Vector3 &vector) const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user