mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-27 16:19:34 +00:00
update assimp lib
This commit is contained in:
parent
03a348deb7
commit
d3f8fee74e
1725 changed files with 196314 additions and 62009 deletions
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
|
||||
namespace Unreal {
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ inline void DecompressVertex(aiVector3D &v, int32_t in) {
|
|||
|
||||
} // end namespace Unreal
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"Unreal Mesh Importer",
|
||||
"",
|
||||
"",
|
||||
|
|
@ -178,7 +178,7 @@ UnrealImporter::~UnrealImporter() = default;
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
bool UnrealImporter::CanRead(const std::string & filename, IOSystem * /*pIOHandler*/, bool /*checkSig*/) const {
|
||||
bool UnrealImporter::CanRead(const std::string &filename, IOSystem * /*pIOHandler*/, bool /*checkSig*/) const {
|
||||
return SimpleExtensionCheck(filename, "3d", "uc");
|
||||
}
|
||||
|
||||
|
|
@ -315,47 +315,49 @@ void UnrealImporter::InternReadFile(const std::string &pFile,
|
|||
|
||||
// we can live without the uc file if necessary
|
||||
std::unique_ptr<IOStream> pb(pIOHandler->Open(uc_path));
|
||||
if (pb.get()) {
|
||||
if (pb) {
|
||||
|
||||
std::vector<char> _data;
|
||||
TextFileToBuffer(pb.get(), _data);
|
||||
const char *data = &_data[0];
|
||||
const char *end = &_data[_data.size() - 1] + 1;
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> tempTextures;
|
||||
|
||||
// do a quick search in the UC file for some known, usually texture-related, tags
|
||||
for (; *data; ++data) {
|
||||
if (TokenMatchI(data, "#exec", 5)) {
|
||||
SkipSpacesAndLineEnd(&data);
|
||||
SkipSpacesAndLineEnd(&data, end);
|
||||
|
||||
// #exec TEXTURE IMPORT [...] NAME=jjjjj [...] FILE=jjjj.pcx [...]
|
||||
if (TokenMatchI(data, "TEXTURE", 7)) {
|
||||
SkipSpacesAndLineEnd(&data);
|
||||
SkipSpacesAndLineEnd(&data, end);
|
||||
|
||||
if (TokenMatchI(data, "IMPORT", 6)) {
|
||||
tempTextures.emplace_back();
|
||||
std::pair<std::string, std::string> &me = tempTextures.back();
|
||||
for (; !IsLineEnd(*data); ++data) {
|
||||
if (!::ASSIMP_strincmp(data, "NAME=", 5)) {
|
||||
if (!ASSIMP_strincmp(data, "NAME=", 5)) {
|
||||
const char *d = data += 5;
|
||||
for (; !IsSpaceOrNewLine(*data); ++data)
|
||||
;
|
||||
me.first = std::string(d, (size_t)(data - d));
|
||||
} else if (!::ASSIMP_strincmp(data, "FILE=", 5)) {
|
||||
} else if (!ASSIMP_strincmp(data, "FILE=", 5)) {
|
||||
const char *d = data += 5;
|
||||
for (; !IsSpaceOrNewLine(*data); ++data)
|
||||
;
|
||||
me.second = std::string(d, (size_t)(data - d));
|
||||
}
|
||||
}
|
||||
if (!me.first.length() || !me.second.length())
|
||||
if (!me.first.length() || !me.second.length()) {
|
||||
tempTextures.pop_back();
|
||||
}
|
||||
}
|
||||
}
|
||||
// #exec MESHMAP SETTEXTURE MESHMAP=box NUM=1 TEXTURE=Jtex1
|
||||
// #exec MESHMAP SCALE MESHMAP=box X=0.1 Y=0.1 Z=0.2
|
||||
else if (TokenMatchI(data, "MESHMAP", 7)) {
|
||||
SkipSpacesAndLineEnd(&data);
|
||||
SkipSpacesAndLineEnd(&data, end);
|
||||
|
||||
if (TokenMatchI(data, "SETTEXTURE", 10)) {
|
||||
|
||||
|
|
@ -363,14 +365,13 @@ void UnrealImporter::InternReadFile(const std::string &pFile,
|
|||
std::pair<unsigned int, std::string> &me = textures.back();
|
||||
|
||||
for (; !IsLineEnd(*data); ++data) {
|
||||
if (!::ASSIMP_strincmp(data, "NUM=", 4)) {
|
||||
if (!ASSIMP_strincmp(data, "NUM=", 4)) {
|
||||
data += 4;
|
||||
me.first = strtoul10(data, &data);
|
||||
} else if (!::ASSIMP_strincmp(data, "TEXTURE=", 8)) {
|
||||
} else if (!ASSIMP_strincmp(data, "TEXTURE=", 8)) {
|
||||
data += 8;
|
||||
const char *d = data;
|
||||
for (; !IsSpaceOrNewLine(*data); ++data)
|
||||
;
|
||||
for (; !IsSpaceOrNewLine(*data); ++data);
|
||||
me.second = std::string(d, (size_t)(data - d));
|
||||
|
||||
// try to find matching path names, doesn't care if we don't find them
|
||||
|
|
@ -408,7 +409,7 @@ void UnrealImporter::InternReadFile(const std::string &pFile,
|
|||
// find out how many output meshes and materials we'll have and build material indices
|
||||
for (Unreal::Triangle &tri : triangles) {
|
||||
Unreal::TempMat mat(tri);
|
||||
std::vector<Unreal::TempMat>::iterator nt = std::find(materials.begin(), materials.end(), mat);
|
||||
auto nt = std::find(materials.begin(), materials.end(), mat);
|
||||
if (nt == materials.end()) {
|
||||
// add material
|
||||
tri.matIndex = static_cast<unsigned int>(materials.size());
|
||||
|
|
@ -451,7 +452,7 @@ void UnrealImporter::InternReadFile(const std::string &pFile,
|
|||
aiColor3D color(1.f, 1.f, 1.f);
|
||||
|
||||
aiString s;
|
||||
::ai_snprintf(s.data, MAXLEN, "mat%u_tx%u_", i, materials[i].tex);
|
||||
::ai_snprintf(s.data, AI_MAXLEN, "mat%u_tx%u_", i, materials[i].tex);
|
||||
|
||||
// set the two-sided flag
|
||||
if (materials[i].type == Unreal::MF_NORMAL_TS) {
|
||||
|
|
@ -471,7 +472,7 @@ void UnrealImporter::InternReadFile(const std::string &pFile,
|
|||
|
||||
// a special name for the weapon attachment point
|
||||
if (materials[i].type == Unreal::MF_WEAPON_PLACEHOLDER) {
|
||||
s.length = ::ai_snprintf(s.data, MAXLEN, "$WeaponTag$");
|
||||
s.length = ::ai_snprintf(s.data, AI_MAXLEN, "$WeaponTag$");
|
||||
color = aiColor3D(0.f, 0.f, 0.f);
|
||||
}
|
||||
|
||||
|
|
@ -516,4 +517,6 @@ void UnrealImporter::InternReadFile(const std::string &pFile,
|
|||
flipper.Execute(pScene);
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#endif // !! ASSIMP_BUILD_NO_3D_IMPORTER
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue