Merge branch 'master' into sanchikuuus-add_more_Maya_materials
commit
9dddc72966
|
@ -1200,7 +1200,6 @@ IF (ASSIMP_WARNINGS_AS_ERRORS)
|
||||||
|
|
||||||
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) # clang-cl
|
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) # clang-cl
|
||||||
TARGET_COMPILE_OPTIONS(assimp PRIVATE -Wall -Werror
|
TARGET_COMPILE_OPTIONS(assimp PRIVATE -Wall -Werror
|
||||||
-Wno-unused-function
|
|
||||||
-Wno-microsoft-enum-value
|
-Wno-microsoft-enum-value
|
||||||
-Wno-switch-enum
|
-Wno-switch-enum
|
||||||
-Wno-covered-switch-default
|
-Wno-covered-switch-default
|
||||||
|
@ -1390,7 +1389,7 @@ ENDIF()
|
||||||
|
|
||||||
# Add RT-extension library for glTF importer with Open3DGC-compression.
|
# Add RT-extension library for glTF importer with Open3DGC-compression.
|
||||||
IF (RT_FOUND AND ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC)
|
IF (RT_FOUND AND ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC)
|
||||||
TARGET_LINK_LIBRARIES(assimp ${RT_LIBRARY})
|
TARGET_LINK_LIBRARIES(assimp rt)
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ static void setupExporterArray(std::vector<Exporter::ExportFormatEntry> &exporte
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_PBRT_EXPORTER
|
#ifndef ASSIMP_BUILD_NO_PBRT_EXPORTER
|
||||||
exporters.emplace_back("pbrt", "pbrt-v4 scene description file", "pbrt", &ExportScenePbrt, aiProcess_Triangulate | aiProcess_SortByPType);
|
exporters.emplace_back("pbrt", "pbrt-v4 scene description file", "pbrt", &ExportScenePbrt, aiProcess_ConvertToLeftHanded | aiProcess_Triangulate | aiProcess_SortByPType);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_ASSJSON_EXPORTER
|
#ifndef ASSIMP_BUILD_NO_ASSJSON_EXPORTER
|
||||||
|
|
|
@ -48,6 +48,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wunused-function"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef STB_USE_HUNTER
|
#ifndef STB_USE_HUNTER
|
||||||
/* Use prefixed names for the symbols from stb_image as it is a very commonly embedded library.
|
/* Use prefixed names for the symbols from stb_image as it is a very commonly embedded library.
|
||||||
Including vanilla stb_image symbols causes duplicate symbol problems if assimp is linked
|
Including vanilla stb_image symbols causes duplicate symbol problems if assimp is linked
|
||||||
|
@ -114,3 +119,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
|
@ -111,7 +111,22 @@ PbrtExporter::PbrtExporter(
|
||||||
mScene(pScene),
|
mScene(pScene),
|
||||||
mIOSystem(pIOSystem),
|
mIOSystem(pIOSystem),
|
||||||
mPath(path),
|
mPath(path),
|
||||||
mFile(file) {
|
mFile(file),
|
||||||
|
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
|
||||||
|
1.f, 0.f, 0.f, 0.f, //
|
||||||
|
0.f, 0.f, -1.f, 0.f, //
|
||||||
|
0.f, 1.f, 0.f, 0.f, //
|
||||||
|
0.f, 0.f, 0.f, 1.f //
|
||||||
|
) {
|
||||||
|
|
||||||
|
mRootTransform = aiMatrix4x4(
|
||||||
|
-1.f, 0, 0.f, 0.f, //
|
||||||
|
0.0f, -1.f, 0.f, 0.f, //
|
||||||
|
0.f, 0.f, 1.f, 0.f, //
|
||||||
|
0.f, 0.f, 0.f, 1.f //
|
||||||
|
) * mRootTransform;
|
||||||
// Export embedded textures.
|
// Export embedded textures.
|
||||||
if (mScene->mNumTextures > 0)
|
if (mScene->mNumTextures > 0)
|
||||||
if (!mIOSystem->CreateDirectory("textures"))
|
if (!mIOSystem->CreateDirectory("textures"))
|
||||||
|
@ -260,7 +275,7 @@ aiMatrix4x4 PbrtExporter::GetNodeTransform(const aiString &name) const {
|
||||||
node = node->mParent;
|
node = node->mParent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return m;
|
return mRootTransform * m;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string PbrtExporter::TransformAsString(const aiMatrix4x4 &m) {
|
std::string PbrtExporter::TransformAsString(const aiMatrix4x4 &m) {
|
||||||
|
@ -309,7 +324,7 @@ void PbrtExporter::WriteCamera(int i) {
|
||||||
|
|
||||||
// Get camera fov
|
// Get camera fov
|
||||||
float hfov = AI_RAD_TO_DEG(camera->mHorizontalFOV);
|
float hfov = AI_RAD_TO_DEG(camera->mHorizontalFOV);
|
||||||
float fov = (aspect >= 1.0) ? hfov : (hfov * aspect);
|
float fov = (aspect >= 1.0) ? hfov : (hfov / aspect);
|
||||||
if (fov < 5) {
|
if (fov < 5) {
|
||||||
std::cerr << fov << ": suspiciously low field of view specified by camera. Setting to 45 degrees.\n";
|
std::cerr << fov << ": suspiciously low field of view specified by camera. Setting to 45 degrees.\n";
|
||||||
fov = 45;
|
fov = 45;
|
||||||
|
@ -327,7 +342,7 @@ void PbrtExporter::WriteCamera(int i) {
|
||||||
|
|
||||||
if (!cameraActive)
|
if (!cameraActive)
|
||||||
mOutput << "# ";
|
mOutput << "# ";
|
||||||
mOutput << "Scale -1 1 1\n"; // right handed -> left handed
|
mOutput << "Scale 1 1 1\n";
|
||||||
if (!cameraActive)
|
if (!cameraActive)
|
||||||
mOutput << "# ";
|
mOutput << "# ";
|
||||||
mOutput << "LookAt "
|
mOutput << "LookAt "
|
||||||
|
@ -383,8 +398,8 @@ void PbrtExporter::WriteWorldDefinition() {
|
||||||
}
|
}
|
||||||
|
|
||||||
mOutput << "# Geometry\n\n";
|
mOutput << "# Geometry\n\n";
|
||||||
aiMatrix4x4 worldFromObject;
|
|
||||||
WriteGeometricObjects(mScene->mRootNode, worldFromObject, meshUses);
|
WriteGeometricObjects(mScene->mRootNode, mRootTransform, meshUses);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PbrtExporter::WriteTextures() {
|
void PbrtExporter::WriteTextures() {
|
||||||
|
|
|
@ -100,6 +100,9 @@ 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.
|
||||||
|
aiMatrix4x4 mRootTransform;
|
||||||
|
|
||||||
aiMatrix4x4 GetNodeTransform(const aiString& name) const;
|
aiMatrix4x4 GetNodeTransform(const aiString& name) const;
|
||||||
static std::string TransformAsString(const aiMatrix4x4& m);
|
static std::string TransformAsString(const aiMatrix4x4& m);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue