Skip to content

Commit

Permalink
#5576: Remove picomodel references from AseModelLoader.
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Apr 4, 2021
1 parent 7537c3c commit 80391e4
Showing 1 changed file with 4 additions and 44 deletions.
48 changes: 4 additions & 44 deletions radiantcore/model/import/AseModelLoader.cpp
Expand Up @@ -3,26 +3,14 @@
#include <istream>
#include "AseModel.h"

#include "../picomodel/lib/picomodel.h"
#include "os/path.h"
#include "string/case_conv.h"

#include "../StaticModel.h"
#include "../picomodel/PicoModelLoader.h"

namespace model
{

namespace
{

size_t picoInputStreamReam(void* inputStream, unsigned char* buffer, size_t length)
{
return reinterpret_cast<InputStream*>(inputStream)->read(buffer, length);
}

}

AseModelLoader::AseModelLoader() :
ModelImporterBase("ASE")
{}
Expand All @@ -40,44 +28,16 @@ IModelPtr AseModelLoader::loadModelFromPath(const std::string& path)
return IModelPtr();
}

#if 0
auto* model = PicoModuleLoadModelStream(
&picoModuleASE,
&file->getInputStream(),
picoInputStreamReam,
file->size(),
0
);

// greebo: Check if the model load was successful
if (!model || model->numSurfaces == 0)
{
// Model is either NULL or has no surfaces, this must've failed
return IModelPtr();
}

auto surfaces = PicoModelLoader::CreateSurfaces(model, string::to_lower_copy(getExtension()));

auto modelObj = std::make_shared<StaticModel>(surfaces);
// Set the filename
modelObj->setFilename(os::getFilename(file->getName()));
modelObj->setModelPath(path);

PicoFreeModel(model);

return modelObj;
#else
std::istream stream(&(file->getInputStream()));
auto model = AseModel::CreateFromStream(stream);

auto modelObj = std::make_shared<StaticModel>(model->getSurfaces());
auto staticModel = std::make_shared<StaticModel>(model->getSurfaces());

// Set the filename
modelObj->setFilename(os::getFilename(file->getName()));
modelObj->setModelPath(path);
staticModel->setFilename(os::getFilename(file->getName()));
staticModel->setModelPath(path);

return modelObj;
#endif
return staticModel;
}

}

0 comments on commit 80391e4

Please sign in to comment.