mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-16 21:23:46 +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
|
|
@ -2,8 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2018, assimp team
|
||||
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -45,11 +44,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER
|
||||
|
||||
#include "OgreImporter.h"
|
||||
#include <assimp/TinyFormatter.h>
|
||||
#include "TinyFormatter.h"
|
||||
#include <assimp/material.h>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/DefaultLogger.hpp>
|
||||
#include <assimp/fast_atof.h>
|
||||
#include "fast_atof.h"
|
||||
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
|
|
@ -175,18 +174,18 @@ aiMaterial* OgreImporter::ReadMaterial(const std::string &pFile, Assimp::IOSyste
|
|||
if (materialFile) {
|
||||
break;
|
||||
}
|
||||
ASSIMP_LOG_DEBUG_F( "Source file for material '", materialName, "' ", potentialFiles[i], " does not exist");
|
||||
DefaultLogger::get()->debug(Formatter::format() << "Source file for material '" << materialName << "' " << potentialFiles[i] << " does not exist");
|
||||
}
|
||||
if (!materialFile)
|
||||
{
|
||||
ASSIMP_LOG_ERROR_F( "Failed to find source file for material '", materialName, "'");
|
||||
DefaultLogger::get()->error(Formatter::format() << "Failed to find source file for material '" << materialName << "'");
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::unique_ptr<IOStream> stream(materialFile);
|
||||
if (stream->FileSize() == 0)
|
||||
{
|
||||
ASSIMP_LOG_WARN_F( "Source file for material '", materialName, "' is empty (size is 0 bytes)");
|
||||
DefaultLogger::get()->warn(Formatter::format() << "Source file for material '" << materialName << "' is empty (size is 0 bytes)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -201,7 +200,7 @@ aiMaterial* OgreImporter::ReadMaterial(const std::string &pFile, Assimp::IOSyste
|
|||
ss << &data[0];
|
||||
}
|
||||
|
||||
ASSIMP_LOG_DEBUG_F("Reading material '", materialName, "'");
|
||||
DefaultLogger::get()->debug("Reading material '" + materialName + "'");
|
||||
|
||||
aiMaterial *material = new aiMaterial();
|
||||
m_textures.clear();
|
||||
|
|
@ -234,6 +233,7 @@ aiMaterial* OgreImporter::ReadMaterial(const std::string &pFile, Assimp::IOSyste
|
|||
ss >> linePart;
|
||||
if (linePart != materialName)
|
||||
{
|
||||
//DefaultLogger::get()->debug(Formatter::format() << "Found material '" << linePart << "' that does not match at index " << ss.tellg());
|
||||
ss >> linePart;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -241,11 +241,11 @@ aiMaterial* OgreImporter::ReadMaterial(const std::string &pFile, Assimp::IOSyste
|
|||
NextAfterNewLine(ss, linePart);
|
||||
if (linePart != partBlockStart)
|
||||
{
|
||||
ASSIMP_LOG_ERROR_F( "Invalid material: block start missing near index ", ss.tellg());
|
||||
DefaultLogger::get()->error(Formatter::format() << "Invalid material: block start missing near index " << ss.tellg());
|
||||
return material;
|
||||
}
|
||||
|
||||
ASSIMP_LOG_DEBUG_F("material '", materialName, "'");
|
||||
DefaultLogger::get()->debug("material '" + materialName + "'");
|
||||
|
||||
while(linePart != partBlockEnd)
|
||||
{
|
||||
|
|
@ -349,11 +349,11 @@ bool OgreImporter::ReadTechnique(const std::string &techniqueName, stringstream
|
|||
|
||||
if (linePart != partBlockStart)
|
||||
{
|
||||
ASSIMP_LOG_ERROR_F( "Invalid material: Technique block start missing near index ", ss.tellg());
|
||||
DefaultLogger::get()->error(Formatter::format() << "Invalid material: Technique block start missing near index " << ss.tellg());
|
||||
return false;
|
||||
}
|
||||
|
||||
ASSIMP_LOG_DEBUG_F(" technique '", techniqueName, "'");
|
||||
DefaultLogger::get()->debug(" technique '" + techniqueName + "'");
|
||||
|
||||
const string partPass = "pass";
|
||||
|
||||
|
|
@ -385,11 +385,11 @@ bool OgreImporter::ReadPass(const std::string &passName, stringstream &ss, aiMat
|
|||
|
||||
if (linePart != partBlockStart)
|
||||
{
|
||||
ASSIMP_LOG_ERROR_F( "Invalid material: Pass block start missing near index ", ss.tellg());
|
||||
DefaultLogger::get()->error(Formatter::format() << "Invalid material: Pass block start missing near index " << ss.tellg());
|
||||
return false;
|
||||
}
|
||||
|
||||
ASSIMP_LOG_DEBUG_F(" pass '", passName, "'");
|
||||
DefaultLogger::get()->debug(" pass '" + passName + "'");
|
||||
|
||||
const string partAmbient = "ambient";
|
||||
const string partDiffuse = "diffuse";
|
||||
|
|
@ -416,7 +416,7 @@ bool OgreImporter::ReadPass(const std::string &passName, stringstream &ss, aiMat
|
|||
ss >> r >> g >> b;
|
||||
const aiColor3D color(r, g, b);
|
||||
|
||||
ASSIMP_LOG_DEBUG_F( " ", linePart, " ", r, " ", g, " ", b);
|
||||
DefaultLogger::get()->debug(Formatter::format() << " " << linePart << " " << r << " " << g << " " << b);
|
||||
|
||||
if (linePart == partAmbient)
|
||||
{
|
||||
|
|
@ -451,11 +451,11 @@ bool OgreImporter::ReadTextureUnit(const std::string &textureUnitName, stringstr
|
|||
|
||||
if (linePart != partBlockStart)
|
||||
{
|
||||
ASSIMP_LOG_ERROR_F( "Invalid material: Texture unit block start missing near index ", ss.tellg());
|
||||
DefaultLogger::get()->error(Formatter::format() << "Invalid material: Texture unit block start missing near index " << ss.tellg());
|
||||
return false;
|
||||
}
|
||||
|
||||
ASSIMP_LOG_DEBUG_F(" texture_unit '", textureUnitName, "'");
|
||||
DefaultLogger::get()->debug(" texture_unit '" + textureUnitName + "'");
|
||||
|
||||
const string partTexture = "texture";
|
||||
const string partTextCoordSet = "tex_coord_set";
|
||||
|
|
@ -490,7 +490,7 @@ bool OgreImporter::ReadTextureUnit(const std::string &textureUnitName, stringstr
|
|||
if (posSuffix != string::npos && posUnderscore != string::npos && posSuffix > posUnderscore)
|
||||
{
|
||||
string identifier = Ogre::ToLower(textureRef.substr(posUnderscore, posSuffix - posUnderscore));
|
||||
ASSIMP_LOG_DEBUG_F( "Detecting texture type from filename postfix '", identifier, "'");
|
||||
DefaultLogger::get()->debug(Formatter::format() << "Detecting texture type from filename postfix '" << identifier << "'");
|
||||
|
||||
if (identifier == "_n" || identifier == "_nrm" || identifier == "_nrml" || identifier == "_normal" || identifier == "_normals" || identifier == "_normalmap")
|
||||
{
|
||||
|
|
@ -568,20 +568,20 @@ bool OgreImporter::ReadTextureUnit(const std::string &textureUnitName, stringstr
|
|||
|
||||
if (textureRef.empty())
|
||||
{
|
||||
ASSIMP_LOG_WARN("Texture reference is empty, ignoring texture_unit.");
|
||||
DefaultLogger::get()->warn("Texture reference is empty, ignoring texture_unit.");
|
||||
return false;
|
||||
}
|
||||
if (textureType == aiTextureType_NONE)
|
||||
{
|
||||
ASSIMP_LOG_WARN("Failed to detect texture type for '" + textureRef + "', ignoring texture_unit.");
|
||||
DefaultLogger::get()->warn("Failed to detect texture type for '" + textureRef + "', ignoring texture_unit.");
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int textureTypeIndex = m_textures[textureType];
|
||||
m_textures[textureType]++;
|
||||
|
||||
ASSIMP_LOG_DEBUG_F( " texture '", textureRef, "' type ", textureType,
|
||||
" index ", textureTypeIndex, " UV ", uvCoord);
|
||||
DefaultLogger::get()->debug(Formatter::format() << " texture '" << textureRef << "' type " << textureType
|
||||
<< " index " << textureTypeIndex << " UV " << uvCoord);
|
||||
|
||||
aiString assimpTextureRef(textureRef);
|
||||
material->AddProperty(&assimpTextureRef, AI_MATKEY_TEXTURE(textureType, textureTypeIndex));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue