#pragma once
#include <vector>
#include <list>
#include <fstream>
#include <string>

enum Mtyp {
	null,
	dynamicMesh,
	cloth,
	bone,
	staticMesh,
	shadowMesh = 6
};

struct ChunkHeader {
	char name[5];
	std::uint32_t size;
	std::streampos position;
};

struct Modl {
	std::string name;
	std::string parent;
	Mtyp type;
	std::uint32_t zeroBaseIndex;
	std::uint32_t renderFlags;
	struct {
		float scale[3];
		float rotation[4];
		float translation[3];
	} tran;
	struct {
		std::uint32_t type;
		float data1;
		float data2;
		float data3;
	} swci;
};


class Object
{
public:
	Object(const char* path);
	~Object();

private:

	std::list<ChunkHeader*> lChunkMsh2;
	std::list<Modl*> lModls;
	std::fstream fsMesh;


private:
	void loadChunks(std::list<ChunkHeader*> &destination, std::streampos start, const std::uint32_t end);
	void analyseModlChunks(Modl* dataDestination, std::list<ChunkHeader*> &chunkList);
	void analyseGeomChunks(Modl* dataDestination, std::list<ChunkHeader*> &chunkList);
	void analyseSegmChunks(Modl* dataDestination, std::list<ChunkHeader*> &chunkList);
	void analyseClthChunks(Modl* dataDestination, std::list<ChunkHeader*> &chunkList);

public:

};
