diff options
Diffstat (limited to 'src/graphics.zig')
| -rw-r--r-- | src/graphics.zig | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/src/graphics.zig b/src/graphics.zig index 5d875f7..8cbb3f7 100644 --- a/src/graphics.zig +++ b/src/graphics.zig @@ -1,22 +1,8 @@ const std = @import("std"); -const mem = std.mem; usingnamespace @import("xrvk.zig"); -const Allocator = std.mem.Allocator; const dg = @import("diligent"); - -fn quat2euler(q: xr.Quaternionf) xr.Vector3f { - const sinr_cosp = 2 * (q.w * q.x + q.y * q.z); - const siny_cosp = 2 * (q.w * q.z + q.x * q.y); - const cosr_cosp = 1 - 2 * (q.x * q.x + q.y * q.y); - const cosy_cosp = 1 - 2 * (q.y * q.y + q.z * q.z); - const sinp = 2 * (q.w * q.y - q.z * q.x); - - return .{ - .x = std.math.atan2(f32, sinr_cosp, cosr_cosp), - .y = if (std.math.fabs(sinp) >= 1) std.math.pi / 2.0 else std.math.asin(sinp), - .z = std.math.atan2(f32, siny_cosp, cosy_cosp), - }; -} +const mem = std.mem; +const Allocator = mem.Allocator; pub const Graphics = struct { xri: xr.InstanceDispatch, @@ -404,7 +390,7 @@ pub const Swapchain = struct { // get images const image_count = try gfx.xri.enumerateSwapchainImages(swapchain, 0, null); const xr_images = try gfx.allocator.alloc(xr.SwapchainImageVulkan2KHR, image_count); - std.mem.set(xr.SwapchainImageVulkan2KHR, xr_images, xr.SwapchainImageVulkan2KHR.empty()); + mem.set(xr.SwapchainImageVulkan2KHR, xr_images, xr.SwapchainImageVulkan2KHR.empty()); defer gfx.allocator.free(xr_images); _ = try gfx.xri.enumerateSwapchainImages(swapchain, image_count, @ptrCast( |
