Commit a9432a5c authored by Jakob Bornecrantz's avatar Jakob Bornecrantz

HACK

parent a0ff32a4
Pipeline #220235 passed with stages
in 1 minute and 39 seconds
......@@ -153,6 +153,8 @@ vk_swapchain_create(struct vk_swapchain *sc,
VkExtent2D extent =
vk_swapchain_select_extent(sc, surface_caps, width, height);
fprintf(stderr, "RESIZE %i %i\n", extent.width, extent.height);
VkSwapchainCreateInfoKHR swap_chain_info = {
.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
.surface = sc->surface,
......
......@@ -20,6 +20,7 @@
#include "util/u_debug.h"
#include "util/u_device.h"
#include "util/u_logging.h"
#include "util/u_distortion.h"
#include "util/u_distortion_mesh.h"
#include <stdio.h>
......@@ -47,6 +48,8 @@ struct dummy_hmd
float diameter_m;
enum u_logging_level log_level;
struct u_cardboard_distortion cardboard;
};
......@@ -147,6 +150,18 @@ dummy_hmd_get_view_pose(struct xrt_device *xdev,
*out_pose = pose;
}
static bool
dummy_hmd_compute_distortion(struct xrt_device *xdev,
int view,
float u,
float v,
struct xrt_uv_triplet *result)
{
struct dummy_hmd *dh = dummy_hmd(xdev);
return u_compute_distortion_cardboard(&dh->cardboard.values[view], u, v,
result);
}
struct xrt_device *
dummy_hmd_create(void)
{
......@@ -156,6 +171,7 @@ dummy_hmd_create(void)
dh->base.update_inputs = dummy_hmd_update_inputs;
dh->base.get_tracked_pose = dummy_hmd_get_tracked_pose;
dh->base.get_view_pose = dummy_hmd_get_view_pose;
dh->base.compute_distortion = dummy_hmd_compute_distortion;
dh->base.destroy = dummy_hmd_destroy;
dh->base.name = XRT_DEVICE_GENERIC_HMD;
dh->base.device_type = XRT_DEVICE_TYPE_HMD;
......@@ -170,22 +186,41 @@ dummy_hmd_create(void)
// Setup input.
dh->base.inputs[0].name = XRT_INPUT_GENERIC_HEAD_POSE;
// Setup info.
struct u_device_simple_info info;
info.display.w_pixels = 1280;
info.display.h_pixels = 720;
info.display.w_meters = 0.13f;
info.display.h_meters = 0.07f;
info.lens_horizontal_separation_meters = 0.13f / 2.0f;
info.lens_vertical_position_meters = 0.07f / 2.0f;
info.views[0].fov = 85.0f * (M_PI / 180.0f);
info.views[1].fov = 85.0f * (M_PI / 180.0f);
if (!u_device_setup_split_side_by_side(&dh->base, &info)) {
DH_ERROR(dh, "Failed to setup basic device info");
dummy_hmd_destroy(&dh->base);
return NULL;
}
#if 0
const uint32_t w_pixels = 2160;
const uint32_t h_pixels = 1080;
const uint32_t ppi = 439;
#else
const uint32_t w_pixels = 2960;
const uint32_t h_pixels = 1440;
const uint32_t ppi = 572;
#endif
const float angle = 45 * M_PI / 180.0; // 0.698132; // 40Deg in rads
const float w_meters = ((float)w_pixels / (float)ppi) * 0.0254f;
const float h_meters = ((float)h_pixels / (float)ppi) * 0.0254f;
struct u_cardboard_distortion_arguments args = {
.distortion_k = {0.441f, 0.156f, 0.f, 0.f, 0.f},
.screen =
{
.w_pixels = w_pixels,
.h_pixels = h_pixels,
.w_meters = w_meters,
.h_meters = h_meters,
},
.inter_lens_distance_meters = 0.06f,
.lens_y_center_on_screen_meters = h_meters / 2.0f,
.screen_to_lens_distance_meters = 0.042f,
.fov =
{
.angle_left = -angle,
.angle_right = angle,
.angle_up = angle,
.angle_down = -angle,
},
};
u_distortion_cardboard_calculate(&args, dh->base.hmd, &dh->cardboard);
// Setup variable tracker.
u_var_add_root(dh, "Dummy HMD", true);
......@@ -194,8 +229,8 @@ dummy_hmd_create(void)
u_var_add_f32(dh, &dh->diameter_m, "diameter_m");
u_var_add_log_level(dh, &dh->log_level, "log_level");
// Distortion information, fills in xdev->compute_distortion().
u_distortion_mesh_set_none(&dh->base);
// Distortion information.
u_distortion_mesh_fill_in_compute(&dh->base);
return &dh->base;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment