Inverted view matrix
This commit is contained in:
parent
fb031e8a66
commit
c3a85ce50f
2 changed files with 3 additions and 2 deletions
|
|
@ -43,7 +43,8 @@ pub const Matrix = struct {
|
||||||
|
|
||||||
pub fn lookAt(eye: [3]f32, target: [3]f32, arbitrary_up: [3]f32) Matrix {
|
pub fn lookAt(eye: [3]f32, target: [3]f32, arbitrary_up: [3]f32) Matrix {
|
||||||
const t: @Vector(3, f32) = target;
|
const t: @Vector(3, f32) = target;
|
||||||
const e: @Vector(3, f32) = eye;
|
var e: @Vector(3, f32) = eye;
|
||||||
|
e = -e;
|
||||||
const u: @Vector(3, f32) = arbitrary_up;
|
const u: @Vector(3, f32) = arbitrary_up;
|
||||||
const forward = normalize(t - e);
|
const forward = normalize(t - e);
|
||||||
const right = normalize(cross(forward, u));
|
const right = normalize(cross(forward, u));
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ fn init_mods() void {
|
||||||
export fn sideros_init(init: api.GameInit) callconv(.c) void {
|
export fn sideros_init(init: api.GameInit) callconv(.c) void {
|
||||||
pool = ecs.Pool.init(allocator, .{
|
pool = ecs.Pool.init(allocator, .{
|
||||||
.camera = .{
|
.camera = .{
|
||||||
.position = .{ 0.0, 0.0, 5.0 },
|
.position = .{ 5.0, 5.0, 5.0 },
|
||||||
.target = .{ 0.0, 0.0, 0.0 },
|
.target = .{ 0.0, 0.0, 0.0 },
|
||||||
},
|
},
|
||||||
.renderer = undefined,
|
.renderer = undefined,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue