2017-10-30 23:44:40 +01:00
|
|
|
#ifndef _LIBRW_LOADERDFF_HPP_
|
|
|
|
#define _LIBRW_LOADERDFF_HPP_
|
2013-07-02 08:06:03 +02:00
|
|
|
|
2017-01-04 22:08:21 +01:00
|
|
|
#include <data/Clump.hpp>
|
2016-12-03 21:58:03 +01:00
|
|
|
#include <gl/TextureData.hpp>
|
2017-10-30 23:44:40 +01:00
|
|
|
#include <rw/forward.hpp>
|
2016-12-03 21:58:03 +01:00
|
|
|
|
|
|
|
#include <functional>
|
2016-09-09 22:13:21 +02:00
|
|
|
#include <string>
|
2017-10-30 23:44:40 +01:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class RWBStream;
|
2013-07-02 08:06:03 +02:00
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
class DFFLoaderException {
|
|
|
|
std::string _message;
|
2014-08-04 23:21:01 +02:00
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
public:
|
2018-05-08 16:10:29 +02:00
|
|
|
template <class String>
|
|
|
|
DFFLoaderException(String&& message) : _message(message) {
|
2016-09-09 22:13:21 +02:00
|
|
|
}
|
2014-08-04 23:21:01 +02:00
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
const std::string& which() {
|
|
|
|
return _message;
|
|
|
|
}
|
2014-08-04 23:21:01 +02:00
|
|
|
};
|
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
class LoaderDFF {
|
2013-07-02 08:06:03 +02:00
|
|
|
public:
|
2016-12-03 21:58:03 +01:00
|
|
|
using TextureLookupCallback = std::function<TextureData::Handle(
|
|
|
|
const std::string&, const std::string&)>;
|
2017-01-04 22:08:21 +01:00
|
|
|
using GeometryList = std::vector<GeometryPtr>;
|
|
|
|
using FrameList = std::vector<ModelFramePtr>;
|
2016-12-03 21:58:03 +01:00
|
|
|
|
2018-07-06 22:05:43 +02:00
|
|
|
ClumpPtr loadFromMemory(const FileContentsInfo& file);
|
2016-12-03 21:58:03 +01:00
|
|
|
|
2018-05-08 16:10:29 +02:00
|
|
|
void setTextureLookupCallback(const TextureLookupCallback& tlc) {
|
2016-12-03 21:58:03 +01:00
|
|
|
texturelookup = tlc;
|
|
|
|
}
|
2017-01-04 22:08:21 +01:00
|
|
|
|
2016-12-03 21:58:03 +01:00
|
|
|
private:
|
|
|
|
TextureLookupCallback texturelookup;
|
2017-01-04 22:08:21 +01:00
|
|
|
|
|
|
|
FrameList readFrameList(const RWBStream& stream);
|
|
|
|
|
|
|
|
GeometryList readGeometryList(const RWBStream& stream);
|
|
|
|
|
|
|
|
GeometryPtr readGeometry(const RWBStream& stream);
|
|
|
|
|
2018-05-16 19:13:11 +02:00
|
|
|
void readMaterialList(const GeometryPtr& geom, const RWBStream& stream);
|
2017-01-04 22:08:21 +01:00
|
|
|
|
2018-05-16 19:13:11 +02:00
|
|
|
void readMaterial(const GeometryPtr& geom, const RWBStream& stream);
|
2017-01-04 22:08:21 +01:00
|
|
|
|
|
|
|
void readTexture(Geometry::Material& material, const RWBStream& stream);
|
|
|
|
|
2018-05-16 19:13:11 +02:00
|
|
|
void readGeometryExtension(const GeometryPtr& geom, const RWBStream& stream);
|
2017-01-04 22:08:21 +01:00
|
|
|
|
2018-05-16 19:13:11 +02:00
|
|
|
void readBinMeshPLG(const GeometryPtr& geom, const RWBStream& stream);
|
2017-01-04 22:08:21 +01:00
|
|
|
|
|
|
|
AtomicPtr readAtomic(FrameList& framelist, GeometryList& geometrylist,
|
|
|
|
const RWBStream& stream);
|
2014-06-04 12:53:11 +02:00
|
|
|
};
|
|
|
|
|
2013-07-24 02:44:08 +02:00
|
|
|
#endif
|