mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-25 03:42:48 +01:00
Remove BackgroundLoader.hpp
This commit is contained in:
parent
62ad6b8628
commit
9b45a31834
@ -61,7 +61,6 @@ set(RWENGINE_SOURCES
|
||||
src/items/InventoryItem.hpp
|
||||
src/items/WeaponItem.cpp
|
||||
src/items/WeaponItem.hpp
|
||||
src/loaders/BackgroundLoader.hpp
|
||||
src/loaders/DataLoader.cpp
|
||||
src/loaders/DataLoader.hpp
|
||||
src/loaders/GenericDATLoader.cpp
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <script/SCMFile.hpp>
|
||||
|
||||
#include <core/Logger.hpp>
|
||||
#include <loaders/BackgroundLoader.hpp>
|
||||
#include <loaders/GenericDATLoader.hpp>
|
||||
#include <loaders/LoaderGXT.hpp>
|
||||
#include <platform/FileIndex.hpp>
|
||||
|
@ -1,38 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <data/ResourceHandle.hpp>
|
||||
#include <job/WorkContext.hpp>
|
||||
#include <platform/FileIndex.hpp>
|
||||
|
||||
/**
|
||||
* Implementation of a worker that loads a resource in the background.
|
||||
*/
|
||||
template <class T, class L>
|
||||
class BackgroundLoaderJob : public WorkJob {
|
||||
public:
|
||||
typedef typename ResourceHandle<T>::Ref TypeRef;
|
||||
|
||||
BackgroundLoaderJob(WorkContext* context, FileIndex* index,
|
||||
const std::string& file, const TypeRef& ref)
|
||||
: WorkJob(context), index(index), filename(file), resourceRef(ref) {
|
||||
}
|
||||
|
||||
void work() {
|
||||
data = index->openFile(filename);
|
||||
}
|
||||
|
||||
void complete() {
|
||||
if (data) {
|
||||
L loader;
|
||||
|
||||
resourceRef->resource = loader.loadFromMemory(data);
|
||||
resourceRef->state = RW::Loaded;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
FileIndex* index;
|
||||
std::string filename;
|
||||
FileHandle data;
|
||||
TypeRef resourceRef;
|
||||
};
|
@ -1,7 +1,6 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <data/Model.hpp>
|
||||
#include <job/WorkContext.hpp>
|
||||
#include <loaders/BackgroundLoader.hpp>
|
||||
#include "test_globals.hpp"
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(LoaderDFFTests)
|
||||
@ -38,31 +37,6 @@ BOOST_AUTO_TEST_CASE(test_load_dff) {
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_loader_job) {
|
||||
{
|
||||
WorkContext ctx;
|
||||
|
||||
ResourceHandle<Model>::Ref modelRef{
|
||||
new ResourceHandle<Model>("landstal.dff")};
|
||||
|
||||
auto index = &Global::get().e->data->index;
|
||||
auto job = new BackgroundLoaderJob<Model, LoaderDFF>{
|
||||
&ctx, index, "landstal.dff", modelRef};
|
||||
|
||||
ctx.queueJob(job);
|
||||
|
||||
while (modelRef->state == RW::Loading) {
|
||||
ctx.update();
|
||||
std::this_thread::yield();
|
||||
}
|
||||
|
||||
BOOST_REQUIRE(modelRef->resource != nullptr);
|
||||
|
||||
BOOST_CHECK(modelRef->resource->frames.size() > 0);
|
||||
|
||||
delete modelRef->resource;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
Loading…
Reference in New Issue
Block a user