Just the functional assimp lib rather than the entire assimp repository unnecessarily.

This commit is contained in:
Areloch 2019-02-28 16:37:15 -06:00
parent 0f7641a282
commit e9ea38eda3
1747 changed files with 9012 additions and 925008 deletions

View file

@ -3,8 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team
Copyright (c) 2006-2017, assimp team
All rights reserved.
@ -55,9 +54,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "MD3Loader.h"
#include <assimp/SceneCombiner.h>
#include <assimp/GenericProperty.h>
#include <assimp/RemoveComments.h>
#include <assimp/ParsingUtils.h>
#include "GenericProperty.h"
#include "RemoveComments.h"
#include "ParsingUtils.h"
#include "Importer.h"
#include <assimp/DefaultLogger.hpp>
#include <memory>
@ -101,7 +100,7 @@ Q3Shader::BlendFunc StringToBlendFunc(const std::string& m)
if (m == "GL_ONE_MINUS_DST_COLOR") {
return Q3Shader::BLEND_GL_ONE_MINUS_DST_COLOR;
}
ASSIMP_LOG_ERROR("Q3Shader: Unknown blend function: " + m);
DefaultLogger::get()->error("Q3Shader: Unknown blend function: " + m);
return Q3Shader::BLEND_NONE;
}
@ -113,7 +112,7 @@ bool Q3Shader::LoadShader(ShaderData& fill, const std::string& pFile,IOSystem* i
if (!file.get())
return false; // if we can't access the file, don't worry and return
ASSIMP_LOG_INFO_F("Loading Quake3 shader file ", pFile);
DefaultLogger::get()->info("Loading Quake3 shader file " + pFile);
// read file in memory
const size_t s = file->FileSize();
@ -136,7 +135,7 @@ bool Q3Shader::LoadShader(ShaderData& fill, const std::string& pFile,IOSystem* i
// append to last section, if any
if (!curData) {
ASSIMP_LOG_ERROR("Q3Shader: Unexpected shader section token \'{\'");
DefaultLogger::get()->error("Q3Shader: Unexpected shader section token \'{\'");
return true; // still no failure, the file is there
}
@ -206,16 +205,19 @@ bool Q3Shader::LoadShader(ShaderData& fill, const std::string& pFile,IOSystem* i
SkipSpaces(&buff);
if (!ASSIMP_strincmp(buff,"back",4)) {
curData->cull = Q3Shader::CULL_CCW;
} else if (!ASSIMP_strincmp(buff,"front",5)) {
curData->cull = Q3Shader::CULL_CW;
} else if (!ASSIMP_strincmp(buff,"none",4) || !ASSIMP_strincmp(buff,"disable",7)) {
curData->cull = Q3Shader::CULL_NONE;
} else {
ASSIMP_LOG_ERROR("Q3Shader: Unrecognized cull mode");
}
else if (!ASSIMP_strincmp(buff,"front",5)) {
curData->cull = Q3Shader::CULL_CW;
}
else if (!ASSIMP_strincmp(buff,"none",4) || !ASSIMP_strincmp(buff,"disable",7)) {
curData->cull = Q3Shader::CULL_NONE;
}
else DefaultLogger::get()->error("Q3Shader: Unrecognized cull mode");
}
}
} else {
}
else {
// add new section
fill.blocks.push_back(Q3Shader::ShaderDataBlock());
curData = &fill.blocks.back();
@ -235,7 +237,7 @@ bool Q3Shader::LoadSkin(SkinData& fill, const std::string& pFile,IOSystem* io)
if (!file.get())
return false; // if we can't access the file, don't worry and return
ASSIMP_LOG_INFO("Loading Quake3 skin file " + pFile);
DefaultLogger::get()->info("Loading Quake3 skin file " + pFile);
// read file in memory
const size_t s = file->FileSize();
@ -394,7 +396,7 @@ void MD3Importer::ValidateHeaderOffsets()
// Check file format version
if (pcHeader->VERSION > 15)
ASSIMP_LOG_WARN( "Unsupported MD3 file version. Continuing happily ...");
DefaultLogger::get()->warn( "Unsupported MD3 file version. Continuing happily ...");
// Check some offset values whether they are valid
if (!pcHeader->NUM_SURFACES)
@ -435,24 +437,25 @@ void MD3Importer::ValidateSurfaceHeaderOffsets(const MD3::Surface* pcSurf)
// Check whether all requirements for Q3 files are met. We don't
// care, but probably someone does.
if (pcSurf->NUM_TRIANGLES > AI_MD3_MAX_TRIANGLES) {
ASSIMP_LOG_WARN("MD3: Quake III triangle limit exceeded");
DefaultLogger::get()->warn("MD3: Quake III triangle limit exceeded");
}
if (pcSurf->NUM_SHADER > AI_MD3_MAX_SHADERS) {
ASSIMP_LOG_WARN("MD3: Quake III shader limit exceeded");
DefaultLogger::get()->warn("MD3: Quake III shader limit exceeded");
}
if (pcSurf->NUM_VERTICES > AI_MD3_MAX_VERTS) {
ASSIMP_LOG_WARN("MD3: Quake III vertex limit exceeded");
DefaultLogger::get()->warn("MD3: Quake III vertex limit exceeded");
}
if (pcSurf->NUM_FRAMES > AI_MD3_MAX_FRAMES) {
ASSIMP_LOG_WARN("MD3: Quake III frame limit exceeded");
DefaultLogger::get()->warn("MD3: Quake III frame limit exceeded");
}
}
// ------------------------------------------------------------------------------------------------
const aiImporterDesc* MD3Importer::GetInfo () const {
const aiImporterDesc* MD3Importer::GetInfo () const
{
return &desc;
}
@ -575,7 +578,7 @@ bool MD3Importer::ReadMultipartFile()
aiNode* tag_torso, *tag_head;
std::vector<AttachmentInfo> attach;
ASSIMP_LOG_INFO("Multi part MD3 player model: lower, upper and head parts are joined");
DefaultLogger::get()->info("Multi part MD3 player model: lower, upper and head parts are joined");
// ensure we won't try to load ourselves recursively
BatchLoader::PropertyMap props;
@ -596,21 +599,21 @@ bool MD3Importer::ReadMultipartFile()
// ... and get them. We need all of them.
scene_lower = batch.GetImport(_lower);
if (!scene_lower) {
ASSIMP_LOG_ERROR("M3D: Failed to read multi part model, lower.md3 fails to load");
DefaultLogger::get()->error("M3D: Failed to read multi part model, lower.md3 fails to load");
failure = "lower";
goto error_cleanup;
}
scene_upper = batch.GetImport(_upper);
if (!scene_upper) {
ASSIMP_LOG_ERROR("M3D: Failed to read multi part model, upper.md3 fails to load");
DefaultLogger::get()->error("M3D: Failed to read multi part model, upper.md3 fails to load");
failure = "upper";
goto error_cleanup;
}
scene_head = batch.GetImport(_head);
if (!scene_head) {
ASSIMP_LOG_ERROR("M3D: Failed to read multi part model, head.md3 fails to load");
DefaultLogger::get()->error("M3D: Failed to read multi part model, head.md3 fails to load");
failure = "head";
goto error_cleanup;
}
@ -624,7 +627,7 @@ bool MD3Importer::ReadMultipartFile()
// tag_torso
tag_torso = scene_lower->mRootNode->FindNode("tag_torso");
if (!tag_torso) {
ASSIMP_LOG_ERROR("M3D: Failed to find attachment tag for multi part model: tag_torso expected");
DefaultLogger::get()->error("M3D: Failed to find attachment tag for multi part model: tag_torso expected");
goto error_cleanup;
}
scene_upper->mRootNode->mName.Set("upper");
@ -633,7 +636,7 @@ bool MD3Importer::ReadMultipartFile()
// tag_head
tag_head = scene_upper->mRootNode->FindNode("tag_head");
if (!tag_head) {
ASSIMP_LOG_ERROR( "M3D: Failed to find attachment tag for multi part model: tag_head expected");
DefaultLogger::get()->error("M3D: Failed to find attachment tag for multi part model: tag_head expected");
goto error_cleanup;
}
scene_head->mRootNode->mName.Set("head");
@ -886,7 +889,7 @@ void MD3Importer::InternReadFile( const std::string& pFile,
if (it != skins.textures.end()) {
texture_name = &*( _texture_name = (*it).second).begin();
ASSIMP_LOG_DEBUG_F("MD3: Assigning skin texture ", (*it).second, " to surface ", pcSurfaces->NAME);
DefaultLogger::get()->debug("MD3: Assigning skin texture " + (*it).second + " to surface " + pcSurfaces->NAME);
(*it).resolved = true; // mark entry as resolved
}
@ -915,10 +918,9 @@ void MD3Importer::InternReadFile( const std::string& pFile,
if (dit != shaders.blocks.end()) {
// Hurra, wir haben einen. Tolle Sache.
shader = &*dit;
ASSIMP_LOG_INFO("Found shader record for " +without_ext );
} else {
ASSIMP_LOG_WARN("Unable to find shader record for " + without_ext);
DefaultLogger::get()->info("Found shader record for " +without_ext );
}
else DefaultLogger::get()->warn("Unable to find shader record for " +without_ext );
}
aiMaterial* pcHelper = new aiMaterial();
@ -947,7 +949,7 @@ void MD3Importer::InternReadFile( const std::string& pFile,
szString.Set(convertedPath);
}
else {
ASSIMP_LOG_WARN("Texture file name has zero length. Using default name");
DefaultLogger::get()->warn("Texture file name has zero length. Using default name");
szString.Set("dummy_texture.bmp");
}
pcHelper->AddProperty(&szString,AI_MATKEY_TEXTURE_DIFFUSE(0));
@ -1037,7 +1039,7 @@ void MD3Importer::InternReadFile( const std::string& pFile,
if (!DefaultLogger::isNullLogger()) {
for (std::list< Q3Shader::SkinData::TextureEntry>::const_iterator it = skins.textures.begin();it != skins.textures.end(); ++it) {
if (!(*it).resolved) {
ASSIMP_LOG_ERROR_F("MD3: Failed to match skin ", (*it).first, " to surface ", (*it).second);
DefaultLogger::get()->error("MD3: Failed to match skin " + (*it).first + " to surface " + (*it).second);
}
}
}