objfile.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * DoRayMe - a quick and dirty Raytracer
  3. * OBJ File header
  4. *
  5. * Created by Manoël Trapier
  6. * Copyright (c) 2020 986-Studio.
  7. *
  8. */
  9. #ifndef DORAYME_OBJFILE_H
  10. #define DORAYME_OBJFILE_H
  11. #include <shape.h>
  12. #include <renderstat.h>
  13. class OBJFile : public Shape
  14. {
  15. private:
  16. uint32_t allocatedFaceGroupCount;
  17. Shape* *faceGroupList;
  18. uint32_t faceGroupCount;
  19. uint32_t allocatedVertexCount;
  20. Tuple* *vertexList;
  21. uint32_t vertexCount;
  22. private:
  23. Intersect localIntersect(Ray r);
  24. Tuple localNormalAt(Tuple point);
  25. public:
  26. /* Some stats */
  27. uint32_t ignoredLines;
  28. protected:
  29. void addGroup(Shape *group);
  30. void addVertex(Tuple *vertex);
  31. void parseLine(char *line);
  32. int execLine(int argc, char *argv[]);
  33. BoundingBox bounds;
  34. public:
  35. OBJFile();
  36. OBJFile(const char *filepath);
  37. int parseOBJFile(const char *content);
  38. Intersect intersect(Ray r);
  39. BoundingBox getLocalBounds();
  40. BoundingBox getBounds();
  41. void updateBoundingBox();
  42. void updateTransform();
  43. void dumpMe(FILE * fp);
  44. };
  45. #endif /* DORAYME_OBJFILE_H */