Merge branch 'master' into sgold/deprecate-blend
commit
a7e99c86e8
|
@ -98,7 +98,7 @@ jobs:
|
||||||
run: cd build/bin && ./unit ${{ steps.hunter_extra_test_args.outputs.args }}
|
run: cd build/bin && ./unit ${{ steps.hunter_extra_test_args.outputs.args }}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v4
|
||||||
if: matrix.name == 'windows-msvc'
|
if: matrix.name == 'windows-msvc'
|
||||||
with:
|
with:
|
||||||
name: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}'
|
name: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}'
|
||||||
|
|
|
@ -19,7 +19,7 @@ jobs:
|
||||||
dry-run: false
|
dry-run: false
|
||||||
language: c++
|
language: c++
|
||||||
- name: Upload Crash
|
- name: Upload Crash
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
if: failure() && steps.build.outcome == 'success'
|
if: failure() && steps.build.outcome == 'success'
|
||||||
with:
|
with:
|
||||||
name: artifacts
|
name: artifacts
|
||||||
|
|
|
@ -137,7 +137,7 @@ IF (WIN32)
|
||||||
ELSE()
|
ELSE()
|
||||||
OPTION( ASSIMP_BUILD_ZLIB
|
OPTION( ASSIMP_BUILD_ZLIB
|
||||||
"Build your own zlib"
|
"Build your own zlib"
|
||||||
ON
|
OFF
|
||||||
)
|
)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
@ -311,9 +311,9 @@ ELSEIF( MINGW )
|
||||||
SET(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}")
|
SET(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long -Wa,-mbig-obj -g ${CMAKE_CXX_FLAGS}")
|
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wno-dangling-reference -Wall -Wno-long-long -Wa,-mbig-obj -g ${CMAKE_CXX_FLAGS}")
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long -Wa,-mbig-obj -O3 ${CMAKE_CXX_FLAGS}")
|
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wno-dangling-reference -Wall -Wno-long-long -Wa,-mbig-obj -O3 ${CMAKE_CXX_FLAGS}")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
|
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
|
@ -81,12 +81,17 @@ static constexpr aiImporterDesc desc = {
|
||||||
"3mf"
|
"3mf"
|
||||||
};
|
};
|
||||||
|
|
||||||
bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool /*checkSig*/) const {
|
bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool ) const {
|
||||||
if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) {
|
if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
D3MF::D3MFOpcPackage opcPackage(pIOHandler, filename);
|
static const char *const ModelRef = "3D/3dmodel.model";
|
||||||
return opcPackage.validate();
|
ZipArchiveIOSystem archive(pIOHandler, filename);
|
||||||
|
if (!archive.Exists(ModelRef)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void D3MFImporter::SetupProperties(const Importer*) {
|
void D3MFImporter::SetupProperties(const Importer*) {
|
||||||
|
|
|
@ -2725,6 +2725,10 @@ template <> size_t GenericFill<IfcSpatialStructureElement>(const DB& db, const L
|
||||||
do { // convert the 'CompositionType' argument
|
do { // convert the 'CompositionType' argument
|
||||||
std::shared_ptr<const DataType> arg = params[base++];
|
std::shared_ptr<const DataType> arg = params[base++];
|
||||||
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcSpatialStructureElement,2>::aux_is_derived[1]=true; break; }
|
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcSpatialStructureElement,2>::aux_is_derived[1]=true; break; }
|
||||||
|
if (dynamic_cast<const UNSET *>(&*arg)) {
|
||||||
|
// Consider assigning the default value as in->CompositionType = "ELEMENT".
|
||||||
|
break;
|
||||||
|
}
|
||||||
try { GenericConvert( in->CompositionType, arg, db ); break; }
|
try { GenericConvert( in->CompositionType, arg, db ); break; }
|
||||||
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 8 to IfcSpatialStructureElement to be a `IfcElementCompositionEnum`")); }
|
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 8 to IfcSpatialStructureElement to be a `IfcElementCompositionEnum`")); }
|
||||||
} while (false);
|
} while (false);
|
||||||
|
|
|
@ -1234,7 +1234,10 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
||||||
// Parse the XML
|
// Parse the XML
|
||||||
// Find the scene root from document root.
|
// Find the scene root from document root.
|
||||||
const pugi::xml_node &sceneRoot = documentRoot.child("irr_scene");
|
const pugi::xml_node &sceneRoot = documentRoot.child("irr_scene");
|
||||||
if (!sceneRoot) throw new DeadlyImportError("IRR: <irr_scene> not found in file");
|
if (!sceneRoot) {
|
||||||
|
delete root;
|
||||||
|
throw new DeadlyImportError("IRR: <irr_scene> not found in file");
|
||||||
|
}
|
||||||
for (pugi::xml_node &child : sceneRoot.children()) {
|
for (pugi::xml_node &child : sceneRoot.children()) {
|
||||||
// XML elements are either nodes, animators, attributes, or materials
|
// XML elements are either nodes, animators, attributes, or materials
|
||||||
if (!ASSIMP_stricmp(child.name(), "node")) {
|
if (!ASSIMP_stricmp(child.name(), "node")) {
|
||||||
|
|
|
@ -123,9 +123,8 @@ aiColor4D MDLImporter::ReplaceTextureWithColor(const aiTexture *pcTexture) {
|
||||||
// Read a texture from a MDL3 file
|
// Read a texture from a MDL3 file
|
||||||
void MDLImporter::CreateTextureARGB8_3DGS_MDL3(const unsigned char *szData) {
|
void MDLImporter::CreateTextureARGB8_3DGS_MDL3(const unsigned char *szData) {
|
||||||
const MDL::Header *pcHeader = (const MDL::Header *)mBuffer; //the endianness is already corrected in the InternReadFile_3DGS_MDL345 function
|
const MDL::Header *pcHeader = (const MDL::Header *)mBuffer; //the endianness is already corrected in the InternReadFile_3DGS_MDL345 function
|
||||||
|
const size_t len = pcHeader->skinwidth * pcHeader->skinheight;
|
||||||
VALIDATE_FILE_SIZE(szData + pcHeader->skinwidth *
|
VALIDATE_FILE_SIZE(szData + len);
|
||||||
pcHeader->skinheight);
|
|
||||||
|
|
||||||
// allocate a new texture object
|
// allocate a new texture object
|
||||||
aiTexture *pcNew = new aiTexture();
|
aiTexture *pcNew = new aiTexture();
|
||||||
|
|
|
@ -395,7 +395,10 @@ void Q3BSPFileImporter::createTriangleTopology(const Q3BSP::Q3BSPModel *pModel,
|
||||||
m_pCurrentFace->mIndices = new unsigned int[3];
|
m_pCurrentFace->mIndices = new unsigned int[3];
|
||||||
m_pCurrentFace->mIndices[idx] = vertIdx;
|
m_pCurrentFace->mIndices[idx] = vertIdx;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
m_pCurrentFace->mIndices[idx] = vertIdx;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
pMesh->mVertices[vertIdx].Set(pVertex->vPosition.x, pVertex->vPosition.y, pVertex->vPosition.z);
|
pMesh->mVertices[vertIdx].Set(pVertex->vPosition.x, pVertex->vPosition.y, pVertex->vPosition.z);
|
||||||
pMesh->mNormals[vertIdx].Set(pVertex->vNormal.x, pVertex->vNormal.y, pVertex->vNormal.z);
|
pMesh->mNormals[vertIdx].Set(pVertex->vNormal.x, pVertex->vNormal.y, pVertex->vNormal.z);
|
||||||
|
|
|
@ -912,6 +912,7 @@ void glTF2Exporter::ExportMaterials() {
|
||||||
if (GetMatSpecular(mat, specular)) {
|
if (GetMatSpecular(mat, specular)) {
|
||||||
mAsset->extensionsUsed.KHR_materials_specular = true;
|
mAsset->extensionsUsed.KHR_materials_specular = true;
|
||||||
m->materialSpecular = Nullable<MaterialSpecular>(specular);
|
m->materialSpecular = Nullable<MaterialSpecular>(specular);
|
||||||
|
GetMatColor(mat, m->pbrMetallicRoughness.baseColorFactor, AI_MATKEY_COLOR_DIFFUSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
MaterialSheen sheen;
|
MaterialSheen sheen;
|
||||||
|
|
|
@ -99,12 +99,12 @@ bool DefaultIOSystem::Exists(const char *pFile) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
FILE *file = ::fopen(pFile, "rb");
|
struct stat statbuf;
|
||||||
if (!file) {
|
stat(pFile, &statbuf);
|
||||||
|
// test for a regular file
|
||||||
|
if (!S_ISREG(statbuf.st_mode)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
::fclose(file);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -116,6 +116,7 @@ IOStream *DefaultIOSystem::Open(const char *strFile, const char *strMode) {
|
||||||
ai_assert(strFile != nullptr);
|
ai_assert(strFile != nullptr);
|
||||||
ai_assert(strMode != nullptr);
|
ai_assert(strMode != nullptr);
|
||||||
FILE *file;
|
FILE *file;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
std::wstring name = Utf8ToWide(strFile);
|
std::wstring name = Utf8ToWide(strFile);
|
||||||
if (name.empty()) {
|
if (name.empty()) {
|
||||||
|
@ -126,6 +127,7 @@ IOStream *DefaultIOSystem::Open(const char *strFile, const char *strMode) {
|
||||||
#else
|
#else
|
||||||
file = ::fopen(strFile, strMode);
|
file = ::fopen(strFile, strMode);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,22 +89,27 @@ using namespace Assimp;
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
void ExportScenePbrt (
|
void ExportScenePbrt(const char *pFile, IOSystem *pIOSystem, const aiScene *pScene,
|
||||||
const char* pFile,
|
const ExportProperties *) {
|
||||||
IOSystem* pIOSystem,
|
|
||||||
const aiScene* pScene,
|
|
||||||
const ExportProperties* /*pProperties*/
|
|
||||||
){
|
|
||||||
std::string path = DefaultIOSystem::absolutePath(std::string(pFile));
|
std::string path = DefaultIOSystem::absolutePath(std::string(pFile));
|
||||||
std::string file = DefaultIOSystem::completeBaseName(std::string(pFile));
|
std::string file = DefaultIOSystem::completeBaseName(std::string(pFile));
|
||||||
|
path = path + file + ".pbrt";
|
||||||
// initialize the exporter
|
// initialize the exporter
|
||||||
PbrtExporter exporter(pScene, pIOSystem, path, file);
|
PbrtExporter exporter(pScene, pIOSystem, path, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end of namespace Assimp
|
} // end of namespace Assimp
|
||||||
|
|
||||||
// Constructor
|
static void create_embedded_textures_folder(const aiScene *scene, IOSystem *pIOSystem) {
|
||||||
|
if (scene->mNumTextures > 0) {
|
||||||
|
if (!pIOSystem->Exists("textures")) {
|
||||||
|
if (!pIOSystem->CreateDirectory("textures")) {
|
||||||
|
throw DeadlyExportError("Could not create textures/ directory.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PbrtExporter::PbrtExporter(
|
PbrtExporter::PbrtExporter(
|
||||||
const aiScene *pScene, IOSystem *pIOSystem,
|
const aiScene *pScene, IOSystem *pIOSystem,
|
||||||
const std::string &path, const std::string &file) :
|
const std::string &path, const std::string &file) :
|
||||||
|
@ -127,10 +132,10 @@ PbrtExporter::PbrtExporter(
|
||||||
0.f, 0.f, 1.f, 0.f, //
|
0.f, 0.f, 1.f, 0.f, //
|
||||||
0.f, 0.f, 0.f, 1.f //
|
0.f, 0.f, 0.f, 1.f //
|
||||||
) * mRootTransform;
|
) * mRootTransform;
|
||||||
|
|
||||||
// Export embedded textures.
|
// Export embedded textures.
|
||||||
if (mScene->mNumTextures > 0)
|
create_embedded_textures_folder(mScene, mIOSystem);
|
||||||
if (!mIOSystem->CreateDirectory("textures"))
|
|
||||||
throw DeadlyExportError("Could not create textures/ directory.");
|
|
||||||
for (unsigned int i = 0; i < mScene->mNumTextures; ++i) {
|
for (unsigned int i = 0; i < mScene->mNumTextures; ++i) {
|
||||||
aiTexture* tex = mScene->mTextures[i];
|
aiTexture* tex = mScene->mTextures[i];
|
||||||
std::string fn = CleanTextureFilename(tex->mFilename, false);
|
std::string fn = CleanTextureFilename(tex->mFilename, false);
|
||||||
|
@ -176,9 +181,6 @@ PbrtExporter::PbrtExporter(
|
||||||
outfile->Write(mOutput.str().c_str(), mOutput.str().length(), 1);
|
outfile->Write(mOutput.str().c_str(), mOutput.str().length(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destructor
|
|
||||||
PbrtExporter::~PbrtExporter() = default;
|
|
||||||
|
|
||||||
void PbrtExporter::WriteMetaData() {
|
void PbrtExporter::WriteMetaData() {
|
||||||
mOutput << "#############################\n";
|
mOutput << "#############################\n";
|
||||||
mOutput << "# Scene metadata:\n";
|
mOutput << "# Scene metadata:\n";
|
||||||
|
|
|
@ -70,15 +70,33 @@ class ExportProperties;
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
/** Helper class to export a given scene to a Pbrt file. */
|
/** Helper class to export a given scene to a Pbrt file. */
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
class PbrtExporter
|
class PbrtExporter {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
/// Constructor for a specific scene to export
|
/// Constructor for a specific scene to export
|
||||||
PbrtExporter(const aiScene *pScene, IOSystem *pIOSystem,
|
PbrtExporter(const aiScene *pScene, IOSystem *pIOSystem,
|
||||||
const std::string &path, const std::string &file);
|
const std::string &path, const std::string &file);
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
virtual ~PbrtExporter();
|
virtual ~PbrtExporter() = default;
|
||||||
|
|
||||||
|
private:
|
||||||
|
aiMatrix4x4 GetNodeTransform(const aiString &name) const;
|
||||||
|
static std::string TransformAsString(const aiMatrix4x4 &m);
|
||||||
|
static std::string RemoveSuffix(std::string filename);
|
||||||
|
std::string CleanTextureFilename(const aiString &f, bool rewriteExtension = true) const;
|
||||||
|
void WriteMetaData();
|
||||||
|
void WriteWorldDefinition();
|
||||||
|
void WriteCameras();
|
||||||
|
void WriteCamera(int i);
|
||||||
|
void WriteLights();
|
||||||
|
void WriteTextures();
|
||||||
|
static bool TextureHasAlphaMask(const std::string &filename);
|
||||||
|
void WriteMaterials();
|
||||||
|
void WriteMaterial(int i);
|
||||||
|
void WriteMesh(aiMesh *mesh);
|
||||||
|
void WriteInstanceDefinition(int i);
|
||||||
|
void WriteGeometricObjects(aiNode *node, aiMatrix4x4 parentTransform,
|
||||||
|
std::map<int, int> &meshUses);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// the scene to export
|
// the scene to export
|
||||||
|
@ -96,39 +114,11 @@ private:
|
||||||
/// Name of the file (without extension) where the scene will be exported
|
/// Name of the file (without extension) where the scene will be exported
|
||||||
const std::string mFile;
|
const std::string mFile;
|
||||||
|
|
||||||
private:
|
|
||||||
// A private set to keep track of which textures have been declared
|
// A private set to keep track of which textures have been declared
|
||||||
std::set<std::string> mTextureSet;
|
std::set<std::string> mTextureSet;
|
||||||
|
|
||||||
// Transform to apply to the root node and all root objects such as cameras, lights, etc.
|
// Transform to apply to the root node and all root objects such as cameras, lights, etc.
|
||||||
aiMatrix4x4 mRootTransform;
|
aiMatrix4x4 mRootTransform;
|
||||||
|
|
||||||
aiMatrix4x4 GetNodeTransform(const aiString& name) const;
|
|
||||||
static std::string TransformAsString(const aiMatrix4x4& m);
|
|
||||||
|
|
||||||
static std::string RemoveSuffix(std::string filename);
|
|
||||||
std::string CleanTextureFilename(const aiString &f, bool rewriteExtension = true) const;
|
|
||||||
|
|
||||||
void WriteMetaData();
|
|
||||||
|
|
||||||
void WriteWorldDefinition();
|
|
||||||
|
|
||||||
void WriteCameras();
|
|
||||||
void WriteCamera(int i);
|
|
||||||
|
|
||||||
void WriteLights();
|
|
||||||
|
|
||||||
void WriteTextures();
|
|
||||||
static bool TextureHasAlphaMask(const std::string &filename);
|
|
||||||
|
|
||||||
void WriteMaterials();
|
|
||||||
void WriteMaterial(int i);
|
|
||||||
|
|
||||||
void WriteMesh(aiMesh* mesh);
|
|
||||||
|
|
||||||
void WriteInstanceDefinition(int i);
|
|
||||||
void WriteGeometricObjects(aiNode* node, aiMatrix4x4 parentTransform,
|
|
||||||
std::map<int, int> &meshUses);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Assimp
|
} // namespace Assimp
|
||||||
|
|
|
@ -111,6 +111,9 @@ void Sweep::EdgeEvent(SweepContext& tcx, Edge* edge, Node* node)
|
||||||
|
|
||||||
void Sweep::EdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* triangle, Point& point)
|
void Sweep::EdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* triangle, Point& point)
|
||||||
{
|
{
|
||||||
|
if (triangle == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
if (IsEdgeSideOfTriangle(*triangle, ep, eq)) {
|
if (IsEdgeSideOfTriangle(*triangle, ep, eq)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ public:
|
||||||
* Create an instance of your derived class and assign it to an
|
* Create an instance of your derived class and assign it to an
|
||||||
* #Assimp::Importer instance by calling Importer::SetIOHandler().
|
* #Assimp::Importer instance by calling Importer::SetIOHandler().
|
||||||
*/
|
*/
|
||||||
IOSystem() AI_NO_EXCEPT;
|
IOSystem() AI_NO_EXCEPT = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** @brief Virtual destructor.
|
/** @brief Virtual destructor.
|
||||||
|
@ -105,7 +105,7 @@ public:
|
||||||
* It is safe to be called from within DLL Assimp, we're constructed
|
* It is safe to be called from within DLL Assimp, we're constructed
|
||||||
* on Assimp's heap.
|
* on Assimp's heap.
|
||||||
*/
|
*/
|
||||||
virtual ~IOSystem();
|
virtual ~IOSystem() = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** @brief For backward compatibility
|
/** @brief For backward compatibility
|
||||||
|
@ -236,12 +236,6 @@ private:
|
||||||
std::vector<std::string> m_pathStack;
|
std::vector<std::string> m_pathStack;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
AI_FORCE_INLINE IOSystem::IOSystem() AI_NO_EXCEPT = default;
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
AI_FORCE_INLINE IOSystem::~IOSystem() = default;
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// For compatibility, the interface of some functions taking a std::string was
|
// For compatibility, the interface of some functions taking a std::string was
|
||||||
// changed to const char* to avoid crashes between binary incompatible STL
|
// changed to const char* to avoid crashes between binary incompatible STL
|
||||||
|
|
|
@ -165,6 +165,7 @@ SET( IMPORTERS
|
||||||
unit/ImportExport/MDL/utMDLImporter_HL1_Nodes.cpp
|
unit/ImportExport/MDL/utMDLImporter_HL1_Nodes.cpp
|
||||||
unit/ImportExport/RAW/utRAWImportExport.cpp
|
unit/ImportExport/RAW/utRAWImportExport.cpp
|
||||||
unit/ImportExport/Terragen/utTerragenImportExport.cpp
|
unit/ImportExport/Terragen/utTerragenImportExport.cpp
|
||||||
|
unit/ImportExport/Pbrt/utPbrtImportExport.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
SET( MATERIAL
|
SET( MATERIAL
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
/*
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
Open Asset Import Library (assimp)
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2006-2020, assimp team
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above
|
||||||
|
copyright notice, this list of conditions and the
|
||||||
|
following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the
|
||||||
|
following disclaimer in the documentation and/or other
|
||||||
|
materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of the assimp team, nor the names of its
|
||||||
|
contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior
|
||||||
|
written permission of the assimp team.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
#include "AbstractImportExportBase.h"
|
||||||
|
#include "UnitTestPCH.h"
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
#include <assimp/scene.h>
|
||||||
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/Exporter.hpp>
|
||||||
|
|
||||||
|
using namespace Assimp;
|
||||||
|
|
||||||
|
class utPbrtImportExport : public AbstractImportExportBase {
|
||||||
|
public:
|
||||||
|
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||||
|
bool exporterTest() override {
|
||||||
|
Assimp::Importer importer;
|
||||||
|
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", aiProcess_ValidateDataStructure);
|
||||||
|
EXPECT_NE(scene, nullptr );
|
||||||
|
|
||||||
|
::Assimp::Exporter exporter;
|
||||||
|
return AI_SUCCESS == exporter.Export(scene, "pbrt", ASSIMP_TEST_MODELS_DIR "/OBJ/spider_out.pbrt");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||||
|
|
||||||
|
TEST_F(utPbrtImportExport, exportTest_Success) {
|
||||||
|
EXPECT_TRUE(exporterTest());
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // ASSIMP_BUILD_NO_EXPORT
|
Loading…
Reference in New Issue