mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-18 14:13:48 +00:00
Just the functional assimp lib rather than the entire assimp repository unnecessarily.
This commit is contained in:
parent
0f7641a282
commit
e9ea38eda3
1747 changed files with 9012 additions and 925008 deletions
|
|
@ -3,8 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2018, assimp team
|
||||
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
|
@ -49,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
// internal headers
|
||||
#include "LWOLoader.h"
|
||||
#include <assimp/ByteSwapper.h>
|
||||
#include "ByteSwapper.h"
|
||||
|
||||
|
||||
using namespace Assimp;
|
||||
|
|
@ -74,7 +73,7 @@ inline aiTextureMapMode GetMapMode(LWO::Texture::Wrap in)
|
|||
return aiTextureMapMode_Mirror;
|
||||
|
||||
case LWO::Texture::RESET:
|
||||
ASSIMP_LOG_WARN("LWO2: Unsupported texture map mode: RESET");
|
||||
DefaultLogger::get()->warn("LWO2: Unsupported texture map mode: RESET");
|
||||
|
||||
// fall though here
|
||||
case LWO::Texture::EDGE:
|
||||
|
|
@ -117,7 +116,7 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex
|
|||
mapping = aiTextureMapping_BOX;
|
||||
break;
|
||||
case LWO::Texture::FrontProjection:
|
||||
ASSIMP_LOG_ERROR("LWO2: Unsupported texture mapping: FrontProjection");
|
||||
DefaultLogger::get()->error("LWO2: Unsupported texture mapping: FrontProjection");
|
||||
mapping = aiTextureMapping_OTHER;
|
||||
break;
|
||||
case LWO::Texture::UV:
|
||||
|
|
@ -164,7 +163,7 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex
|
|||
static_assert(sizeof(aiUVTransform)/sizeof(ai_real) == 5, "sizeof(aiUVTransform)/sizeof(ai_real) == 5");
|
||||
pcMat->AddProperty(&trafo,1,AI_MATKEY_UVTRANSFORM(type,cur));
|
||||
}
|
||||
ASSIMP_LOG_DEBUG("LWO2: Setting up non-UV mapping");
|
||||
DefaultLogger::get()->debug("LWO2: Setting up non-UV mapping");
|
||||
}
|
||||
|
||||
// The older LWOB format does not use indirect references to clips.
|
||||
|
|
@ -181,7 +180,7 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex
|
|||
|
||||
}
|
||||
if (candidate == end) {
|
||||
ASSIMP_LOG_ERROR("LWO2: Clip index is out of bounds");
|
||||
DefaultLogger::get()->error("LWO2: Clip index is out of bounds");
|
||||
temp = 0;
|
||||
|
||||
// fixme: apparently some LWO files shipping with Doom3 don't
|
||||
|
|
@ -194,7 +193,7 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex
|
|||
}
|
||||
else {
|
||||
if (Clip::UNSUPPORTED == (*candidate).type) {
|
||||
ASSIMP_LOG_ERROR("LWO2: Clip type is not supported");
|
||||
DefaultLogger::get()->error("LWO2: Clip type is not supported");
|
||||
continue;
|
||||
}
|
||||
AdjustTexturePath((*candidate).path);
|
||||
|
|
@ -212,7 +211,7 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex
|
|||
{
|
||||
std::string ss = texture.mFileName;
|
||||
if (!ss.length()) {
|
||||
ASSIMP_LOG_WARN("LWOB: Empty file name");
|
||||
DefaultLogger::get()->error("LWOB: Empty file name");
|
||||
continue;
|
||||
}
|
||||
AdjustTexturePath(ss);
|
||||
|
|
@ -246,15 +245,14 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex
|
|||
|
||||
default:
|
||||
temp = (unsigned int)aiTextureOp_Multiply;
|
||||
ASSIMP_LOG_WARN("LWO2: Unsupported texture blend mode: alpha or displacement");
|
||||
DefaultLogger::get()->warn("LWO2: Unsupported texture blend mode: alpha or displacement");
|
||||
|
||||
}
|
||||
// Setup texture operation
|
||||
pcMat->AddProperty<int>((int*)&temp,1,AI_MATKEY_TEXOP(type,cur));
|
||||
|
||||
// setup the mapping mode
|
||||
int mapping_ = static_cast<int>(mapping);
|
||||
pcMat->AddProperty<int>(&mapping_, 1, AI_MATKEY_MAPPING(type, cur));
|
||||
pcMat->AddProperty<int>((int*)&mapping,1,AI_MATKEY_MAPPING(type,cur));
|
||||
|
||||
// add the u-wrapping
|
||||
temp = (unsigned int)GetMapMode(texture.wrapModeWidth);
|
||||
|
|
@ -348,26 +346,25 @@ void LWOImporter::ConvertMaterial(const LWO::Surface& surf,aiMaterial* pcMat)
|
|||
// the surface and search for a name which we know ...
|
||||
for (const auto &shader : surf.mShaders) {
|
||||
if (shader.functionName == "LW_SuperCelShader" || shader.functionName == "AH_CelShader") {
|
||||
ASSIMP_LOG_INFO("LWO2: Mapping LW_SuperCelShader/AH_CelShader to aiShadingMode_Toon");
|
||||
DefaultLogger::get()->info("LWO2: Mapping LW_SuperCelShader/AH_CelShader to aiShadingMode_Toon");
|
||||
|
||||
m = aiShadingMode_Toon;
|
||||
break;
|
||||
}
|
||||
else if (shader.functionName == "LW_RealFresnel" || shader.functionName == "LW_FastFresnel") {
|
||||
ASSIMP_LOG_INFO("LWO2: Mapping LW_RealFresnel/LW_FastFresnel to aiShadingMode_Fresnel");
|
||||
DefaultLogger::get()->info("LWO2: Mapping LW_RealFresnel/LW_FastFresnel to aiShadingMode_Fresnel");
|
||||
|
||||
m = aiShadingMode_Fresnel;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSIMP_LOG_WARN_F("LWO2: Unknown surface shader: ", shader.functionName);
|
||||
DefaultLogger::get()->warn("LWO2: Unknown surface shader: " + shader.functionName);
|
||||
}
|
||||
}
|
||||
if (surf.mMaximumSmoothAngle <= 0.0)
|
||||
m = aiShadingMode_Flat;
|
||||
int m_ = static_cast<int>(m);
|
||||
pcMat->AddProperty(&m_, 1, AI_MATKEY_SHADING_MODEL);
|
||||
pcMat->AddProperty((int*)&m,1,AI_MATKEY_SHADING_MODEL);
|
||||
|
||||
// (the diffuse value is just a scaling factor)
|
||||
// If a diffuse texture is set, we set this value to 1.0
|
||||
|
|
@ -400,7 +397,7 @@ char LWOImporter::FindUVChannels(LWO::TextureList& list,
|
|||
}
|
||||
else {
|
||||
// channel mismatch. need to duplicate the material.
|
||||
ASSIMP_LOG_WARN("LWO: Channel mismatch, would need to duplicate surface [design bug]");
|
||||
DefaultLogger::get()->warn("LWO: Channel mismatch, would need to duplicate surface [design bug]");
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
|
@ -431,7 +428,7 @@ void LWOImporter::FindUVChannels(LWO::Surface& surf,
|
|||
|
||||
if (extra >= AI_MAX_NUMBER_OF_TEXTURECOORDS) {
|
||||
|
||||
ASSIMP_LOG_ERROR("LWO: Maximum number of UV channels for "
|
||||
DefaultLogger::get()->error("LWO: Maximum number of UV channels for "
|
||||
"this mesh reached. Skipping channel \'" + uv.name + "\'");
|
||||
|
||||
}
|
||||
|
|
@ -504,7 +501,7 @@ void LWOImporter::FindVCChannels(const LWO::Surface& surf, LWO::SortedRep& sorte
|
|||
if (vc.abAssigned[idx] && ((aiColor4D*)&vc.rawData[0])[idx] != aiColor4D(0.0,0.0,0.0,1.0)) {
|
||||
if (next >= AI_MAX_NUMBER_OF_COLOR_SETS) {
|
||||
|
||||
ASSIMP_LOG_ERROR("LWO: Maximum number of vertex color channels for "
|
||||
DefaultLogger::get()->error("LWO: Maximum number of vertex color channels for "
|
||||
"this mesh reached. Skipping channel \'" + vc.name + "\'");
|
||||
|
||||
}
|
||||
|
|
@ -569,7 +566,7 @@ void LWOImporter::LoadLWO2ImageMap(unsigned int size, LWO::Texture& tex )
|
|||
void LWOImporter::LoadLWO2Procedural(unsigned int /*size*/, LWO::Texture& tex )
|
||||
{
|
||||
// --- not supported at the moment
|
||||
ASSIMP_LOG_ERROR("LWO2: Found procedural texture, this is not supported");
|
||||
DefaultLogger::get()->error("LWO2: Found procedural texture, this is not supported");
|
||||
tex.bCanUse = false;
|
||||
}
|
||||
|
||||
|
|
@ -577,7 +574,7 @@ void LWOImporter::LoadLWO2Procedural(unsigned int /*size*/, LWO::Texture& tex )
|
|||
void LWOImporter::LoadLWO2Gradient(unsigned int /*size*/, LWO::Texture& tex )
|
||||
{
|
||||
// --- not supported at the moment
|
||||
ASSIMP_LOG_ERROR("LWO2: Found gradient texture, this is not supported");
|
||||
DefaultLogger::get()->error("LWO2: Found gradient texture, this is not supported");
|
||||
tex.bCanUse = false;
|
||||
}
|
||||
|
||||
|
|
@ -592,7 +589,7 @@ void LWOImporter::LoadLWO2TextureHeader(unsigned int size, LWO::Texture& tex )
|
|||
// we could crash later if this is an empty string ...
|
||||
if (!tex.ordinal.length())
|
||||
{
|
||||
ASSIMP_LOG_ERROR("LWO2: Ill-formed SURF.BLOK ordinal string");
|
||||
DefaultLogger::get()->error("LWO2: Ill-formed SURF.BLOK ordinal string");
|
||||
tex.ordinal = "\x00";
|
||||
}
|
||||
while (true)
|
||||
|
|
@ -664,7 +661,7 @@ void LWOImporter::LoadLWO2TextureBlock(LE_NCONST IFF::SubChunkHeader* head, unsi
|
|||
case AI_LWO_REFL:
|
||||
listRef = &surf.mReflectionTextures;break;
|
||||
default:
|
||||
ASSIMP_LOG_WARN("LWO2: Encountered unknown texture type");
|
||||
DefaultLogger::get()->warn("LWO2: Encountered unknown texture type");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -693,7 +690,7 @@ void LWOImporter::LoadLWO2ShaderBlock(LE_NCONST IFF::SubChunkHeader* /*head*/, u
|
|||
// we could crash later if this is an empty string ...
|
||||
if (!shader.ordinal.length())
|
||||
{
|
||||
ASSIMP_LOG_ERROR("LWO2: Ill-formed SURF.BLOK ordinal string");
|
||||
DefaultLogger::get()->error("LWO2: Ill-formed SURF.BLOK ordinal string");
|
||||
shader.ordinal = "\x00";
|
||||
}
|
||||
|
||||
|
|
@ -752,7 +749,7 @@ void LWOImporter::LoadLWO2Surface(unsigned int size)
|
|||
}
|
||||
}
|
||||
if (derived.size())
|
||||
ASSIMP_LOG_WARN("LWO2: Unable to find source surface: " + derived);
|
||||
DefaultLogger::get()->warn("LWO2: Unable to find source surface: " + derived);
|
||||
}
|
||||
|
||||
while (true)
|
||||
|
|
@ -888,7 +885,7 @@ void LWOImporter::LoadLWO2Surface(unsigned int size)
|
|||
break;
|
||||
|
||||
default:
|
||||
ASSIMP_LOG_WARN("LWO2: Found an unsupported surface BLOK");
|
||||
DefaultLogger::get()->warn("LWO2: Found an unsupported surface BLOK");
|
||||
};
|
||||
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue