Sending full transform info (rot, scale, translation) to srender.
parent
0624a7e1ac
commit
e47be90fac
|
@ -238,14 +238,37 @@ void simulator_draw(srcmdbuf* cmdbuf) {
|
||||||
gLog("Error: cannot render shape of type %d", cinfo.second.mType);
|
gLog("Error: cannot render shape of type %d", cinfo.second.mType);
|
||||||
}
|
}
|
||||||
|
|
||||||
rcmd.mat = simd4x4f_create(
|
simd4x4f trans = simd4x4f_create (
|
||||||
// clang-format off
|
// clang-format off
|
||||||
simd4f_create(cinfo.second.scale[0] * 0.5f, 0.f, 0.f, 0.f),
|
simd4f_create(1.f, 0.f, 0.f, 0.f),
|
||||||
simd4f_create(0.f, cinfo.second.scale[1] * 0.5f, 0.f, 0.f),
|
simd4f_create(0.f, 1.f, 0.f, 0.f),
|
||||||
simd4f_create(0.f, 0.f, cinfo.second.scale[2] * 0.5f, 0.f),
|
simd4f_create(0.f, 0.f, 1.f, 0.f),
|
||||||
simd4f_create(cinfo.second.pos[0], cinfo.second.pos[1], cinfo.second.pos[2], 1.f)
|
simd4f_create(cinfo.second.pos[0], cinfo.second.pos[1], cinfo.second.pos[2], 1.f)
|
||||||
// clang-format on
|
// clang-format on
|
||||||
);
|
);
|
||||||
|
|
||||||
|
simd4x4f scale = simd4x4f_create(
|
||||||
|
// clang-format off
|
||||||
|
simd4f_create(cinfo.second.scale[0], 0.f, 0.f, 0.f),
|
||||||
|
simd4f_create(0.f, cinfo.second.scale[1], 0.f, 0.f),
|
||||||
|
simd4f_create(0.f, 0.f, cinfo.second.scale[2], 0.f),
|
||||||
|
simd4f_create(0.f, 0.f, 0.f, 1.f)
|
||||||
|
// clang-format on
|
||||||
|
);
|
||||||
|
|
||||||
|
Matrix3d R = cinfo.second.orientation.toMatrix();
|
||||||
|
simd4x4f rot = simd4x4f_create(
|
||||||
|
// clang-format off
|
||||||
|
simd4f_create(R(0,0), R(0,1), R(0,2), 0.f),
|
||||||
|
simd4f_create(R(1,0), R(1,1), R(1,2), 0.f),
|
||||||
|
simd4f_create(R(2,0), R(2,1), R(2,2), 0.f),
|
||||||
|
simd4f_create(0.f, 0.f, 0.f, 1.f)
|
||||||
|
// clang-format on
|
||||||
|
);
|
||||||
|
|
||||||
|
simd4x4f rot_scale;
|
||||||
|
simd4x4f_matrix_mul(&rot, &scale, &rot_scale);
|
||||||
|
simd4x4f_matrix_mul(&trans, &rot_scale, &rcmd.mat);
|
||||||
srcmdbuf_add(cmdbuf, &rcmd);
|
srcmdbuf_add(cmdbuf, &rcmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -554,9 +554,9 @@ void init_debug_meshes() {
|
||||||
// gLog ("idx: %d # phi: %f, theta %f, p = %f, %f, %f", vert_index, phi * 180 / M_PI, theta * 180 / M_PI, x, y, z);
|
// gLog ("idx: %d # phi: %f, theta %f, p = %f, %f, %f", vert_index, phi * 180 / M_PI, theta * 180 / M_PI, x, y, z);
|
||||||
|
|
||||||
srvrtxdata* vertex = &uvsphere_vertices[vert_index++];
|
srvrtxdata* vertex = &uvsphere_vertices[vert_index++];
|
||||||
vertex->x = x;
|
vertex->x = x * 0.5;
|
||||||
vertex->y = y;
|
vertex->y = y * 0.5;
|
||||||
vertex->z = z;
|
vertex->z = z * 0.5;
|
||||||
vertex->w = 1.0f;
|
vertex->w = 1.0f;
|
||||||
|
|
||||||
vertex->nx = x;
|
vertex->nx = x;
|
||||||
|
|
Loading…
Reference in New Issue