mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-10 06:04:37 +00:00
update assimp to 6.0.5
This commit is contained in:
parent
2d2eb57e2e
commit
f5cf21cfeb
941 changed files with 22718 additions and 12240 deletions
|
|
@ -2,7 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -93,17 +93,22 @@ void ExportScenePbrt(const char *pFile, IOSystem *pIOSystem, const aiScene *pSce
|
|||
const ExportProperties *) {
|
||||
std::string path = DefaultIOSystem::absolutePath(std::string(pFile));
|
||||
std::string file = DefaultIOSystem::completeBaseName(std::string(pFile));
|
||||
path = path + file + ".pbrt";
|
||||
std::string texturesPath = path;
|
||||
if (!texturesPath.empty()) {
|
||||
texturesPath+=pIOSystem->getOsSeparator();
|
||||
}
|
||||
texturesPath+="textures";
|
||||
|
||||
// initialize the exporter
|
||||
PbrtExporter exporter(pScene, pIOSystem, path, file);
|
||||
PbrtExporter exporter(pScene, pIOSystem, path, file, texturesPath);
|
||||
}
|
||||
|
||||
} // end of namespace Assimp
|
||||
|
||||
static void create_embedded_textures_folder(const aiScene *scene, IOSystem *pIOSystem) {
|
||||
static void create_embedded_textures_folder(const aiScene *scene, IOSystem *pIOSystem, const std::string &texturesPath) {
|
||||
if (scene->mNumTextures > 0) {
|
||||
if (!pIOSystem->Exists("textures")) {
|
||||
if (!pIOSystem->CreateDirectory("textures")) {
|
||||
if (!pIOSystem->Exists(texturesPath)) {
|
||||
if (!pIOSystem->CreateDirectory(texturesPath)) {
|
||||
throw DeadlyExportError("Could not create textures/ directory.");
|
||||
}
|
||||
}
|
||||
|
|
@ -112,11 +117,12 @@ static void create_embedded_textures_folder(const aiScene *scene, IOSystem *pIOS
|
|||
|
||||
PbrtExporter::PbrtExporter(
|
||||
const aiScene *pScene, IOSystem *pIOSystem,
|
||||
const std::string &path, const std::string &file) :
|
||||
const std::string &path, const std::string &file, const std::string &texturesPath) :
|
||||
mScene(pScene),
|
||||
mIOSystem(pIOSystem),
|
||||
mPath(path),
|
||||
mFile(file),
|
||||
mTexturesPath(texturesPath),
|
||||
mRootTransform(
|
||||
// rotates the (already left-handed) CRS -90 degrees around the x axis in order to
|
||||
// make +Z 'up' and +Y 'towards viewer', as in default in pbrt
|
||||
|
|
@ -132,10 +138,10 @@ PbrtExporter::PbrtExporter(
|
|||
0.f, 0.f, 1.f, 0.f, //
|
||||
0.f, 0.f, 0.f, 1.f //
|
||||
) * mRootTransform;
|
||||
|
||||
|
||||
// Export embedded textures.
|
||||
create_embedded_textures_folder(mScene, mIOSystem);
|
||||
|
||||
create_embedded_textures_folder(mScene, mIOSystem, mTexturesPath);
|
||||
|
||||
for (unsigned int i = 0; i < mScene->mNumTextures; ++i) {
|
||||
aiTexture* tex = mScene->mTextures[i];
|
||||
std::string fn = CleanTextureFilename(tex->mFilename, false);
|
||||
|
|
@ -174,7 +180,13 @@ PbrtExporter::PbrtExporter(
|
|||
WriteWorldDefinition();
|
||||
|
||||
// And write the file to disk...
|
||||
std::unique_ptr<IOStream> outfile(mIOSystem->Open(mPath,"wt"));
|
||||
std::string outputFilePath = mPath;
|
||||
if (!outputFilePath.empty()) {
|
||||
outputFilePath = outputFilePath + mIOSystem->getOsSeparator();
|
||||
}
|
||||
outputFilePath = outputFilePath + mFile +".pbrt";
|
||||
|
||||
std::unique_ptr<IOStream> outfile(mIOSystem->Open(outputFilePath,"wt"));
|
||||
if (!outfile) {
|
||||
throw DeadlyExportError("could not open output .pbrt file: " + std::string(mFile));
|
||||
}
|
||||
|
|
@ -678,7 +690,7 @@ std::string PbrtExporter::CleanTextureFilename(const aiString &f, bool rewriteEx
|
|||
}
|
||||
|
||||
// Expect all textures in textures
|
||||
fn = std::string("textures") + mIOSystem->getOsSeparator() + fn;
|
||||
fn = mTexturesPath + mIOSystem->getOsSeparator() + fn;
|
||||
|
||||
// Rewrite extension for unsupported file formats.
|
||||
if (rewriteExtension) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue