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.
@ -51,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "TargetAnimation.h"
#include <assimp/scene.h>
#include <assimp/DefaultLogger.hpp>
#include <assimp/StringComparison.h>
#include "StringComparison.h"
#include <memory>
#include <cctype>
@ -72,7 +71,7 @@ void Discreet3DSImporter::ReplaceDefaultMaterial()
unsigned int idx( NotSet );
for (unsigned int i = 0; i < mScene->mMaterials.size();++i)
{
std::string &s = mScene->mMaterials[i].mName;
std::string s = mScene->mMaterials[i].mName;
for ( std::string::iterator it = s.begin(); it != s.end(); ++it ) {
*it = static_cast< char >( ::tolower( *it ) );
}
@ -120,7 +119,7 @@ void Discreet3DSImporter::ReplaceDefaultMaterial()
else if ( (*a) >= mScene->mMaterials.size())
{
(*a) = idx;
ASSIMP_LOG_WARN("Material index overflow in 3DS file. Using default material");
DefaultLogger::get()->warn("Material index overflow in 3DS file. Using default material");
++cnt;
}
}
@ -128,11 +127,12 @@ void Discreet3DSImporter::ReplaceDefaultMaterial()
if (cnt && idx == mScene->mMaterials.size())
{
// We need to create our own default material
D3DS::Material sMat("%%%DEFAULT");
D3DS::Material sMat;
sMat.mDiffuse = aiColor3D(0.3f,0.3f,0.3f);
sMat.mName = "%%%DEFAULT";
mScene->mMaterials.push_back(sMat);
ASSIMP_LOG_INFO("3DS: Generating default material");
DefaultLogger::get()->info("3DS: Generating default material");
}
}
@ -147,12 +147,12 @@ void Discreet3DSImporter::CheckIndices(D3DS::Mesh& sMesh)
{
if ((*i).mIndices[a] >= sMesh.mPositions.size())
{
ASSIMP_LOG_WARN("3DS: Vertex index overflow)");
DefaultLogger::get()->warn("3DS: Vertex index overflow)");
(*i).mIndices[a] = (uint32_t)sMesh.mPositions.size()-1;
}
if ( !sMesh.mTexCoords.empty() && (*i).mIndices[a] >= sMesh.mTexCoords.size())
{
ASSIMP_LOG_WARN("3DS: Texture coordinate index overflow)");
DefaultLogger::get()->warn("3DS: Texture coordinate index overflow)");
(*i).mIndices[a] = (uint32_t)sMesh.mTexCoords.size()-1;
}
}
@ -204,9 +204,8 @@ void CopyTexture(aiMaterial& mat, D3DS::Texture& texture, aiTextureType type)
mat.AddProperty<ai_real>( &texture.mTextureBlend, 1, AI_MATKEY_TEXBLEND(type,0));
// Setup the texture mapping mode
int mapMode = static_cast<int>(texture.mMapMode);
mat.AddProperty<int>(&mapMode,1,AI_MATKEY_MAPPINGMODE_U(type,0));
mat.AddProperty<int>(&mapMode,1,AI_MATKEY_MAPPINGMODE_V(type,0));
mat.AddProperty<int>((int*)&texture.mMapMode,1,AI_MATKEY_MAPPINGMODE_U(type,0));
mat.AddProperty<int>((int*)&texture.mMapMode,1,AI_MATKEY_MAPPINGMODE_V(type,0));
// Mirroring - double the scaling values
// FIXME: this is not really correct ...
@ -314,8 +313,7 @@ void Discreet3DSImporter::ConvertMaterial(D3DS::Material& oldMat,
case D3DS::Discreet3DS::Blinn :
eShading = aiShadingMode_Blinn; break;
}
int eShading_ = static_cast<int>(eShading);
mat.AddProperty<int>(&eShading_, 1, AI_MATKEY_SHADING_MODEL);
mat.AddProperty<int>( (int*)&eShading,1,AI_MATKEY_SHADING_MODEL);
// DIFFUSE texture
if( oldMat.sTexDiffuse.mMapName.length() > 0)
@ -499,7 +497,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene* pcSOut,aiNode* pcOut,
pvCurrent->x *= -1.f;
t2->x *= -1.f;
}
ASSIMP_LOG_INFO("3DS: Flipping mesh X-Axis");
DefaultLogger::get()->info("3DS: Flipping mesh X-Axis");
}
// Handle pivot point
@ -575,11 +573,11 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene* pcSOut,aiNode* pcOut,
pcIn->aTargetPositionKeys.size() > 1)
{
aiAnimation* anim = pcSOut->mAnimations[0];
ai_assert(nullptr != anim);
ai_assert(NULL != anim);
if (pcIn->aCameraRollKeys.size() > 1)
{
ASSIMP_LOG_DEBUG("3DS: Converting camera roll track ...");
DefaultLogger::get()->debug("3DS: Converting camera roll track ...");
// Camera roll keys - in fact they're just rotations
// around the camera's z axis. The angles are given
@ -599,7 +597,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene* pcSOut,aiNode* pcOut,
#if 0
if (pcIn->aTargetPositionKeys.size() > 1)
{
ASSIMP_LOG_DEBUG("3DS: Converting target track ...");
DefaultLogger::get()->debug("3DS: Converting target track ...");
// Camera or spot light - need to convert the separate
// target position channel to our representation
@ -745,7 +743,7 @@ void Discreet3DSImporter::GenerateNodeGraph(aiScene* pcOut)
// | | | | |
// MESH_0 MESH_1 MESH_2 ... MESH_N CAMERA_0 ....
//
ASSIMP_LOG_WARN("No hierarchy information has been found in the file. ");
DefaultLogger::get()->warn("No hierarchy information has been found in the file. ");
pcOut->mRootNode->mNumChildren = pcOut->mNumMeshes +
static_cast<unsigned int>(mScene->mCameras.size() + mScene->mLights.size());