Merge branch 'master' of https://github.com/assimp/assimp into irrfix

pull/5192/head
PencilAmazing 2023-08-01 21:36:40 -04:00
commit cf5ffdc366
45 changed files with 701 additions and 455 deletions

View File

@ -46,7 +46,7 @@ jobs:
CC: clang
- name: configure and build
uses: lukka/run-cmake@v2
uses: lukka/run-cmake@v3
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'

View File

@ -286,9 +286,9 @@ IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT MINGW)
ELSEIF(MSVC)
# enable multi-core compilation with MSVC
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) # clang-cl
ADD_COMPILE_OPTIONS(/bigobj /W4 /WX )
ADD_COMPILE_OPTIONS(/bigobj)
ELSE() # msvc
ADD_COMPILE_OPTIONS(/MP /bigobj /W4 /WX)
ADD_COMPILE_OPTIONS(/MP /bigobj)
ENDIF()
# disable "elements of array '' will be default initialized" warning on MSVC2013

View File

@ -93,6 +93,8 @@ FBXConverter::FBXConverter(aiScene *out, const Document &doc, bool removeEmptyBo
mSceneOut(out),
doc(doc),
mRemoveEmptyBones(removeEmptyBones) {
// animations need to be converted first since this will
// populate the node_anim_chain_bits map, which is needed
// to determine which nodes need to be generated.
@ -427,12 +429,26 @@ void FBXConverter::ConvertCamera(const Camera &cam, const std::string &orig_name
out_camera->mLookAt = aiVector3D(1.0f, 0.0f, 0.0f);
out_camera->mUp = aiVector3D(0.0f, 1.0f, 0.0f);
out_camera->mHorizontalFOV = AI_DEG_TO_RAD(cam.FieldOfView());
// NOTE: Some software (maya) does not put FieldOfView in FBX, so we compute
// mHorizontalFOV from FocalLength and FilmWidth with unit conversion.
out_camera->mClipPlaneNear = cam.NearPlane();
out_camera->mClipPlaneFar = cam.FarPlane();
// TODO: This is not a complete solution for how FBX cameras can be stored.
// TODO: Incorporate non-square pixel aspect ratio.
// TODO: FBX aperture mode might be storing vertical FOV in need of conversion with aspect ratio.
float fov_deg = cam.FieldOfView();
// If FOV not specified in file, compute using FilmWidth and FocalLength.
if (fov_deg == kFovUnknown) {
float film_width_inches = cam.FilmWidth();
float focal_length_mm = cam.FocalLength();
ASSIMP_LOG_VERBOSE_DEBUG("FBX FOV unspecified. Computing from FilmWidth (", film_width_inches, "inches) and FocalLength (", focal_length_mm, "mm).");
double half_fov_rad = std::atan2(film_width_inches * 25.4 * 0.5, focal_length_mm);
out_camera->mHorizontalFOV = half_fov_rad;
} else {
// FBX fov is full-view degrees. We want half-view radians.
out_camera->mHorizontalFOV = AI_DEG_TO_RAD(fov_deg) * 0.5;
}
out_camera->mHorizontalFOV = AI_DEG_TO_RAD(cam.FieldOfView());
out_camera->mClipPlaneNear = cam.NearPlane();
out_camera->mClipPlaneFar = cam.FarPlane();
}

View File

@ -55,9 +55,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define _AI_CONCAT(a,b) a ## b
#define AI_CONCAT(a,b) _AI_CONCAT(a,b)
namespace Assimp {
namespace FBX {
// Use an 'illegal' default FOV value to detect if the FBX camera has set the FOV.
static const float kFovUnknown = -1.0f;
class Parser;
class Object;
struct ImportSettings;
@ -247,7 +252,7 @@ public:
fbx_simple_property(FilmAspectRatio, float, 1.0f)
fbx_simple_property(ApertureMode, int, 0)
fbx_simple_property(FieldOfView, float, 1.0f)
fbx_simple_property(FieldOfView, float, kFovUnknown)
fbx_simple_property(FocalLength, float, 1.0f)
};

View File

@ -45,6 +45,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/StringUtils.h>
#include <assimp/DefaultLogger.hpp>
#include <assimp/Base64.hpp>
#include <rapidjson/document.h>
#include <rapidjson/schema.h>
#include <rapidjson/stringbuffer.h>
// clang-format off
#ifdef ASSIMP_ENABLE_DRACO

View File

@ -730,7 +730,7 @@ bool glTF2Exporter::GetMatSpecGloss(const aiMaterial &mat, glTF2::PbrSpecularGlo
bool glTF2Exporter::GetMatSpecular(const aiMaterial &mat, glTF2::MaterialSpecular &specular) {
// Specular requires either/or, default factors of zero disables specular, so do not export
if (GetMatColor(mat, specular.specularColorFactor, AI_MATKEY_COLOR_SPECULAR) != AI_SUCCESS || mat.Get(AI_MATKEY_SPECULAR_FACTOR, specular.specularFactor) != AI_SUCCESS) {
if (GetMatColor(mat, specular.specularColorFactor, AI_MATKEY_COLOR_SPECULAR) != AI_SUCCESS && mat.Get(AI_MATKEY_SPECULAR_FACTOR, specular.specularFactor) != AI_SUCCESS) {
return false;
}
// The spec states that the default is 1.0 and [1.0, 1.0, 1.0]. We if both are 0, which should disable specular. Otherwise, if one is 0, set to 1.0

View File

@ -59,6 +59,31 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <memory>
#include <sstream>
namespace {
// Checks whether the passed string is a gcs version.
bool IsGcsVersion(const std::string &s) {
if (s.empty()) return false;
return std::all_of(s.cbegin(), s.cend(), [](const char c) {
// gcs only permits numeric characters.
return std::isdigit(static_cast<int>(c));
});
}
// Removes a possible version hash from a filename, as found for example in
// gcs uris (e.g. `gs://bucket/model.glb#1234`), see also
// https://github.com/GoogleCloudPlatform/gsutil/blob/c80f329bc3c4011236c78ce8910988773b2606cb/gslib/storage_url.py#L39.
std::string StripVersionHash(const std::string &filename) {
const std::string::size_type pos = filename.find_last_of('#');
// Only strip if the hash is behind a possible file extension and the part
// behind the hash is a version string.
if (pos != std::string::npos && pos > filename.find_last_of('.') &&
IsGcsVersion(filename.substr(pos + 1))) {
return filename.substr(0, pos);
}
return filename;
}
} // namespace
using namespace Assimp;
// ------------------------------------------------------------------------------------------------
@ -158,7 +183,7 @@ void BaseImporter::GetExtensionList(std::set<std::string> &extensions) {
std::size_t numTokens,
unsigned int searchBytes /* = 200 */,
bool tokensSol /* false */,
bool noAlphaBeforeTokens /* false */) {
bool noGraphBeforeTokens /* false */) {
ai_assert(nullptr != tokens);
ai_assert(0 != numTokens);
ai_assert(0 != searchBytes);
@ -207,8 +232,9 @@ void BaseImporter::GetExtensionList(std::set<std::string> &extensions) {
continue;
}
// We need to make sure that we didn't accidentally identify the end of another token as our token,
// e.g. in a previous version the "gltf " present in some gltf files was detected as "f "
if (noAlphaBeforeTokens && (r != buffer && isalpha(static_cast<unsigned char>(r[-1])))) {
// e.g. in a previous version the "gltf " present in some gltf files was detected as "f ", or a
// Blender-exported glb file containing "Khronos glTF Blender I/O " was detected as "o "
if (noGraphBeforeTokens && (r != buffer && isgraph(static_cast<unsigned char>(r[-1])))) {
continue;
}
// We got a match, either we don't care where it is, or it happens to
@ -229,33 +255,38 @@ void BaseImporter::GetExtensionList(std::set<std::string> &extensions) {
const char *ext0,
const char *ext1,
const char *ext2) {
std::string::size_type pos = pFile.find_last_of('.');
// no file extension - can't read
if (pos == std::string::npos) {
return false;
std::set<std::string> extensions;
for (const char* ext : {ext0, ext1, ext2}) {
if (ext == nullptr) continue;
extensions.emplace(ext);
}
return HasExtension(pFile, extensions);
}
const char *ext_real = &pFile[pos + 1];
if (!ASSIMP_stricmp(ext_real, ext0)) {
return true;
// ------------------------------------------------------------------------------------------------
// Check for file extension
/*static*/ bool BaseImporter::HasExtension(const std::string &pFile, const std::set<std::string> &extensions) {
const std::string file = StripVersionHash(pFile);
// CAUTION: Do not just search for the extension!
// GetExtension() returns the part after the *last* dot, but some extensions
// have dots inside them, e.g. ogre.mesh.xml. Compare the entire end of the
// string.
for (const std::string& ext : extensions) {
// Yay for C++<20 not having std::string::ends_with()
const std::string dotExt = "." + ext;
if (dotExt.length() > file.length()) continue;
// Possible optimization: Fetch the lowercase filename!
if (0 == ASSIMP_stricmp(file.c_str() + file.length() - dotExt.length(), dotExt.c_str())) {
return true;
}
}
// check for other, optional, file extensions
if (ext1 && !ASSIMP_stricmp(ext_real, ext1)) {
return true;
}
if (ext2 && !ASSIMP_stricmp(ext_real, ext2)) {
return true;
}
return false;
}
// ------------------------------------------------------------------------------------------------
// Get file extension from path
std::string BaseImporter::GetExtension(const std::string &file) {
std::string BaseImporter::GetExtension(const std::string &pFile) {
const std::string file = StripVersionHash(pFile);
std::string::size_type pos = file.find_last_of('.');
// no file extension at all

View File

@ -637,24 +637,10 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags) {
std::set<std::string> extensions;
pimpl->mImporter[a]->GetExtensionList(extensions);
// CAUTION: Do not just search for the extension!
// GetExtension() returns the part after the *last* dot, but some extensions have dots
// inside them, e.g. ogre.mesh.xml. Compare the entire end of the string.
for (std::set<std::string>::const_iterator it = extensions.cbegin(); it != extensions.cend(); ++it) {
// Yay for C++<20 not having std::string::ends_with()
std::string extension = "." + *it;
if (extension.length() <= pFile.length()) {
// Possible optimization: Fetch the lowercase filename!
if (0 == ASSIMP_stricmp(pFile.c_str() + pFile.length() - extension.length(), extension.c_str())) {
ImporterAndIndex candidate = { pimpl->mImporter[a], a };
possibleImporters.push_back(candidate);
break;
}
}
if (BaseImporter::HasExtension(pFile, extensions)) {
ImporterAndIndex candidate = { pimpl->mImporter[a], a };
possibleImporters.push_back(candidate);
}
}
// If just one importer supports this extension, pick it and close the case.

View File

@ -53,6 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/types.h>
#include <assimp/ProgressHandler.hpp>
#include <exception>
#include <set>
#include <vector>
#include <memory>
@ -258,7 +259,7 @@ public: // static utilities
std::size_t numTokens,
unsigned int searchBytes = 200,
bool tokensSol = false,
bool noAlphaBeforeTokens = false);
bool noGraphBeforeTokens = false);
// -------------------------------------------------------------------
/** @brief Check whether a file has a specific file extension
@ -274,6 +275,16 @@ public: // static utilities
const char *ext1 = nullptr,
const char *ext2 = nullptr);
// -------------------------------------------------------------------
/** @brief Check whether a file has one of the passed file extensions
* @param pFile Input file
* @param extensions Extensions to check for. Lowercase characters only, no dot!
* @note Case-insensitive
*/
static bool HasExtension(
const std::string &pFile,
const std::set<std::string> &extensions);
// -------------------------------------------------------------------
/** @brief Extract file extension from a string
* @param pFile Input file

View File

@ -1 +0,0 @@
The interface files are by no means complete yet and only work with the not-yet-released D SWIG backend, although adding support for other languages should not be too much of problem via #ifdefs.

View File

@ -1,140 +0,0 @@
%module assimp
// SWIG helpers for std::string and std::vector wrapping.
%include <std_string.i>
%include <std_vector.i>
// Globally enable enum prefix stripping.
%dstripprefix;
// PACK_STRUCT is a no-op for SWIG – it does not matter for the generated
// bindings how the underlying C++ code manages its memory.
#define PACK_STRUCT
// Helper macros for wrapping the pointer-and-length arrays used in the
// Assimp API.
%define ASSIMP_ARRAY(CLASS, TYPE, NAME, LENGTH)
%newobject CLASS::NAME;
%extend CLASS {
std::vector<TYPE > *NAME() const {
std::vector<TYPE > *result = new std::vector<TYPE >;
result->reserve(LENGTH);
for (unsigned int i = 0; i < LENGTH; ++i) {
result->push_back($self->NAME[i]);
}
return result;
}
}
%ignore CLASS::NAME;
%enddef
%define ASSIMP_POINTER_ARRAY(CLASS, TYPE, NAME, LENGTH)
%newobject CLASS::NAME;
%extend CLASS {
std::vector<TYPE *> *NAME() const {
std::vector<TYPE *> *result = new std::vector<TYPE *>;
result->reserve(LENGTH);
TYPE *currentValue = $self->NAME;
TYPE *valueLimit = $self->NAME + LENGTH;
while (currentValue < valueLimit) {
result->push_back(currentValue);
++currentValue;
}
return result;
}
}
%ignore CLASS::NAME;
%enddef
%define ASSIMP_POINTER_ARRAY_ARRAY(CLASS, TYPE, NAME, OUTER_LENGTH, INNER_LENGTH)
%newobject CLASS::NAME;
%extend CLASS {
std::vector<std::vector<TYPE *> > *NAME() const {
std::vector<std::vector<TYPE *> > *result = new std::vector<std::vector<TYPE *> >;
result->reserve(OUTER_LENGTH);
for (unsigned int i = 0; i < OUTER_LENGTH; ++i) {
std::vector<TYPE *> currentElements;
if ($self->NAME[i] != 0) {
currentElements.reserve(INNER_LENGTH);
TYPE *currentValue = $self->NAME[i];
TYPE *valueLimit = $self->NAME[i] + INNER_LENGTH;
while (currentValue < valueLimit) {
currentElements.push_back(currentValue);
++currentValue;
}
}
result->push_back(currentElements);
}
return result;
}
}
%ignore CLASS::NAME;
%enddef
%include "interface/aiDefines.i"
%include "interface/aiTypes.i"
%include "interface/assimp.i"
%include "interface/aiTexture.i"
%include "interface/aiMatrix4x4.i"
%include "interface/aiMatrix3x3.i"
%include "interface/aiVector3D.i"
%include "interface/aiVector2D.i"
%include "interface/aiColor4D.i"
%include "interface/aiLight.i"
%include "interface/aiCamera.i"
%include "interface/aiFileIO.i"
%include "interface/aiAssert.i"
%include "interface/aiVersion.i"
%include "interface/aiAnim.i"
%include "interface/aiMaterial.i"
%include "interface/aiMesh.i"
%include "interface/aiPostProcess.i"
%include "interface/aiConfig.i"
%include "interface/assimp.i"
%include "interface/aiQuaternion.i"
%include "interface/aiScene.i"
%include "interface/Logger.i"
%include "interface/DefaultLogger.i"
%include "interface/NullLogger.i"
%include "interface/LogStream.i"
%include "interface/IOStream.i"
%include "interface/IOSystem.i"
// We have to "instantiate" the templates used by the ASSSIMP_*_ARRAY macros
// here at the end to avoid running into forward reference issues (SWIG would
// spit out the helper functions before the header includes for the element
// types otherwise).
%template(UintVector) std::vector<unsigned int>;
%template(aiAnimationVector) std::vector<aiAnimation *>;
%template(aiAnimMeshVector) std::vector<aiAnimMesh *>;
%template(aiBonesVector) std::vector<aiBone *>;
%template(aiCameraVector) std::vector<aiCamera *>;
%template(aiColor4DVector) std::vector<aiColor4D *>;
%template(aiColor4DVectorVector) std::vector<std::vector<aiColor4D *> >;
%template(aiFaceVector) std::vector<aiFace *>;
%template(aiLightVector) std::vector<aiLight *>;
%template(aiMaterialVector) std::vector<aiMaterial *>;
%template(aiMaterialPropertyVector) std::vector<aiMaterialProperty *>;
%template(aiMeshAnimVector) std::vector<aiMeshAnim *>;
%template(aiMeshVector) std::vector<aiMesh *>;
%template(aiNodeVector) std::vector<aiNode *>;
%template(aiNodeAnimVector) std::vector<aiNodeAnim *>;
%template(aiTextureVector) std::vector<aiTexture *>;
%template(aiVector3DVector) std::vector<aiVector3D *>;
%template(aiVector3DVectorVector) std::vector<std::vector<aiVector3D *> >;
%template(aiVertexWeightVector) std::vector<aiVertexWeight *>;

View File

@ -1,2 +0,0 @@
#!/bin/sh
gcc -shared -fPIC -g3 -I../../../include/ -lassimp -olibassimp_wrap.so assimp_wrap.cxx

View File

@ -1,4 +0,0 @@
#!/bin/sh
rm -rf assimp/
mkdir assimp
swig -c++ -d -outcurrentdir -I../../../include -splitproxy -package assimp $@ ../assimp.i

View File

@ -1,5 +0,0 @@
%{
#include "DefaultLogger.h"
%}
%include "DefaultLogger.h"

View File

@ -1,5 +0,0 @@
%{
#include "IOStream.h"
%}
%include "IOStream.h"

View File

@ -1,11 +0,0 @@
%{
#include "IOSystem.h"
%}
// The const char* overload is used instead.
%ignore Assimp::IOSystem::Exists(const std::string&) const;
%ignore Assimp::IOSystem::Open(const std::string& pFile);
%ignore Assimp::IOSystem::Open(const std::string& pFile, const std::string& pMode);
%ignore Assimp::IOSystem::ComparePaths(const std::string& one, const std::string& second) const;
%include "IOSystem.h"

View File

@ -1,5 +0,0 @@
%{
#include "LogStream.h"
%}
%include "LogStream.h"

View File

@ -1,5 +0,0 @@
%{
#include "Logger.h"
%}
%include "Logger.h"

View File

@ -1,5 +0,0 @@
%{
#include "NullLogger.h"
%}
%include "NullLogger.h"

View File

@ -1,8 +0,0 @@
%{
#include "aiAnim.h"
%}
ASSIMP_ARRAY(aiAnimation, aiNodeAnim*, mChannels, $self->mNumChannels);
ASSIMP_ARRAY(aiAnimation, aiMeshAnim*, mMeshChannels, $self->mNumMeshChannels);
%include "aiAnim.h"

View File

@ -1,5 +0,0 @@
%{
#include "aiAssert.h"
%}
%include "aiAssert.h"

View File

@ -1,5 +0,0 @@
%{
#include "aiCamera.h"
%}
%include "aiCamera.h"

View File

@ -1,5 +0,0 @@
%{
#include "aiColor4D.h"
%}
%include "aiColor4D.h"

View File

@ -1,5 +0,0 @@
%{
#include "aiConfig.h"
%}
%include "aiConfig.h"

View File

@ -1,5 +0,0 @@
%{
#include "aiDefines.h"
%}
%include "aiDefines.h"

View File

@ -1,5 +0,0 @@
%{
#include "aiFileIO.h"
%}
%include "aiFileIO.h"

View File

@ -1,5 +0,0 @@
%{
#include "aiLight.h"
%}
%include "aiLight.h"

View File

@ -1,33 +0,0 @@
%{
#include "aiMaterial.h"
%}
ASSIMP_ARRAY(aiMaterial, aiMaterialProperty*, mProperties, $self->mNumProperties)
%include <typemaps.i>
%apply enum SWIGTYPE *OUTPUT { aiTextureMapping* mapping };
%apply unsigned int *OUTPUT { unsigned int* uvindex };
%apply float *OUTPUT { float* blend };
%apply enum SWIGTYPE *OUTPUT { aiTextureOp* op };
%apply unsigned int *OUTPUT { unsigned int* flags };
%include "aiMaterial.h"
%clear unsigned int* flags;
%clear aiTextureOp* op;
%clear float *blend;
%clear unsigned int* uvindex;
%clear aiTextureMapping* mapping;
%apply int &OUTPUT { int &pOut };
%apply float &OUTPUT { float &pOut };
%template(GetInteger) aiMaterial::Get<int>;
%template(GetFloat) aiMaterial::Get<float>;
%template(GetColor4D) aiMaterial::Get<aiColor4D>;
%template(GetColor3D) aiMaterial::Get<aiColor3D>;
%template(GetString) aiMaterial::Get<aiString>;
%clear int &pOut;
%clear float &pOut;

View File

@ -1,5 +0,0 @@
%{
#include "aiMatrix3x3.h"
%}
%include "aiMatrix3x3.h"

View File

@ -1,5 +0,0 @@
%{
#include "aiMatrix4x4.h"
%}
%include "aiMatrix4x4.h"

View File

@ -1,29 +0,0 @@
%{
#include "aiMesh.h"
%}
ASSIMP_ARRAY(aiFace, unsigned int, mIndices, $self->mNumIndices);
ASSIMP_POINTER_ARRAY(aiBone, aiVertexWeight, mWeights, $self->mNumWeights);
ASSIMP_POINTER_ARRAY(aiAnimMesh, aiVector3D, mVertices, $self->mNumVertices);
ASSIMP_POINTER_ARRAY(aiAnimMesh, aiVector3D, mNormals, $self->mNumVertices);
ASSIMP_POINTER_ARRAY(aiAnimMesh, aiVector3D, mTangents, $self->mNumVertices);
ASSIMP_POINTER_ARRAY(aiAnimMesh, aiVector3D, mBitangents, $self->mNumVertices);
ASSIMP_POINTER_ARRAY_ARRAY(aiAnimMesh, aiVector3D, mTextureCoords, AI_MAX_NUMBER_OF_TEXTURECOORDS, $self->mNumVertices);
ASSIMP_POINTER_ARRAY_ARRAY(aiAnimMesh, aiColor4D, mColors, AI_MAX_NUMBER_OF_COLOR_SETS, $self->mNumVertices);
ASSIMP_ARRAY(aiMesh, aiAnimMesh*, mAnimMeshes, $self->mNumAnimMeshes);
ASSIMP_ARRAY(aiMesh, aiBone*, mBones, $self->mNumBones);
ASSIMP_ARRAY(aiMesh, unsigned int, mNumUVComponents, AI_MAX_NUMBER_OF_TEXTURECOORDS);
ASSIMP_POINTER_ARRAY(aiMesh, aiVector3D, mVertices, $self->mNumVertices);
ASSIMP_POINTER_ARRAY(aiMesh, aiVector3D, mNormals, $self->mNumVertices);
ASSIMP_POINTER_ARRAY(aiMesh, aiVector3D, mTangents, $self->mNumVertices);
ASSIMP_POINTER_ARRAY(aiMesh, aiVector3D, mBitangents, $self->mNumVertices);
ASSIMP_POINTER_ARRAY(aiMesh, aiFace, mFaces, $self->mNumFaces);
ASSIMP_POINTER_ARRAY_ARRAY(aiMesh, aiVector3D, mTextureCoords, AI_MAX_NUMBER_OF_TEXTURECOORDS, $self->mNumVertices);
ASSIMP_POINTER_ARRAY_ARRAY(aiMesh, aiColor4D, mColors, AI_MAX_NUMBER_OF_COLOR_SETS, $self->mNumVertices);
%include "aiMesh.h"

View File

@ -1,7 +0,0 @@
%{
#include "aiPostProcess.h"
%}
%feature("d:stripprefix", "aiProcess_") aiPostProcessSteps;
%include "aiPostProcess.h"

View File

@ -1,5 +0,0 @@
%{
#include "aiQuaternion.h"
%}
%include "aiQuaternion.h"

View File

@ -1,17 +0,0 @@
%{
#include "aiScene.h"
%}
ASSIMP_ARRAY(aiScene, aiAnimation*, mAnimations, $self->mNumAnimations);
ASSIMP_ARRAY(aiScene, aiCamera*, mCameras, $self->mNumCameras);
ASSIMP_ARRAY(aiScene, aiLight*, mLights, $self->mNumLights);
ASSIMP_ARRAY(aiScene, aiMaterial*, mMaterials, $self->mNumMaterials);
ASSIMP_ARRAY(aiScene, aiMesh*, mMeshes, $self->mNumMeshes);
ASSIMP_ARRAY(aiScene, aiTexture*, mTextures, $self->mNumTextures);
ASSIMP_ARRAY(aiNode, aiNode*, mChildren, $self->mNumChildren);
ASSIMP_ARRAY(aiNode, unsigned int, mMeshes, $self->mNumMeshes);
%include "aiScene.h"

View File

@ -1,5 +0,0 @@
%{
#include "aiTexture.h"
%}
%include "aiTexture.h"

View File

@ -1,8 +0,0 @@
%{
#include "aiTypes.h"
%}
// The const char* overload is used instead.
%ignore aiString::Set(const std::string& pString);
%include "aiTypes.h"

View File

@ -1,5 +0,0 @@
%{
#include "aiVector2D.h"
%}
%include "aiVector2D.h"

View File

@ -1,5 +0,0 @@
%{
#include "aiVector3D.h"
%}
%include "aiVector3D.h"

View File

@ -1,5 +0,0 @@
%{
#include "aiVersion.h"
%}
%include "aiVersion.h"

View File

@ -1,45 +0,0 @@
%{
#include "assimp.hpp"
%}
namespace Assimp {
// See docs in assimp.hpp.
%ignore Importer::ReadFile(const std::string& pFile, unsigned int pFlags);
%ignore Importer::GetExtensionList(std::string& szOut);
%ignore Importer::IsExtensionSupported(const std::string& szExtension);
// These are only necessary for extending Assimp with custom importers or post
// processing steps, which would require wrapping the internal BaseImporter and
// BaseProcess classes.
%ignore Importer::RegisterLoader(BaseImporter* pImp);
%ignore Importer::UnregisterLoader(BaseImporter* pImp);
%ignore Importer::RegisterPPStep(BaseProcess* pImp);
%ignore Importer::UnregisterPPStep(BaseProcess* pImp);
%ignore Importer::FindLoader(const char* szExtension);
}
// Each aiScene has to keep a reference to the Importer to prevent it from
// being garbage collected, whose destructor would release the underlying
// C++ memory the scene is stored in.
%typemap(dcode) aiScene "package Object m_importer;"
%typemap(dout)
aiScene* GetScene,
aiScene* ReadFile,
aiScene* ApplyPostProcessing,
aiScene* ReadFileFromMemory {
void* cPtr = $wcall;
$dclassname ret = (cPtr is null) ? null : new $dclassname(cPtr, $owner);$excode
ret.m_importer = this;
return ret;
}
%include <typemaps.i>
%apply bool *OUTPUT { bool *bWasExisting };
%include "assimp.hpp"
%clear bool *bWasExisting;

View File

@ -0,0 +1,554 @@
<?xml version="1.0"?>
<irr_scene>
<attributes>
<string name="Name" value="root" />
<int name="Id" value="-1" />
<colorf name="AmbientLight" value="0.000000, 0.000000, 0.000000, 0.000000" />
</attributes>
<node type="camera">
<attributes>
<string name="Name" value="" />
<int name="Id" value="-1" />
<vector3d name="Position" value="3.333332, 1.666666, -3.333332" />
<vector3d name="Rotation" value="14426.697266, 0.000000, 0.000000" />
<vector3d name="Scale" value="1.000000, 1.000000, 1.000000" />
<bool name="Visible" value="true" />
<enum name="AutomaticCulling" value="box" />
<int name="DebugDataVisible" value="-1" />
<bool name="IsDebugObject" value="false" />
<vector3d name="Target" value="0.000000, 0.000000, 100.000000" />
<vector3d name="UpVector" value="0.000000, 1.000000, 0.000000" />
<float name="Fovy" value="1.256637" />
<float name="Aspect" value="1.333333" />
<float name="ZNear" value="1.000000" />
<float name="ZFar" value="3000.000000" />
</attributes>
<!-- <animators>-->
<!-- <attributes>-->
<!-- <string name="Type" value="rotation" />-->
<!-- <vector3d name="Rotation" value="0.200000, 0.000000, 0.000000" />-->
<!-- </attributes>-->
<!-- </animators>-->
</node>
<node type="light">
<attributes>
<string name="Name" value="SpotLightAnim" />
<int name="Id" value="-1" />
<vector3d name="Position" value="3.333332, 1.666666, -3.333332" />
<vector3d name="Rotation" value="15721.575195, 37111.304688, 29682.550781" />
<vector3d name="Scale" value="1.000000, 1.000000, 1.000000" />
<bool name="Visible" value="true" />
<enum name="AutomaticCulling" value="box" />
<int name="DebugDataVisible" value="-1" />
<bool name="IsDebugObject" value="false" />
<colorf name="AmbientColor" value="0.000000, 0.000000, 0.000000, 1.000000" />
<colorf name="DiffuseColor" value="1.000000, 1.000000, 1.000000, 1.000000" />
<colorf name="SpecularColor" value="1.000000, 1.000000, 1.000000, 1.000000" />
<float name="Radius" value="100.000000" />
<bool name="CastShadows" value="true" />
<enum name="LightType" value="Spot" />
</attributes>
<!-- <animators>-->
<!-- <attributes>-->
<!-- <string name="Type" value="rotation" />-->
<!-- <vector3d name="Rotation" value="0.200000, 0.500000, 0.400000" />-->
<!-- </attributes>-->
<!-- </animators>-->
</node>
<node type="light">
<attributes>
<string name="Name" value="PointLight" />
<int name="Id" value="-1" />
<vector3d name="Position" value="3.333332, 1.666666, -3.333332" />
<vector3d name="Rotation" value="0.000000, 0.000000, 0.000000" />
<vector3d name="Scale" value="1.000000, 1.000000, 1.000000" />
<bool name="Visible" value="true" />
<enum name="AutomaticCulling" value="box" />
<int name="DebugDataVisible" value="-1" />
<bool name="IsDebugObject" value="false" />
<colorf name="AmbientColor" value="0.000000, 0.000000, 0.000000, 1.000000" />
<colorf name="DiffuseColor" value="1.000000, 1.000000, 1.000000, 1.000000" />
<colorf name="SpecularColor" value="1.000000, 1.000000, 1.000000, 1.000000" />
<float name="Radius" value="100.000000" />
<bool name="CastShadows" value="true" />
<enum name="LightType" value="Point" />
</attributes>
</node>
<node type="empty">
<attributes>
<string name="Name" value="ChildOfRoot" />
<int name="Id" value="-1" />
<vector3d name="Position" value="18.573780, 14.000406, -10.178408" />
<vector3d name="Rotation" value="0.000000, 0.000000, 0.000000" />
<vector3d name="Scale" value="1.000000, 1.000000, 1.000000" />
<bool name="Visible" value="true" />
<enum name="AutomaticCulling" value="false" />
<int name="DebugDataVisible" value="0" />
<bool name="IsDebugObject" value="false" />
</attributes>
<node type="sphere">
<attributes>
<string name="Name" value="Sphere_ChildOfDummy" />
<int name="Id" value="-1" />
<vector3d name="Position" value="22.607138, 0.000000, -19.720987" />
<vector3d name="Rotation" value="0.000000, 0.000000, 0.000000" />
<vector3d name="Scale" value="1.000000, 1.000000, 1.000000" />
<bool name="Visible" value="true" />
<enum name="AutomaticCulling" value="box" />
<int name="DebugDataVisible" value="0" />
<bool name="IsDebugObject" value="false" />
<float name="Radius" value="5.000000" />
<int name="PolyCountX" value="16" />
<int name="PolyCountY" value="16" />
</attributes>
<materials>
<attributes>
<enum name="Type" value="solid" />
<color name="Ambient" value="ffffffff" />
<color name="Diffuse" value="ffffffff" />
<color name="Emissive" value="00000000" />
<color name="Specular" value="ffffffff" />
<float name="Shininess" value="0.000000" />
<float name="Param1" value="0.000000" />
<float name="Param2" value="0.000000" />
<texture name="Texture1" value="UVTransformTestImg.png" />
<texture name="Texture2" value="" />
<texture name="Texture3" value="" />
<texture name="Texture4" value="" />
<bool name="Wireframe" value="false" />
<bool name="GouraudShading" value="true" />
<bool name="Lighting" value="false" />
<bool name="ZWriteEnable" value="true" />
<int name="ZBuffer" value="1" />
<bool name="BackfaceCulling" value="true" />
<bool name="FogEnable" value="false" />
<bool name="NormalizeNormals" value="false" />
<bool name="BilinearFilter1" value="true" />
<bool name="BilinearFilter2" value="true" />
<bool name="BilinearFilter3" value="true" />
<bool name="BilinearFilter4" value="true" />
<bool name="TrilinearFilter1" value="false" />
<bool name="TrilinearFilter2" value="false" />
<bool name="TrilinearFilter3" value="false" />
<bool name="TrilinearFilter4" value="false" />
<bool name="AnisotropicFilter1" value="false" />
<bool name="AnisotropicFilter2" value="false" />
<bool name="AnisotropicFilter3" value="false" />
<bool name="AnisotropicFilter4" value="false" />
<enum name="TextureWrap1" value="texture_clamp_repeat" />
<enum name="TextureWrap2" value="texture_clamp_repeat" />
<enum name="TextureWrap3" value="texture_clamp_repeat" />
<enum name="TextureWrap4" value="texture_clamp_repeat" />
</attributes>
</materials>
<animators>
<attributes>
<string name="Type" value="flyCircle" />
<vector3d name="Center" value="0.000000, 0.000000, 0.000000" />
<float name="Radius" value="30.000000" />
<float name="Speed" value="0.001000" />
<vector3d name="Direction" value="0.000000, 1.000000, 0.000000" />
</attributes>
</animators>
<node type="empty">
<attributes>
<string name="Name" value="ChildOfSphere" />
<int name="Id" value="-1" />
<vector3d name="Position" value="18.573780, 14.000406, -10.178408" />
<vector3d name="Rotation" value="0.000000, 0.000000, 0.000000" />
<vector3d name="Scale" value="1.000000, 1.000000, 1.000000" />
<bool name="Visible" value="true" />
<enum name="AutomaticCulling" value="false" />
<int name="DebugDataVisible" value="0" />
<bool name="IsDebugObject" value="false" />
</attributes>
</node>
</node>
</node>
<node type="animatedMesh">
<attributes>
<string name="Name" value="" />
<int name="Id" value="-1" />
<vector3d name="Position" value="18.573780, 14.000406, -10.178408" />
<vector3d name="Rotation" value="0.000000, 0.000000, 0.000000" />
<vector3d name="Scale" value="1.000000, 1.000000, 1.000000" />
<bool name="Visible" value="true" />
<enum name="AutomaticCulling" value="box" />
<int name="DebugDataVisible" value="0" />
<bool name="IsDebugObject" value="false" />
<string name="Mesh" value="dwarf.x" />
<bool name="Looping" value="true" />
<bool name="ReadOnlyMaterials" value="false" />
<float name="FramesPerSecond" value="0.025000" />
</attributes>
<materials>
<attributes>
<enum name="Type" value="solid" />
<color name="Ambient" value="ffffffff" />
<color name="Diffuse" value="ffcccccc" />
<color name="Emissive" value="ff5d5d5d" />
<color name="Specular" value="ff000000" />
<float name="Shininess" value="0.000000" />
<float name="Param1" value="0.000000" />
<float name="Param2" value="0.000000" />
<texture name="Texture1" value="axe.jpg" />
<texture name="Texture2" value="" />
<texture name="Texture3" value="" />
<texture name="Texture4" value="" />
<bool name="Wireframe" value="false" />
<bool name="GouraudShading" value="true" />
<bool name="Lighting" value="false" />
<bool name="ZWriteEnable" value="true" />
<int name="ZBuffer" value="1" />
<bool name="BackfaceCulling" value="true" />
<bool name="FogEnable" value="false" />
<bool name="NormalizeNormals" value="false" />
<bool name="BilinearFilter1" value="true" />
<bool name="BilinearFilter2" value="true" />
<bool name="BilinearFilter3" value="true" />
<bool name="BilinearFilter4" value="true" />
<bool name="TrilinearFilter1" value="false" />
<bool name="TrilinearFilter2" value="false" />
<bool name="TrilinearFilter3" value="false" />
<bool name="TrilinearFilter4" value="false" />
<bool name="AnisotropicFilter1" value="false" />
<bool name="AnisotropicFilter2" value="false" />
<bool name="AnisotropicFilter3" value="false" />
<bool name="AnisotropicFilter4" value="false" />
<enum name="TextureWrap1" value="texture_clamp_repeat" />
<enum name="TextureWrap2" value="texture_clamp_repeat" />
<enum name="TextureWrap3" value="texture_clamp_repeat" />
<enum name="TextureWrap4" value="texture_clamp_repeat" />
</attributes>
<attributes>
<enum name="Type" value="solid" />
<color name="Ambient" value="ffffffff" />
<color name="Diffuse" value="ffcccccc" />
<color name="Emissive" value="ff4d4d4d" />
<color name="Specular" value="ff000000" />
<float name="Shininess" value="0.000000" />
<float name="Param1" value="0.000000" />
<float name="Param2" value="0.000000" />
<texture name="Texture1" value="dwarf.jpg" />
<texture name="Texture2" value="" />
<texture name="Texture3" value="" />
<texture name="Texture4" value="" />
<bool name="Wireframe" value="false" />
<bool name="GouraudShading" value="true" />
<bool name="Lighting" value="false" />
<bool name="ZWriteEnable" value="true" />
<int name="ZBuffer" value="1" />
<bool name="BackfaceCulling" value="true" />
<bool name="FogEnable" value="false" />
<bool name="NormalizeNormals" value="false" />
<bool name="BilinearFilter1" value="true" />
<bool name="BilinearFilter2" value="true" />
<bool name="BilinearFilter3" value="true" />
<bool name="BilinearFilter4" value="true" />
<bool name="TrilinearFilter1" value="false" />
<bool name="TrilinearFilter2" value="false" />
<bool name="TrilinearFilter3" value="false" />
<bool name="TrilinearFilter4" value="false" />
<bool name="AnisotropicFilter1" value="false" />
<bool name="AnisotropicFilter2" value="false" />
<bool name="AnisotropicFilter3" value="false" />
<bool name="AnisotropicFilter4" value="false" />
<enum name="TextureWrap1" value="texture_clamp_repeat" />
<enum name="TextureWrap2" value="texture_clamp_repeat" />
<enum name="TextureWrap3" value="texture_clamp_repeat" />
<enum name="TextureWrap4" value="texture_clamp_repeat" />
</attributes>
<attributes>
<enum name="Type" value="solid" />
<color name="Ambient" value="ffffffff" />
<color name="Diffuse" value="ffcccccc" />
<color name="Emissive" value="ff505050" />
<color name="Specular" value="ff000000" />
<float name="Shininess" value="0.000000" />
<float name="Param1" value="0.000000" />
<float name="Param2" value="0.000000" />
<texture name="Texture1" value="" />
<texture name="Texture2" value="" />
<texture name="Texture3" value="" />
<texture name="Texture4" value="" />
<bool name="Wireframe" value="false" />
<bool name="GouraudShading" value="true" />
<bool name="Lighting" value="false" />
<bool name="ZWriteEnable" value="true" />
<int name="ZBuffer" value="1" />
<bool name="BackfaceCulling" value="true" />
<bool name="FogEnable" value="false" />
<bool name="NormalizeNormals" value="false" />
<bool name="BilinearFilter1" value="true" />
<bool name="BilinearFilter2" value="true" />
<bool name="BilinearFilter3" value="true" />
<bool name="BilinearFilter4" value="true" />
<bool name="TrilinearFilter1" value="false" />
<bool name="TrilinearFilter2" value="false" />
<bool name="TrilinearFilter3" value="false" />
<bool name="TrilinearFilter4" value="false" />
<bool name="AnisotropicFilter1" value="false" />
<bool name="AnisotropicFilter2" value="false" />
<bool name="AnisotropicFilter3" value="false" />
<bool name="AnisotropicFilter4" value="false" />
<enum name="TextureWrap1" value="texture_clamp_repeat" />
<enum name="TextureWrap2" value="texture_clamp_repeat" />
<enum name="TextureWrap3" value="texture_clamp_repeat" />
<enum name="TextureWrap4" value="texture_clamp_repeat" />
</attributes>
</materials>
</node>
<node type="mesh">
<attributes>
<string name="Name" value="" />
<int name="Id" value="-1" />
<vector3d name="Position" value="42.392685, 54.034889, -80.052681" />
<vector3d name="Rotation" value="0.000000, 0.000000, 0.000000" />
<vector3d name="Scale" value="1.000000, 1.000000, 1.000000" />
<bool name="Visible" value="true" />
<enum name="AutomaticCulling" value="box" />
<int name="DebugDataVisible" value="0" />
<bool name="IsDebugObject" value="false" />
<string name="Mesh" value="cellar.irrmesh" />
<bool name="ReadOnlyMaterials" value="false" />
</attributes>
<materials>
<attributes>
<enum name="Type" value="lightmap_m4" />
<color name="Ambient" value="ffffffff" />
<color name="Diffuse" value="ffffffff" />
<color name="Emissive" value="00000000" />
<color name="Specular" value="ffffffff" />
<float name="Shininess" value="0.750000" />
<float name="Param1" value="0.000000" />
<float name="Param2" value="0.000000" />
<texture name="Texture1" value="brownground_1-1.jpg" />
<texture name="Texture2" value="1.png" />
<texture name="Texture3" value="" />
<texture name="Texture4" value="" />
<bool name="Wireframe" value="false" />
<bool name="GouraudShading" value="true" />
<bool name="Lighting" value="false" />
<bool name="ZWriteEnable" value="true" />
<int name="ZBuffer" value="1" />
<bool name="BackfaceCulling" value="true" />
<bool name="FogEnable" value="false" />
<bool name="NormalizeNormals" value="false" />
<bool name="BilinearFilter1" value="true" />
<bool name="BilinearFilter2" value="true" />
<bool name="BilinearFilter3" value="true" />
<bool name="BilinearFilter4" value="true" />
<bool name="TrilinearFilter1" value="false" />
<bool name="TrilinearFilter2" value="false" />
<bool name="TrilinearFilter3" value="false" />
<bool name="TrilinearFilter4" value="false" />
<bool name="AnisotropicFilter1" value="false" />
<bool name="AnisotropicFilter2" value="false" />
<bool name="AnisotropicFilter3" value="false" />
<bool name="AnisotropicFilter4" value="false" />
<enum name="TextureWrap1" value="texture_clamp_repeat" />
<enum name="TextureWrap2" value="texture_clamp_repeat" />
<enum name="TextureWrap3" value="texture_clamp_repeat" />
<enum name="TextureWrap4" value="texture_clamp_repeat" />
</attributes>
<attributes>
<enum name="Type" value="lightmap_m4" />
<color name="Ambient" value="ffdfdfdf" />
<color name="Diffuse" value="ffdfdfdf" />
<color name="Emissive" value="00000000" />
<color name="Specular" value="ffffffff" />
<float name="Shininess" value="0.750000" />
<float name="Param1" value="0.000000" />
<float name="Param2" value="0.000000" />
<texture name="Texture1" value="crackedground_1-6.jpg" />
<texture name="Texture2" value="1.png" />
<texture name="Texture3" value="" />
<texture name="Texture4" value="" />
<bool name="Wireframe" value="false" />
<bool name="GouraudShading" value="true" />
<bool name="Lighting" value="false" />
<bool name="ZWriteEnable" value="true" />
<int name="ZBuffer" value="1" />
<bool name="BackfaceCulling" value="true" />
<bool name="FogEnable" value="false" />
<bool name="NormalizeNormals" value="false" />
<bool name="BilinearFilter1" value="true" />
<bool name="BilinearFilter2" value="true" />
<bool name="BilinearFilter3" value="true" />
<bool name="BilinearFilter4" value="true" />
<bool name="TrilinearFilter1" value="false" />
<bool name="TrilinearFilter2" value="false" />
<bool name="TrilinearFilter3" value="false" />
<bool name="TrilinearFilter4" value="false" />
<bool name="AnisotropicFilter1" value="false" />
<bool name="AnisotropicFilter2" value="false" />
<bool name="AnisotropicFilter3" value="false" />
<bool name="AnisotropicFilter4" value="false" />
<enum name="TextureWrap1" value="texture_clamp_repeat" />
<enum name="TextureWrap2" value="texture_clamp_repeat" />
<enum name="TextureWrap3" value="texture_clamp_repeat" />
<enum name="TextureWrap4" value="texture_clamp_repeat" />
</attributes>
</materials>
</node>
<node type="cube">
<attributes>
<string name="Name" value="JumpingCube" />
<int name="Id" value="-1" />
<vector3d name="Position" value="16.565477, 21.458202, 15.451395" />
<vector3d name="Rotation" value="0.000000, 0.000000, 0.000000" />
<vector3d name="Scale" value="1.000000, 1.000000, 1.000000" />
<bool name="Visible" value="true" />
<enum name="AutomaticCulling" value="box" />
<int name="DebugDataVisible" value="0" />
<bool name="IsDebugObject" value="false" />
<float name="Size" value="10.000000" />
</attributes>
<materials>
<attributes>
<enum name="Type" value="solid" />
<color name="Ambient" value="ffffffff" />
<color name="Diffuse" value="ffffffff" />
<color name="Emissive" value="00000000" />
<color name="Specular" value="ffffffff" />
<float name="Shininess" value="0.000000" />
<float name="Param1" value="0.000000" />
<float name="Param2" value="0.000000" />
<texture name="Texture1" value="UVTransformTestImg.png" />
<texture name="Texture2" value="" />
<texture name="Texture3" value="" />
<texture name="Texture4" value="" />
<bool name="Wireframe" value="false" />
<bool name="GouraudShading" value="true" />
<bool name="Lighting" value="false" />
<bool name="ZWriteEnable" value="true" />
<int name="ZBuffer" value="1" />
<bool name="BackfaceCulling" value="true" />
<bool name="FogEnable" value="false" />
<bool name="NormalizeNormals" value="false" />
<bool name="BilinearFilter1" value="true" />
<bool name="BilinearFilter2" value="true" />
<bool name="BilinearFilter3" value="true" />
<bool name="BilinearFilter4" value="true" />
<bool name="TrilinearFilter1" value="false" />
<bool name="TrilinearFilter2" value="false" />
<bool name="TrilinearFilter3" value="false" />
<bool name="TrilinearFilter4" value="false" />
<bool name="AnisotropicFilter1" value="false" />
<bool name="AnisotropicFilter2" value="false" />
<bool name="AnisotropicFilter3" value="false" />
<bool name="AnisotropicFilter4" value="false" />
<enum name="TextureWrap1" value="texture_clamp_repeat" />
<enum name="TextureWrap2" value="texture_clamp_repeat" />
<enum name="TextureWrap3" value="texture_clamp_repeat" />
<enum name="TextureWrap4" value="texture_clamp_repeat" />
</attributes>
</materials>
<animators>
<attributes>
<string name="Type" value="followSpline" />
<float name="Speed" value="1.000000" />
<float name="Tightness" value="0.500000" />
<vector3d name="Point1" value="0.000000, 0.000000, 0.000000" />
<vector3d name="Point2" value="20.000000, 20.000000, 20.000000" />
<vector3d name="Point3" value="0.000000, 40.000000, 0.000000" />
<vector3d name="Point4" value="32.000000, 0.000000, 30.000000" />
</attributes>
</animators>
</node>
<node type="sphere">
<attributes>
<string name="Name" value="SillySphere" />
<int name="Id" value="-1" />
<vector3d name="Position" value="-52.105640, 35.426533, -57.016262" />
<vector3d name="Rotation" value="994.501831, 732.416443, 732.416443" />
<vector3d name="Scale" value="3.048931, 7.026268, 6.031934" />
<bool name="Visible" value="true" />
<enum name="AutomaticCulling" value="box" />
<int name="DebugDataVisible" value="0" />
<bool name="IsDebugObject" value="false" />
<float name="Radius" value="5.000000" />
<int name="PolyCountX" value="16" />
<int name="PolyCountY" value="16" />
</attributes>
<materials>
<attributes>
<enum name="Type" value="solid" />
<color name="Ambient" value="ffffffff" />
<color name="Diffuse" value="ffffffff" />
<color name="Emissive" value="00000000" />
<color name="Specular" value="ffffffff" />
<float name="Shininess" value="0.000000" />
<float name="Param1" value="0.000000" />
<float name="Param2" value="0.000000" />
<texture name="Texture1" value="UVTransformTestImg.png" />
<texture name="Texture2" value="" />
<texture name="Texture3" value="" />
<texture name="Texture4" value="" />
<bool name="Wireframe" value="false" />
<bool name="GouraudShading" value="true" />
<bool name="Lighting" value="false" />
<bool name="ZWriteEnable" value="true" />
<int name="ZBuffer" value="1" />
<bool name="BackfaceCulling" value="true" />
<bool name="FogEnable" value="false" />
<bool name="NormalizeNormals" value="false" />
<bool name="BilinearFilter1" value="true" />
<bool name="BilinearFilter2" value="true" />
<bool name="BilinearFilter3" value="true" />
<bool name="BilinearFilter4" value="true" />
<bool name="TrilinearFilter1" value="false" />
<bool name="TrilinearFilter2" value="false" />
<bool name="TrilinearFilter3" value="false" />
<bool name="TrilinearFilter4" value="false" />
<bool name="AnisotropicFilter1" value="false" />
<bool name="AnisotropicFilter2" value="false" />
<bool name="AnisotropicFilter3" value="false" />
<bool name="AnisotropicFilter4" value="false" />
<enum name="TextureWrap1" value="texture_clamp_repeat" />
<enum name="TextureWrap2" value="texture_clamp_repeat" />
<enum name="TextureWrap3" value="texture_clamp_repeat" />
<enum name="TextureWrap4" value="texture_clamp_repeat" />
</attributes>
</materials>
<!-- <animators>-->
<!-- <attributes>-->
<!-- <string name="Type" value="rotation" />-->
<!-- <vector3d name="Rotation" value="0.300000, 0.300000, 0.300000" />-->
<!-- </attributes>-->
<!-- </animators>-->
</node>
</irr_scene>

Binary file not shown.

View File

@ -361,3 +361,37 @@ TEST_F(ImporterTest, unexpectedException) {
EXPECT_TRUE(false);
}
}
// ------------------------------------------------------------------------------------------------
struct ExtensionTestCase {
std::string testName;
std::string filename;
std::string getExtensionResult;
std::string hasExtension;
bool hasExtensionResult;
};
using ExtensionTest = ::testing::TestWithParam<ExtensionTestCase>;
TEST_P(ExtensionTest, testGetAndHasExtension) {
const ExtensionTestCase& testCase = GetParam();
EXPECT_EQ(testCase.getExtensionResult, BaseImporter::GetExtension(testCase.filename));
EXPECT_EQ(testCase.hasExtensionResult, BaseImporter::HasExtension(testCase.filename, {testCase.hasExtension}));
}
INSTANTIATE_TEST_SUITE_P(
ExtensionTests, ExtensionTest,
::testing::ValuesIn<ExtensionTestCase>({
{"NoExtension", "name", "", "glb", false},
{"NoExtensionAndEmptyVersion", "name#", "", "glb", false},
{"WithExtensionAndEmptyVersion", "name.glb#", "glb#", "glb", false},
{"WithExtensionAndVersion", "name.glb#1234", "glb", "glb", true},
{"WithExtensionAndHashInStem", "name#1234.glb", "glb", "glb", true},
{"WithExtensionAndInvalidVersion", "name.glb#_", "glb#_", "glb", false},
{"WithExtensionAndDotAndHashInStem", "name.glb#.abc", "abc", "glb", false},
{"WithTwoExtensions", "name.abc.def", "def", "abc.def", true},
}),
[](const ::testing::TestParamInfo<ExtensionTest::ParamType>& info) {
return info.param.testName;
});

View File

@ -60,7 +60,7 @@ using namespace Assimp;
class utglTF2ImportExport : public AbstractImportExportBase {
public:
virtual bool importerMatTest(const char *file, bool spec_gloss, std::array<aiTextureMapMode, 2> exp_modes = { aiTextureMapMode_Wrap, aiTextureMapMode_Wrap }) {
virtual bool importerMatTest(const char *file, bool spec, bool gloss, std::array<aiTextureMapMode, 2> exp_modes = { aiTextureMapMode_Wrap, aiTextureMapMode_Wrap }) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(file, aiProcess_ValidateDataStructure);
EXPECT_NE(scene, nullptr);
@ -105,16 +105,19 @@ public:
aiColor3D spec_color = { 0, 0, 0 };
ai_real glossiness = ai_real(0.5);
if (spec_gloss) {
if (spec) {
EXPECT_EQ(aiReturn_SUCCESS, material->Get(AI_MATKEY_COLOR_SPECULAR, spec_color));
constexpr ai_real spec_val(0.20000000298023225); // From the file
EXPECT_EQ(spec_val, spec_color.r);
EXPECT_EQ(spec_val, spec_color.g);
EXPECT_EQ(spec_val, spec_color.b);
} else {
EXPECT_EQ(aiReturn_FAILURE, material->Get(AI_MATKEY_COLOR_SPECULAR, spec_color));
}
if (gloss) {
EXPECT_EQ(aiReturn_SUCCESS, material->Get(AI_MATKEY_GLOSSINESS_FACTOR, glossiness));
EXPECT_EQ(ai_real(1.0), glossiness);
} else {
EXPECT_EQ(aiReturn_FAILURE, material->Get(AI_MATKEY_COLOR_SPECULAR, spec_color));
EXPECT_EQ(aiReturn_FAILURE, material->Get(AI_MATKEY_GLOSSINESS_FACTOR, glossiness));
}
@ -143,7 +146,7 @@ public:
};
TEST_F(utglTF2ImportExport, importglTF2FromFileTest) {
EXPECT_TRUE(importerMatTest(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf", false, {aiTextureMapMode_Mirror, aiTextureMapMode_Clamp}));
EXPECT_TRUE(importerMatTest(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf", false, false, {aiTextureMapMode_Mirror, aiTextureMapMode_Clamp}));
}
TEST_F(utglTF2ImportExport, importBinaryglTF2FromFileTest) {
@ -151,7 +154,7 @@ TEST_F(utglTF2ImportExport, importBinaryglTF2FromFileTest) {
}
TEST_F(utglTF2ImportExport, importglTF2_KHR_materials_pbrSpecularGlossiness) {
EXPECT_TRUE(importerMatTest(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF-pbrSpecularGlossiness/BoxTextured.gltf", true));
EXPECT_TRUE(importerMatTest(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF-pbrSpecularGlossiness/BoxTextured.gltf", true, true));
}
void VerifyClearCoatScene(const aiScene *scene) {
@ -223,13 +226,16 @@ TEST_F(utglTF2ImportExport, importglTF2AndExport_KHR_materials_pbrSpecularGlossi
// Export with specular glossiness disabled
EXPECT_EQ(aiReturn_SUCCESS, exporter.Export(scene, "glb2", ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF-pbrSpecularGlossiness/BoxTextured_out.glb"));
// And re-import
EXPECT_TRUE(importerMatTest(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF-pbrSpecularGlossiness/BoxTextured_out.glb", true, false));
// Export with specular glossiness enabled
ExportProperties props;
props.SetPropertyBool(AI_CONFIG_USE_GLTF_PBR_SPECULAR_GLOSSINESS, true);
EXPECT_EQ(aiReturn_SUCCESS, exporter.Export(scene, "glb2", ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF-pbrSpecularGlossiness/BoxTextured_out.glb", 0, &props));
// And re-import
EXPECT_TRUE(importerMatTest(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF-pbrSpecularGlossiness/BoxTextured_out.glb", true));
EXPECT_TRUE(importerMatTest(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF-pbrSpecularGlossiness/BoxTextured_out.glb", true, true));
}
TEST_F(utglTF2ImportExport, importglTF2AndExportToOBJ) {