mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-16 13:13:53 +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,22 +48,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
// internal headers
|
||||
#include "MDLLoader.h"
|
||||
#include "MDLDefaultColorMap.h"
|
||||
#include <assimp/StringUtils.h>
|
||||
#include "StringUtils.h"
|
||||
#include <assimp/texture.h>
|
||||
#include <assimp/IOSystem.hpp>
|
||||
#include <assimp/DefaultLogger.hpp>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/Defines.h>
|
||||
#include <assimp/qnan.h>
|
||||
|
||||
#include <memory>
|
||||
#include "qnan.h"
|
||||
|
||||
|
||||
using namespace Assimp;
|
||||
static aiTexel* const bad_texel = reinterpret_cast<aiTexel*>(SIZE_MAX);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Find a suitable palette file or take the default one
|
||||
// Find a suitable pallette file or take the default one
|
||||
void MDLImporter::SearchPalette(const unsigned char** pszColorMap)
|
||||
{
|
||||
// now try to find the color map in the current directory
|
||||
|
|
@ -75,11 +72,10 @@ void MDLImporter::SearchPalette(const unsigned char** pszColorMap)
|
|||
{
|
||||
if (pcStream->FileSize() >= 768)
|
||||
{
|
||||
size_t len = 256 * 3;
|
||||
unsigned char* colorMap = new unsigned char[len];
|
||||
unsigned char* colorMap = new unsigned char[256*3];
|
||||
szColorMap = colorMap;
|
||||
pcStream->Read(colorMap, len,1);
|
||||
ASSIMP_LOG_INFO("Found valid colormap.lmp in directory. "
|
||||
pcStream->Read(colorMap,256*3,1);
|
||||
DefaultLogger::get()->info("Found valid colormap.lmp in directory. "
|
||||
"It will be used to decode embedded textures in palletized formats.");
|
||||
}
|
||||
delete pcStream;
|
||||
|
|
@ -187,7 +183,7 @@ void MDLImporter::CreateTexture_3DGS_MDL4(const unsigned char* szData,
|
|||
|
||||
if (iType == 1 || iType > 3)
|
||||
{
|
||||
ASSIMP_LOG_ERROR("Unsupported texture file format");
|
||||
DefaultLogger::get()->error("Unsupported texture file format");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -493,7 +489,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
|
|||
unsigned int iWidth,
|
||||
unsigned int iHeight)
|
||||
{
|
||||
std::unique_ptr<aiTexture> pcNew;
|
||||
aiTexture* pcNew = nullptr;
|
||||
|
||||
// get the type of the skin
|
||||
unsigned int iMasked = (unsigned int)(iType & 0xF);
|
||||
|
|
@ -509,11 +505,11 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
|
|||
// ***** EMBEDDED DDS FILE *****
|
||||
if (1 != iHeight)
|
||||
{
|
||||
ASSIMP_LOG_WARN("Found a reference to an embedded DDS texture, "
|
||||
DefaultLogger::get()->warn("Found a reference to an embedded DDS texture, "
|
||||
"but texture height is not equal to 1, which is not supported by MED");
|
||||
}
|
||||
|
||||
pcNew.reset(new aiTexture());
|
||||
pcNew = new aiTexture();
|
||||
pcNew->mHeight = 0;
|
||||
pcNew->mWidth = iWidth;
|
||||
|
||||
|
|
@ -532,7 +528,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
|
|||
// ***** REFERENCE TO EXTERNAL FILE *****
|
||||
if (1 != iHeight)
|
||||
{
|
||||
ASSIMP_LOG_WARN("Found a reference to an external texture, "
|
||||
DefaultLogger::get()->warn("Found a reference to an external texture, "
|
||||
"but texture height is not equal to 1, which is not supported by MED");
|
||||
}
|
||||
|
||||
|
|
@ -550,10 +546,10 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
|
|||
}
|
||||
else if (iMasked || !iType || (iType && iWidth && iHeight))
|
||||
{
|
||||
pcNew.reset(new aiTexture());
|
||||
pcNew = new aiTexture();
|
||||
if (!iHeight || !iWidth)
|
||||
{
|
||||
ASSIMP_LOG_WARN("Found embedded texture, but its width "
|
||||
DefaultLogger::get()->warn("Found embedded texture, but its width "
|
||||
"an height are both 0. Is this a joke?");
|
||||
|
||||
// generate an empty chess pattern
|
||||
|
|
@ -581,7 +577,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
|
|||
pcNew->mHeight = iHeight;
|
||||
|
||||
unsigned int iSkip = 0;
|
||||
ParseTextureColorData(szCurrent,iMasked,&iSkip,pcNew.get());
|
||||
ParseTextureColorData(szCurrent,iMasked,&iSkip,pcNew);
|
||||
|
||||
// skip length of texture data
|
||||
szCurrent += iSkip;
|
||||
|
|
@ -592,7 +588,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
|
|||
// texture instead of material colors ... posssible they have
|
||||
// been converted to MDL7 from other formats, such as MDL5
|
||||
aiColor4D clrTexture;
|
||||
if (pcNew)clrTexture = ReplaceTextureWithColor(pcNew.get());
|
||||
if (pcNew)clrTexture = ReplaceTextureWithColor(pcNew);
|
||||
else clrTexture.r = get_qnan();
|
||||
|
||||
// check whether a material definition is contained in the skin
|
||||
|
|
@ -684,7 +680,8 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
|
|||
// we don't need the texture anymore
|
||||
if (is_not_qnan(clrTexture.r))
|
||||
{
|
||||
pcNew.reset();
|
||||
delete pcNew;
|
||||
pcNew = NULL;
|
||||
}
|
||||
|
||||
// If an ASCII effect description (HLSL?) is contained in the file,
|
||||
|
|
@ -719,7 +716,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
|
|||
{
|
||||
pScene->mNumTextures = 1;
|
||||
pScene->mTextures = new aiTexture*[1];
|
||||
pScene->mTextures[0] = pcNew.release();
|
||||
pScene->mTextures[0] = pcNew;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -729,13 +726,16 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
|
|||
pScene->mTextures[i] = pc[i];
|
||||
}
|
||||
|
||||
pScene->mTextures[pScene->mNumTextures] = pcNew.release();
|
||||
pScene->mTextures[pScene->mNumTextures] = pcNew;
|
||||
pScene->mNumTextures++;
|
||||
delete[] pc;
|
||||
}
|
||||
}
|
||||
VALIDATE_FILE_SIZE(szCurrent);
|
||||
*szCurrentOut = szCurrent;
|
||||
if ( nullptr != pcNew ) {
|
||||
delete pcNew;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue