2008-04-11 16:43:46 +02:00
|
|
|
#ifndef __MODEL_H
|
|
|
|
#define __MODEL_H
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <vector>
|
|
|
|
#include "../punkt2d.h"
|
|
|
|
#include "../punkt3d.h"
|
|
|
|
#include "../gltexture.h"
|
2008-04-13 03:17:27 +02:00
|
|
|
#include "../glcolor.h"
|
2008-04-11 16:43:46 +02:00
|
|
|
// #include "load3ds.h"
|
|
|
|
|
2008-04-13 03:17:27 +02:00
|
|
|
|
|
|
|
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();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-04-11 16:43:46 +02:00
|
|
|
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;
|
2008-04-13 03:17:27 +02:00
|
|
|
|
|
|
|
Material mat;
|
2008-04-11 16:43:46 +02:00
|
|
|
public:
|
|
|
|
ModelObject();
|
|
|
|
|
2008-04-13 03:17:27 +02:00
|
|
|
std::string getName();
|
2008-04-11 16:43:46 +02:00
|
|
|
void render();
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class Model {
|
|
|
|
private:
|
|
|
|
std::vector<ModelObject> objects;
|
2008-04-13 03:17:27 +02:00
|
|
|
std::vector<Material> materials;
|
2008-04-11 16:43:46 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
Model();
|
|
|
|
void addObject(ModelObject c);
|
2008-04-13 03:17:27 +02:00
|
|
|
void addMaterial(Material m);
|
2008-04-11 16:43:46 +02:00
|
|
|
void clear();
|
|
|
|
void render();
|
2008-04-13 03:17:27 +02:00
|
|
|
|
|
|
|
Material findMaterial(std::string name);
|
2008-04-11 16:43:46 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|