1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 19:32:49 +01:00
openrw/framework2/include/renderwure/loaders/LoaderDFF.hpp

77 lines
1.3 KiB
C++
Raw Normal View History

2013-07-02 08:06:03 +02:00
#pragma once
#ifndef _LOADERDFF_HPP_
#define _LOADERDFF_HPP_
2013-07-02 08:06:03 +02:00
#define GLEW_STATIC
#include <GL/glew.h>
#include "../../framework/rwbinarystream.h"
#include <vector>
#include <string>
#include <memory>
class Model
{
public:
RW::BSClump clump;
struct Texture {
std::string name;
std::string alphaName;
};
struct Material {
std::vector<Texture> textures;
uint32_t colour;
2013-07-05 03:15:29 +02:00
float diffuseIntensity;
float ambientIntensity;
2013-07-02 08:06:03 +02:00
};
struct SubGeometry {
GLuint EBO;
size_t material;
std::vector<uint32_t> indices;
};
struct Geometry {
GLuint VBO, EBO;
RW::BSGeometryBounds geometryBounds;
uint32_t flags;
2013-07-02 08:06:03 +02:00
std::vector<RW::BSGeometryUV> texcoords;
std::vector<RW::BSGeometryTriangle> triangles;
2013-07-05 03:15:29 +02:00
std::vector<glm::vec4> colours;
2013-07-02 08:06:03 +02:00
std::vector<RW::BSTVector3> vertices;
std::vector<RW::BSTVector3> normals;
std::vector<Material> materials;
std::vector<SubGeometry> subgeom;
};
struct Atomic {
uint32_t frame;
uint32_t geometry;
};
std::vector<std::string> frameNames;
2013-07-02 08:06:03 +02:00
std::vector<Geometry> geometries;
std::vector<Atomic> atomics;
std::vector<RW::BSFrameListFrame> frames;
2013-07-02 08:06:03 +02:00
};
class LoaderDFF
{
private:
template<class T> T readStructure(char *data, size_t &dataI);
RW::BSSectionHeader readHeader(char *data, size_t &dataI);
public:
std::unique_ptr<Model> loadFromMemory(char *data);
};
#endif