您最多选择25个主题
主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
67 行
1.0 KiB
67 行
1.0 KiB
#ifndef __MODEL_H
|
|
#define __MODEL_H
|
|
|
|
#include <iostream>
|
|
#include <vector>
|
|
#include "../punkt2d.h"
|
|
#include "../punkt3d.h"
|
|
#include "../gltexture.h"
|
|
#include "../glcolor.h"
|
|
// #include "load3ds.h"
|
|
|
|
|
|
class Material {
|
|
friend class Load3ds;
|
|
friend class ModelObject;
|
|
private:
|
|
std::string name;
|
|
|
|
GLColor ambient;
|
|
GLColor diffuse;
|
|
GLColor specular;
|
|
float percent;
|
|
public:
|
|
Material();
|
|
|
|
void clear();
|
|
std::string getName();
|
|
};
|
|
|
|
|
|
class ModelObject {
|
|
friend class Load3ds;
|
|
private:
|
|
std::vector<Punkt3D> normal;
|
|
std::vector<Punkt3D> vertex;
|
|
std::vector<Punkt2D> mapcoord;
|
|
std::vector<Punkt3D> polygon;
|
|
void calcNormales();
|
|
std::string name;
|
|
|
|
Material mat;
|
|
public:
|
|
ModelObject();
|
|
|
|
std::string getName();
|
|
void render();
|
|
void clear();
|
|
|
|
};
|
|
|
|
class Model {
|
|
private:
|
|
std::vector<ModelObject> objects;
|
|
std::vector<Material> materials;
|
|
|
|
public:
|
|
Model();
|
|
void addObject(ModelObject c);
|
|
void addMaterial(Material m);
|
|
void clear();
|
|
void render();
|
|
|
|
Material findMaterial(std::string name);
|
|
};
|
|
|
|
#endif
|