diff options
Diffstat (limited to 'src/renderer/Camera.zig')
-rw-r--r-- | src/renderer/Camera.zig | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/renderer/Camera.zig b/src/renderer/Camera.zig index 9ab305c..31620e8 100644 --- a/src/renderer/Camera.zig +++ b/src/renderer/Camera.zig @@ -1,6 +1,8 @@ const std = @import("std"); const ecs = @import("ecs"); -const math = @import("../math.zig"); +const sideros = @import("sideros"); +const math = sideros.math; + const Camera = @This(); const UP = @Vector(3, f32){ 0.0, 1.0, 0.0 }; @@ -19,15 +21,15 @@ front: @Vector(3, f32), up: @Vector(3, f32), speed: f32 = 2.5, -fn getProjection(width: usize, height: usize) math.Matrix { +pub fn getProjection(width: usize, height: usize) math.Matrix { return math.Matrix.perspective(math.rad(45.0), (@as(f32, @floatFromInt(width)) / @as(f32, @floatFromInt(height))), 0.1, 10.0); } -fn getView(self: Camera) math.Matrix { +pub fn getView(self: Camera) math.Matrix { math.lookAt(self.position, self.position + self.front, self.up); } -fn moveCamera(pool: *ecs.Pool) void { +pub fn moveCamera(pool: *ecs.Pool) void { const input = pool.resources.input; const camera = pool.resources.camera; if (input.isKeyDown(.w)) { |