objfile.h 925 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. BoundingBox bounds;
  32. public:
  33. OBJFile();
  34. OBJFile(const char *filepath);
  35. int parseOBJFile(const char *content);
  36. BoundingBox getLocalBounds();
  37. bool haveFiniteBounds() { return true; };
  38. };
  39. #endif /* DORAYME_OBJFILE_H */