Advertisement
topkedi

model.h

Feb 27th, 2025
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #ifndef __MODEL_H__
  2. #define __MODEL_H__
  3.  
  4. #include <vector>
  5. #include "tgaimage.h"
  6. #include "geometry.h"
  7. #include "SimpleMath.h"
  8.  
  9. using namespace DirectX::SimpleMath;
  10.  
  11. class Model {
  12. private:
  13.     std::vector<Vector3> verts_;
  14.     std::vector<std::vector<Vec3i> > faces_; // attention, this Vec3i means vertex/uv/normal
  15.     std::vector<Vector3> norms_;
  16.     std::vector<Vector2> uv_;
  17.     TGAImage diffusemap_;
  18.     TGAImage specularmap_;
  19.     TGAImage normalmap_;
  20.     void load_texture(std::string filename, const char* suffix, TGAImage& img);
  21. public:
  22.     Model(const char* filename);
  23.     ~Model();
  24.     int nverts();
  25.     int nfaces();
  26.     Vector3 vert(int i);
  27.     Vec2i uv(int iface, int nvert);
  28.     TGAColor diffuse(Vec2i uv);
  29.     std::vector<int> face(int idx);
  30.     float specular(Vector3 uvf);
  31.     Vector3 normal(int iface, int nthvert);
  32.     Vector3 vert(int iface, int nthvert);
  33. };
  34.  
  35. #endif //__MODEL_H__
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement