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.
33 lines
765 B
33 lines
765 B
#pragma once
|
|
|
|
class Tesselator
|
|
{
|
|
public:
|
|
typedef std::vector<Vec3> VertexList;
|
|
typedef std::unordered_map<Vec3, size_t> VertexIndexMap;
|
|
typedef std::pair<Vec3, const texinfo_t*> VertexTexturePair;
|
|
typedef std::map<VertexTexturePair, Vec3> VertexUVMap;
|
|
|
|
struct Polygon
|
|
{
|
|
const texinfo_t* texinfo;
|
|
std::vector<size_t> indices;
|
|
};
|
|
|
|
Tesselator(const world_t* world) : world(world)
|
|
{
|
|
}
|
|
|
|
const VertexList& getVertices() const { return vertices; }
|
|
const VertexIndexMap& getVertexIndices() const { return vertexIndices; }
|
|
const VertexUVMap& getVertexUVs() const { return vertexUVs; }
|
|
|
|
std::vector<Polygon> tesselateFace(const face_t* face);
|
|
|
|
private:
|
|
const world_t* world;
|
|
|
|
VertexList vertices;
|
|
VertexIndexMap vertexIndices;
|
|
VertexUVMap vertexUVs;
|
|
};
|