1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-10 04:42:38 +01:00
openrw/rwengine/include/loaders/LoaderDFF.hpp
Daniel Evans 6c78b0c3c5 Refactor DFF Loader, underlying stream handling
+ Fix some model related memory leaks
2014-08-04 22:24:37 +01:00

82 lines
1.5 KiB
C++

#pragma once
#ifndef _LOADERDFF_HPP_
#define _LOADERDFF_HPP_
#define GLEW_STATIC
#include <GL/glew.h>
#include <loaders/rwbinarystream.h>
#include <vector>
#include <string>
#include <WorkContext.hpp>
#include <engine/RWTypes.hpp>
class Model;
class GameData;
class DFFLoaderException
{
std::string _message;
public:
DFFLoaderException(const std::string& message)
: _message(message)
{}
const std::string& which() { return _message; }
};
class LoaderDFF
{
/**
* @brief loads a Frame List chunk from stream into model.
* @param model
* @param stream
*/
void readFrameList(Model* model, const RWBStream &stream);
void readGeometryList(Model* model, const RWBStream& stream);
void readGeometry(Model* model, const RWBStream& stream);
void readMaterialList(Model* model, const RWBStream& stream);
void readMaterial(Model* model, const RWBStream& stream);
void readTexture(Model* model, const RWBStream& stream);
void readGeometryExtension(Model* model, const RWBStream& stream);
void readBinMeshPLG(Model* model, const RWBStream& stream);
void readAtomic(Model* model, const RWBStream& stream);
public:
Model* loadFromMemory(FileHandle file, GameData* gameData);
};
#include <functional>
class LoadModelJob : public WorkJob
{
public:
typedef std::function<void ( Model* )> ModelCallback;
private:
GameData* _gameData;
std::string _file;
ModelCallback _callback;
FileHandle _data;
public:
LoadModelJob(WorkContext* context, GameData* gd, const std::string& file, ModelCallback cb);
void work();
void complete();
};
#endif