free camera

This commit is contained in:
Fabien Freling 2021-05-27 22:44:29 +02:00
parent 7d830d13d1
commit d6ba8e354c
2 changed files with 37 additions and 12 deletions

View file

@ -117,12 +117,19 @@ pub fn main() anyerror!void {
Sphere{ .center = Point3{ .x = 0, .y = -100.5, .z = -1 }, .radius = 100, .material = materialGround },
Sphere{ .center = Point3{ .x = 0, .y = 0, .z = -1 }, .radius = 0.5, .material = materialCenter },
Sphere{ .center = Point3{ .x = -1, .y = 0, .z = -1 }, .radius = 0.5, .material = materialLeft },
Sphere{ .center = Point3{ .x = -1, .y = 0, .z = -1 }, .radius = -0.45, .material = materialLeft },
Sphere{ .center = Point3{ .x = 1, .y = 0, .z = -1 }, .radius = 0.5, .material = materialRight },
};
const world = World{ .spheres = spheres[0..spheres.len] };
// Camera
const camera = Camera.init();
const camera = Camera.init(
Point3{ .x = -2, .y = 2, .z = 1 },
Point3{ .x = 0, .y = 0, .z = -1 },
Vec3{ .x = 0, .y = 1, .z = 0 },
20.0,
aspectRatio
);
const window = sdl.c.SDL_CreateWindow(
"Raytracing in One Weekend",