Small OpenGL based c++ rendering library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

model.h 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef __MODEL_H
  2. #define __MODEL_H
  3. #include <iostream>
  4. #include <vector>
  5. #include "../punkt2d.h"
  6. #include "../punkt3d.h"
  7. #include "../gltexture.h"
  8. #include "../glcolor.h"
  9. // #include "load3ds.h"
  10. class Material {
  11. friend class Load3ds;
  12. friend class ModelObject;
  13. private:
  14. std::string name;
  15. GLColor ambient;
  16. GLColor diffuse;
  17. GLColor specular;
  18. float percent;
  19. public:
  20. Material();
  21. void clear();
  22. std::string getName();
  23. };
  24. class ModelObject {
  25. friend class Load3ds;
  26. private:
  27. std::vector<Punkt3D> normal;
  28. std::vector<Punkt3D> vertex;
  29. std::vector<Punkt2D> mapcoord;
  30. std::vector<Punkt3D> polygon;
  31. void calcNormales();
  32. std::string name;
  33. Material mat;
  34. public:
  35. ModelObject();
  36. std::string getName();
  37. void render();
  38. void clear();
  39. };
  40. class Model {
  41. private:
  42. std::vector<ModelObject> objects;
  43. std::vector<Material> materials;
  44. public:
  45. Model();
  46. void addObject(ModelObject c);
  47. void addMaterial(Material m);
  48. void clear();
  49. void render();
  50. Material findMaterial(std::string name);
  51. };
  52. #endif