Adding Project Files
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#ifndef __MODEL_H__
|
||||
#define __MODEL_H__
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "geometry.h"
|
||||
#include "tgaimage.h"
|
||||
|
||||
class Model {
|
||||
private:
|
||||
std::vector<Vec3f> verts_;
|
||||
std::vector<std::vector<Vec3i> > faces_; // attention, this Vec3i means vertex/uv/normal
|
||||
std::vector<Vec3f> norms_;
|
||||
std::vector<Vec2f> uv_;
|
||||
TGAImage diffusemap_;
|
||||
TGAImage normalmap_;
|
||||
TGAImage specularmap_;
|
||||
void load_texture(std::string filename, const char *suffix, TGAImage &img);
|
||||
public:
|
||||
Model(const char *filename);
|
||||
~Model();
|
||||
int nverts();
|
||||
int nfaces();
|
||||
Vec3f normal(int iface, int nthvert);
|
||||
Vec3f normal(Vec2f uv);
|
||||
Vec3f vert(int i);
|
||||
Vec3f vert(int iface, int nthvert);
|
||||
Vec2f uv(int iface, int nthvert);
|
||||
Matrix Transform;
|
||||
Matrix Rotation;
|
||||
Matrix Scale;
|
||||
Matrix Translation;
|
||||
void translate(Vec3f tr);
|
||||
void rotate(Vec3f rot);
|
||||
void scale(Vec3f scl);
|
||||
void ApplyTransform();
|
||||
TGAColor diffuse(Vec2f uv);
|
||||
float specular(Vec2f uv);
|
||||
std::vector<int> face(int idx);
|
||||
};
|
||||
#endif //__MODEL_H__
|
||||
|
||||
Reference in New Issue
Block a user