u/distortion: Filp order of array access in distortion for Vive & Index

This commit is contained in:
Jakob Bornecrantz 2021-01-23 23:48:26 +00:00
parent 0c2d07808c
commit 7d755427e3
4 changed files with 4 additions and 3 deletions

View file

@ -143,7 +143,7 @@ u_compute_distortion_vive(struct u_vive_values *values, float u, float v, struct
float r2 = m_vec2_dot(texCoord, texCoord);
float d_inv =
((r2 * val.coefficients[2][i] + val.coefficients[1][i]) * r2 + val.coefficients[0][i]) * r2 + 1.0;
((r2 * val.coefficients[i][2] + val.coefficients[i][1]) * r2 + val.coefficients[i][0]) * r2 + 1.0;
float d = 1.0 / d_inv;
struct xrt_vec2 offset = {0.5, 0.5};

View file

@ -628,6 +628,7 @@ oh_device_create(ohmd_context *ctx, ohmd_device *dev, const char *prod)
ohd->distortion.vive[1].center[2].x = -0.08933516629552526f;
ohd->distortion.vive[1].center[2].y = -0.006014565287238661f;
//! @todo These values are most likely wrong, needs to be transposed and correct channel.
// left
// green
ohd->distortion.vive[0].coefficients[0][0] = -0.188236068524731f;

View file

@ -902,7 +902,7 @@ _get_color_coeffs(struct u_vive_values *values, const cJSON *coeffs, uint8_t eye
size_t i = 0;
cJSON_ArrayForEach(item, coeffs)
{
values->coefficients[i][channel] = (float)item->valuedouble;
values->coefficients[channel][i] = (float)item->valuedouble;
++i;
if (i == 3) {
break;

View file

@ -37,7 +37,7 @@ _get_color_coeffs(struct u_vive_values *values, const cJSON *coeffs, uint8_t eye
size_t i = 0;
cJSON_ArrayForEach(item, coeffs)
{
values->coefficients[i][channel] = (float)item->valuedouble;
values->coefficients[channel][i] = (float)item->valuedouble;
++i;
if (i == 3) {
break;