hw3render.cpp 793 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * DoRayMe - a quick and dirty Raytracer
  3. * Renderer using hw3 files as world builder.
  4. *
  5. * Created by Manoël Trapier
  6. * Copyright (c) 2020 986-Studio.
  7. *
  8. */
  9. #include <stdio.h>
  10. #include <world.h>
  11. #include <worldbuilder.h>
  12. #include <light.h>
  13. #include <sphere.h>
  14. #include <material.h>
  15. #include <colour.h>
  16. #include <canvas.h>
  17. #include <camera.h>
  18. #include <transformation.h>
  19. int main(int argc, char *argv[])
  20. {
  21. if(argc != 2)
  22. {
  23. printf("usage: %s file.hw3\n", argv[0]);
  24. return -1;
  25. }
  26. Hw3File world = Hw3File(argv[1]);
  27. /* Set the camera resolution */
  28. Camera cam = Camera(640, 480, world.camFoV);
  29. cam.setTransform(world.cam);
  30. /* Now render it */
  31. Canvas image = cam.render(world);
  32. image.SaveAsPNG("hw3render.png");
  33. return 0;
  34. }