2013-07-02 07:06:03 +01:00
|
|
|
#pragma once
|
2013-07-02 08:40:43 +02:00
|
|
|
#ifndef _LOADERDFF_HPP_
|
|
|
|
#define _LOADERDFF_HPP_
|
2013-07-02 07:06:03 +01:00
|
|
|
|
2017-01-04 21:08:21 +00:00
|
|
|
#include <data/Clump.hpp>
|
2016-12-03 20:58:03 +00:00
|
|
|
#include <gl/TextureData.hpp>
|
2016-04-07 01:13:46 +01:00
|
|
|
#include <loaders/RWBinaryStream.hpp>
|
2016-09-09 21:13:21 +01:00
|
|
|
#include <platform/FileHandle.hpp>
|
2016-12-03 20:58:03 +00:00
|
|
|
|
|
|
|
#include <functional>
|
2016-09-09 21:13:21 +01:00
|
|
|
#include <string>
|
2013-07-02 07:06:03 +01:00
|
|
|
|
2016-09-09 21:13:21 +01:00
|
|
|
class DFFLoaderException {
|
|
|
|
std::string _message;
|
2014-08-04 22:21:01 +01:00
|
|
|
|
2016-09-09 21:13:21 +01:00
|
|
|
public:
|
|
|
|
DFFLoaderException(const std::string& message) : _message(message) {
|
|
|
|
}
|
2014-08-04 22:21:01 +01:00
|
|
|
|
2016-09-09 21:13:21 +01:00
|
|
|
const std::string& which() {
|
|
|
|
return _message;
|
|
|
|
}
|
2014-08-04 22:21:01 +01:00
|
|
|
};
|
|
|
|
|
2016-09-09 21:13:21 +01:00
|
|
|
class LoaderDFF {
|
2013-07-02 07:06:03 +01:00
|
|
|
public:
|
2016-12-03 20:58:03 +00:00
|
|
|
using TextureLookupCallback = std::function<TextureData::Handle(
|
|
|
|
const std::string&, const std::string&)>;
|
2017-01-04 21:08:21 +00:00
|
|
|
using GeometryList = std::vector<GeometryPtr>;
|
|
|
|
using FrameList = std::vector<ModelFramePtr>;
|
2016-12-03 20:58:03 +00:00
|
|
|
|
2017-01-03 14:18:06 +00:00
|
|
|
Clump* loadFromMemory(FileHandle file);
|
2016-12-03 20:58:03 +00:00
|
|
|
|
|
|
|
void setTextureLookupCallback(TextureLookupCallback tlc) {
|
|
|
|
texturelookup = tlc;
|
|
|
|
}
|
2017-01-04 21:08:21 +00:00
|
|
|
|
2016-12-03 20:58:03 +00:00
|
|
|
private:
|
|
|
|
TextureLookupCallback texturelookup;
|
2017-01-04 21:08:21 +00:00
|
|
|
|
|
|
|
FrameList readFrameList(const RWBStream& stream);
|
|
|
|
|
|
|
|
GeometryList readGeometryList(const RWBStream& stream);
|
|
|
|
|
|
|
|
GeometryPtr readGeometry(const RWBStream& stream);
|
|
|
|
|
|
|
|
void readMaterialList(GeometryPtr& geom, const RWBStream& stream);
|
|
|
|
|
|
|
|
void readMaterial(GeometryPtr& geom, const RWBStream& stream);
|
|
|
|
|
|
|
|
void readTexture(Geometry::Material& material, const RWBStream& stream);
|
|
|
|
|
|
|
|
void readGeometryExtension(GeometryPtr& geom, const RWBStream& stream);
|
|
|
|
|
|
|
|
void readBinMeshPLG(GeometryPtr& geom, const RWBStream& stream);
|
|
|
|
|
|
|
|
AtomicPtr readAtomic(FrameList& framelist, GeometryList& geometrylist,
|
|
|
|
const RWBStream& stream);
|
2014-06-04 11:53:11 +01:00
|
|
|
};
|
|
|
|
|
2013-07-24 01:44:08 +01:00
|
|
|
#endif
|