Merge branch 'master' of https://github.com/assimp/assimp
commit
b5f770e456
|
@ -13,3 +13,10 @@ CHANGES text eol=lf
|
||||||
CREDITS text eol=lf
|
CREDITS text eol=lf
|
||||||
LICENSE text eol=lf
|
LICENSE text eol=lf
|
||||||
Readme.md text eol=lf
|
Readme.md text eol=lf
|
||||||
|
# make sure that repo-specific settings (.gitignore, CI-setup,...)
|
||||||
|
# are excluded from the source-package generated via 'git archive'
|
||||||
|
.git* export-ignore
|
||||||
|
/.travis* export-ignore
|
||||||
|
/.coveralls* export-ignore
|
||||||
|
appveyor.yml export-ignore
|
||||||
|
|
||||||
|
|
18
.travis.yml
18
.travis.yml
|
@ -28,14 +28,16 @@ env:
|
||||||
- secure: "lZ7pHQvl5dpZWzBQAaIMf0wqrvtcZ4wiZKeIZjf83TEsflW8+z0uTpIuN30ZV6Glth/Sq1OhLnTP5+N57fZU/1ebA5twHdvP4bS5CIUUg71/CXQZNl36xeaqvxsG/xRrdpKOsPdjAOsQ9KPTQulsX43XDLS7CasMiLvYOpqKcPc="
|
- secure: "lZ7pHQvl5dpZWzBQAaIMf0wqrvtcZ4wiZKeIZjf83TEsflW8+z0uTpIuN30ZV6Glth/Sq1OhLnTP5+N57fZU/1ebA5twHdvP4bS5CIUUg71/CXQZNl36xeaqvxsG/xRrdpKOsPdjAOsQ9KPTQulsX43XDLS7CasMiLvYOpqKcPc="
|
||||||
- PV=r8e PLATF=linux-x86_64 NDK_HOME=${TRAVIS_BUILD_DIR}/android-ndk-${PV} PATH=${PATH}:${NDK_HOME}
|
- PV=r8e PLATF=linux-x86_64 NDK_HOME=${TRAVIS_BUILD_DIR}/android-ndk-${PV} PATH=${PATH}:${NDK_HOME}
|
||||||
matrix:
|
matrix:
|
||||||
- LINUX=1 TRAVIS_NO_EXPORT=YES ENABLE_COVERALLS=ON
|
- os: linux LINUX=1 TRAVIS_NO_EXPORT=YES ENABLE_COVERALLS=ON
|
||||||
- LINUX=1 TRAVIS_NO_EXPORT=NO ENABLE_COVERALLS=OFF
|
compiler: gcc
|
||||||
- LINUX=1 SHARED_BUILD=ON ENABLE_COVERALLS=OFF
|
- os: linux LINUX=1 TRAVIS_NO_EXPORT=NO ENABLE_COVERALLS=OFF
|
||||||
- LINUX=1 SHARED_BUILD=OFF ENABLE_COVERALLS=OFF
|
compiler: clang
|
||||||
|
- os: linux LINUX=1 SHARED_BUILD=ON TRAVIS_NO_EXPORT=NO ENABLE_COVERALLS=OFF
|
||||||
compiler:
|
compiler: gcc
|
||||||
- gcc
|
- os: linux LINUX=1 SHARED_BUILD=ON TRAVIS_NO_EXPORT=NO ENABLE_COVERALLS=OFF
|
||||||
- clang
|
compiler: clang
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode8.2
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- if [ $ANDROID ]; then wget -c http://dl.google.com/android/ndk/android-ndk-${PV}-${PLATF}.tar.bz2 && tar xf android-ndk-${PV}-${PLATF}.tar.bz2 ; fi
|
- if [ $ANDROID ]; then wget -c http://dl.google.com/android/ndk/android-ndk-${PV}-${PLATF}.tar.bz2 && tar xf android-ndk-${PV}-${PLATF}.tar.bz2 ; fi
|
||||||
|
|
|
@ -148,6 +148,12 @@ find_package(OpenMP)
|
||||||
if (OPENMP_FOUND)
|
if (OPENMP_FOUND)
|
||||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
|
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
|
||||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||||
|
|
||||||
|
IF(MSVC)
|
||||||
|
IF(MSVC_VERSION GREATER 1910)
|
||||||
|
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:twoPhase-")
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
CONFIGURE_FILE(
|
CONFIGURE_FILE(
|
||||||
|
|
|
@ -8,7 +8,6 @@ A library to import and export various 3d-model-formats including scene-post-pro
|
||||||
<img alt="Coverity Scan Build Status"
|
<img alt="Coverity Scan Build Status"
|
||||||
src="https://scan.coverity.com/projects/5607/badge.svg"/>
|
src="https://scan.coverity.com/projects/5607/badge.svg"/>
|
||||||
</a>
|
</a>
|
||||||
<span class="badge-patreon"><a href="https://www.patreon.com/assimp" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span>
|
|
||||||
[](https://coveralls.io/github/assimp/assimp?branch=master)
|
[](https://coveralls.io/github/assimp/assimp?branch=master)
|
||||||
[](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
[](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
<br>
|
<br>
|
||||||
|
@ -19,6 +18,11 @@ Additionally, assimp features various __mesh post processing tools__: normals an
|
||||||
|
|
||||||
This is the development repo containing the latest features and bugfixes. For productive use though, we recommend one of the stable releases available from [Github Assimp Releases](https://github.com/assimp/assimp/releases).
|
This is the development repo containing the latest features and bugfixes. For productive use though, we recommend one of the stable releases available from [Github Assimp Releases](https://github.com/assimp/assimp/releases).
|
||||||
|
|
||||||
|
Monthly donations via Patreon:
|
||||||
|
<br>[](http://www.patreon.com/assimp)
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
One-off donations via PayPal:
|
One-off donations via PayPal:
|
||||||
<br>[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4JRJVPXC4QJM4)
|
<br>[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4JRJVPXC4QJM4)
|
||||||
|
|
||||||
|
@ -114,6 +118,8 @@ Take a look into the `INSTALL` file. Our build system is CMake, if you used CMak
|
||||||
* [.NET](port/AssimpNET/Readme.md)
|
* [.NET](port/AssimpNET/Readme.md)
|
||||||
* [Pascal](port/AssimpPascal/Readme.md)
|
* [Pascal](port/AssimpPascal/Readme.md)
|
||||||
* [Javascript (Alpha)](https://github.com/makc/assimp2json)
|
* [Javascript (Alpha)](https://github.com/makc/assimp2json)
|
||||||
|
* [Unity 3d Plugin] (https://www.assetstore.unity3d.com/en/#!/content/91777)
|
||||||
|
* [JVM](https://github.com/kotlin-graphics/assimp) Full jvm port (currently supported obj, ply, stl, ~collada)
|
||||||
|
|
||||||
### Other tools ###
|
### Other tools ###
|
||||||
[open3mod](https://github.com/acgessler/open3mod) is a powerful 3D model viewer based on Assimp's import and export abilities.
|
[open3mod](https://github.com/acgessler/open3mod) is a powerful 3D model viewer based on Assimp's import and export abilities.
|
||||||
|
|
|
@ -56,18 +56,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
static const unsigned int NotSet = 0xcdcdcdcd;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Setup final material indices, generae a default material if necessary
|
// Setup final material indices, generae a default material if necessary
|
||||||
void Discreet3DSImporter::ReplaceDefaultMaterial()
|
void Discreet3DSImporter::ReplaceDefaultMaterial()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Try to find an existing material that matches the
|
// Try to find an existing material that matches the
|
||||||
// typical default material setting:
|
// typical default material setting:
|
||||||
// - no textures
|
// - no textures
|
||||||
// - diffuse color (in grey!)
|
// - diffuse color (in grey!)
|
||||||
// NOTE: This is here to workaround the fact that some
|
// NOTE: This is here to workaround the fact that some
|
||||||
// exporters are writing a default material, too.
|
// exporters are writing a default material, too.
|
||||||
unsigned int idx = 0xcdcdcdcd;
|
unsigned int idx( NotSet );
|
||||||
for (unsigned int i = 0; i < mScene->mMaterials.size();++i)
|
for (unsigned int i = 0; i < mScene->mMaterials.size();++i)
|
||||||
{
|
{
|
||||||
std::string s = mScene->mMaterials[i].mName;
|
std::string s = mScene->mMaterials[i].mName;
|
||||||
|
@ -93,7 +94,9 @@ void Discreet3DSImporter::ReplaceDefaultMaterial()
|
||||||
}
|
}
|
||||||
idx = i;
|
idx = i;
|
||||||
}
|
}
|
||||||
if (0xcdcdcdcd == idx)idx = (unsigned int)mScene->mMaterials.size();
|
if ( NotSet == idx ) {
|
||||||
|
idx = ( unsigned int )mScene->mMaterials.size();
|
||||||
|
}
|
||||||
|
|
||||||
// now iterate through all meshes and through all faces and
|
// now iterate through all meshes and through all faces and
|
||||||
// find all faces that are using the default material
|
// find all faces that are using the default material
|
||||||
|
|
|
@ -325,7 +325,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
|
||||||
{
|
{
|
||||||
AssbinChunkWriter chunk( container, ASSBIN_CHUNK_AINODE );
|
AssbinChunkWriter chunk( container, ASSBIN_CHUNK_AINODE );
|
||||||
|
|
||||||
size_t nb_metadata = (node->mMetaData != NULL ? node->mMetaData->mNumProperties : 0);
|
unsigned int nb_metadata = (node->mMetaData != NULL ? node->mMetaData->mNumProperties : 0);
|
||||||
|
|
||||||
Write<aiString>(&chunk,node->mName);
|
Write<aiString>(&chunk,node->mName);
|
||||||
Write<aiMatrix4x4>(&chunk,node->mTransformation);
|
Write<aiMatrix4x4>(&chunk,node->mTransformation);
|
||||||
|
|
|
@ -866,8 +866,8 @@ void ColladaExporter::WriteController( size_t pIndex)
|
||||||
|
|
||||||
std::vector<ai_real> bind_poses;
|
std::vector<ai_real> bind_poses;
|
||||||
bind_poses.reserve(mesh->mNumBones * 16);
|
bind_poses.reserve(mesh->mNumBones * 16);
|
||||||
for( size_t i = 0; i < mesh->mNumBones; ++i)
|
for(unsigned int i = 0; i < mesh->mNumBones; ++i)
|
||||||
for( size_t j = 0; j < 4; ++j)
|
for( unsigned int j = 0; j < 4; ++j)
|
||||||
bind_poses.insert(bind_poses.end(), mesh->mBones[i]->mOffsetMatrix[j], mesh->mBones[i]->mOffsetMatrix[j] + 4);
|
bind_poses.insert(bind_poses.end(), mesh->mBones[i]->mOffsetMatrix[j], mesh->mBones[i]->mOffsetMatrix[j] + 4);
|
||||||
|
|
||||||
WriteFloatArray( idstr + "-skin-bind_poses", FloatType_Mat4x4, (const ai_real*) bind_poses.data(), bind_poses.size() / 16);
|
WriteFloatArray( idstr + "-skin-bind_poses", FloatType_Mat4x4, (const ai_real*) bind_poses.data(), bind_poses.size() / 16);
|
||||||
|
@ -924,11 +924,11 @@ void ColladaExporter::WriteController( size_t pIndex)
|
||||||
|
|
||||||
ai_uint weight_index = 0;
|
ai_uint weight_index = 0;
|
||||||
std::vector<ai_int> joint_weight_indices(2 * joint_weight_indices_length, (ai_int)-1);
|
std::vector<ai_int> joint_weight_indices(2 * joint_weight_indices_length, (ai_int)-1);
|
||||||
for( size_t i = 0; i < mesh->mNumBones; ++i)
|
for( unsigned int i = 0; i < mesh->mNumBones; ++i)
|
||||||
for( size_t j = 0; j < mesh->mBones[i]->mNumWeights; ++j)
|
for( unsigned j = 0; j < mesh->mBones[i]->mNumWeights; ++j)
|
||||||
{
|
{
|
||||||
unsigned int vId = mesh->mBones[i]->mWeights[j].mVertexId;
|
unsigned int vId = mesh->mBones[i]->mWeights[j].mVertexId;
|
||||||
for( size_t k = 0; k < num_influences[vId]; ++k)
|
for( ai_uint k = 0; k < num_influences[vId]; ++k)
|
||||||
{
|
{
|
||||||
if (joint_weight_indices[2 * (accum_influences[vId] + k)] == -1)
|
if (joint_weight_indices[2 * (accum_influences[vId] + k)] == -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -728,7 +728,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
|
||||||
? aiMorphingMethod_MORPH_RELATIVE
|
? aiMorphingMethod_MORPH_RELATIVE
|
||||||
: aiMorphingMethod_MORPH_NORMALIZED;
|
: aiMorphingMethod_MORPH_NORMALIZED;
|
||||||
dstMesh->mAnimMeshes = new aiAnimMesh*[animMeshes.size()];
|
dstMesh->mAnimMeshes = new aiAnimMesh*[animMeshes.size()];
|
||||||
dstMesh->mNumAnimMeshes = animMeshes.size();
|
dstMesh->mNumAnimMeshes = static_cast<unsigned int>(animMeshes.size());
|
||||||
for (unsigned int i = 0; i < animMeshes.size(); i++)
|
for (unsigned int i = 0; i < animMeshes.size(); i++)
|
||||||
dstMesh->mAnimMeshes[i] = animMeshes.at(i);
|
dstMesh->mAnimMeshes[i] = animMeshes.at(i);
|
||||||
}
|
}
|
||||||
|
@ -1377,9 +1377,9 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
|
||||||
{
|
{
|
||||||
aiNodeAnim* dstAnim = new aiNodeAnim;
|
aiNodeAnim* dstAnim = new aiNodeAnim;
|
||||||
dstAnim->mNodeName = nodeName;
|
dstAnim->mNodeName = nodeName;
|
||||||
dstAnim->mNumPositionKeys = resultTrafos.size();
|
dstAnim->mNumPositionKeys = static_cast<unsigned int>(resultTrafos.size());
|
||||||
dstAnim->mNumRotationKeys= resultTrafos.size();
|
dstAnim->mNumRotationKeys = static_cast<unsigned int>(resultTrafos.size());
|
||||||
dstAnim->mNumScalingKeys = resultTrafos.size();
|
dstAnim->mNumScalingKeys = static_cast<unsigned int>(resultTrafos.size());
|
||||||
dstAnim->mPositionKeys = new aiVectorKey[resultTrafos.size()];
|
dstAnim->mPositionKeys = new aiVectorKey[resultTrafos.size()];
|
||||||
dstAnim->mRotationKeys = new aiQuatKey[resultTrafos.size()];
|
dstAnim->mRotationKeys = new aiQuatKey[resultTrafos.size()];
|
||||||
dstAnim->mScalingKeys = new aiVectorKey[resultTrafos.size()];
|
dstAnim->mScalingKeys = new aiVectorKey[resultTrafos.size()];
|
||||||
|
@ -1445,11 +1445,11 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
|
||||||
++morphAnimChannelIndex;
|
++morphAnimChannelIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
morphAnim->mNumKeys = morphTimeValues.size();
|
morphAnim->mNumKeys = static_cast<unsigned int>(morphTimeValues.size());
|
||||||
morphAnim->mKeys = new aiMeshMorphKey[morphAnim->mNumKeys];
|
morphAnim->mKeys = new aiMeshMorphKey[morphAnim->mNumKeys];
|
||||||
for (unsigned int key = 0; key < morphAnim->mNumKeys; key++)
|
for (unsigned int key = 0; key < morphAnim->mNumKeys; key++)
|
||||||
{
|
{
|
||||||
morphAnim->mKeys[key].mNumValuesAndWeights = morphChannels.size();
|
morphAnim->mKeys[key].mNumValuesAndWeights = static_cast<unsigned int>(morphChannels.size());
|
||||||
morphAnim->mKeys[key].mValues = new unsigned int [morphChannels.size()];
|
morphAnim->mKeys[key].mValues = new unsigned int [morphChannels.size()];
|
||||||
morphAnim->mKeys[key].mWeights = new double [morphChannels.size()];
|
morphAnim->mKeys[key].mWeights = new double [morphChannels.size()];
|
||||||
|
|
||||||
|
@ -1470,13 +1470,13 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
|
||||||
{
|
{
|
||||||
aiAnimation* anim = new aiAnimation;
|
aiAnimation* anim = new aiAnimation;
|
||||||
anim->mName.Set( pName);
|
anim->mName.Set( pName);
|
||||||
anim->mNumChannels = anims.size();
|
anim->mNumChannels = static_cast<unsigned int>(anims.size());
|
||||||
if (anim->mNumChannels > 0)
|
if (anim->mNumChannels > 0)
|
||||||
{
|
{
|
||||||
anim->mChannels = new aiNodeAnim*[anims.size()];
|
anim->mChannels = new aiNodeAnim*[anims.size()];
|
||||||
std::copy( anims.begin(), anims.end(), anim->mChannels);
|
std::copy( anims.begin(), anims.end(), anim->mChannels);
|
||||||
}
|
}
|
||||||
anim->mNumMorphMeshChannels = morphAnims.size();
|
anim->mNumMorphMeshChannels = static_cast<unsigned int>(morphAnims.size());
|
||||||
if (anim->mNumMorphMeshChannels > 0)
|
if (anim->mNumMorphMeshChannels > 0)
|
||||||
{
|
{
|
||||||
anim->mMorphMeshChannels = new aiMeshMorphAnim*[anim->mNumMorphMeshChannels];
|
anim->mMorphMeshChannels = new aiMeshMorphAnim*[anim->mNumMorphMeshChannels];
|
||||||
|
|
|
@ -2231,7 +2231,7 @@ void ColladaParser::ReadIndexData( Mesh* pMesh)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ASSIMP_BUILD_DEBUG
|
#ifdef ASSIMP_BUILD_DEBUG
|
||||||
if (primType != Prim_TriFans && primType != Prim_TriStrips &&
|
if (primType != Prim_TriFans && primType != Prim_TriStrips && primType != Prim_LineStrip &&
|
||||||
primType != Prim_Lines) { // this is ONLY to workaround a bug in SketchUp 15.3.331 where it writes the wrong 'count' when it writes out the 'lines'.
|
primType != Prim_Lines) { // this is ONLY to workaround a bug in SketchUp 15.3.331 where it writes the wrong 'count' when it writes out the 'lines'.
|
||||||
ai_assert(actualPrimitives == numPrimitives);
|
ai_assert(actualPrimitives == numPrimitives);
|
||||||
}
|
}
|
||||||
|
@ -2400,6 +2400,10 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
|
||||||
size_t numberOfVertices = indices.size() / numOffsets;
|
size_t numberOfVertices = indices.size() / numOffsets;
|
||||||
numPrimitives = numberOfVertices - 2;
|
numPrimitives = numberOfVertices - 2;
|
||||||
}
|
}
|
||||||
|
if (pPrimType == Prim_LineStrip) {
|
||||||
|
size_t numberOfVertices = indices.size() / numOffsets;
|
||||||
|
numPrimitives = numberOfVertices - 1;
|
||||||
|
}
|
||||||
|
|
||||||
pMesh->mFaceSize.reserve( numPrimitives);
|
pMesh->mFaceSize.reserve( numPrimitives);
|
||||||
pMesh->mFacePosIndices.reserve( indices.size() / numOffsets);
|
pMesh->mFacePosIndices.reserve( indices.size() / numOffsets);
|
||||||
|
@ -2416,6 +2420,11 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
|
||||||
for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
|
for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
|
||||||
CopyVertex(currentVertex, numOffsets, numPoints, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices);
|
CopyVertex(currentVertex, numOffsets, numPoints, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices);
|
||||||
break;
|
break;
|
||||||
|
case Prim_LineStrip:
|
||||||
|
numPoints = 2;
|
||||||
|
for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
|
||||||
|
CopyVertex(currentVertex, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices);
|
||||||
|
break;
|
||||||
case Prim_Triangles:
|
case Prim_Triangles:
|
||||||
numPoints = 3;
|
numPoints = 3;
|
||||||
for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
|
for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
|
||||||
|
|
|
@ -95,14 +95,10 @@ public:
|
||||||
XmlSerializer(XmlReader* xmlReader)
|
XmlSerializer(XmlReader* xmlReader)
|
||||||
: xmlReader(xmlReader)
|
: xmlReader(xmlReader)
|
||||||
{
|
{
|
||||||
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportXml(aiScene* scene)
|
void ImportXml(aiScene* scene) {
|
||||||
{
|
|
||||||
|
|
||||||
scene->mFlags |= AI_SCENE_FLAGS_NON_VERBOSE_FORMAT;
|
|
||||||
|
|
||||||
scene->mRootNode = new aiNode();
|
scene->mRootNode = new aiNode();
|
||||||
std::vector<aiNode*> children;
|
std::vector<aiNode*> children;
|
||||||
|
|
||||||
|
|
|
@ -56,47 +56,46 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace FBX {
|
namespace FBX {
|
||||||
|
|
||||||
enum Flag
|
//enum Flag
|
||||||
{
|
//{
|
||||||
e_unknown_0 = 1 << 0,
|
// e_unknown_0 = 1 << 0,
|
||||||
e_unknown_1 = 1 << 1,
|
// e_unknown_1 = 1 << 1,
|
||||||
e_unknown_2 = 1 << 2,
|
// e_unknown_2 = 1 << 2,
|
||||||
e_unknown_3 = 1 << 3,
|
// e_unknown_3 = 1 << 3,
|
||||||
e_unknown_4 = 1 << 4,
|
// e_unknown_4 = 1 << 4,
|
||||||
e_unknown_5 = 1 << 5,
|
// e_unknown_5 = 1 << 5,
|
||||||
e_unknown_6 = 1 << 6,
|
// e_unknown_6 = 1 << 6,
|
||||||
e_unknown_7 = 1 << 7,
|
// e_unknown_7 = 1 << 7,
|
||||||
e_unknown_8 = 1 << 8,
|
// e_unknown_8 = 1 << 8,
|
||||||
e_unknown_9 = 1 << 9,
|
// e_unknown_9 = 1 << 9,
|
||||||
e_unknown_10 = 1 << 10,
|
// e_unknown_10 = 1 << 10,
|
||||||
e_unknown_11 = 1 << 11,
|
// e_unknown_11 = 1 << 11,
|
||||||
e_unknown_12 = 1 << 12,
|
// e_unknown_12 = 1 << 12,
|
||||||
e_unknown_13 = 1 << 13,
|
// e_unknown_13 = 1 << 13,
|
||||||
e_unknown_14 = 1 << 14,
|
// e_unknown_14 = 1 << 14,
|
||||||
e_unknown_15 = 1 << 15,
|
// e_unknown_15 = 1 << 15,
|
||||||
e_unknown_16 = 1 << 16,
|
// e_unknown_16 = 1 << 16,
|
||||||
e_unknown_17 = 1 << 17,
|
// e_unknown_17 = 1 << 17,
|
||||||
e_unknown_18 = 1 << 18,
|
// e_unknown_18 = 1 << 18,
|
||||||
e_unknown_19 = 1 << 19,
|
// e_unknown_19 = 1 << 19,
|
||||||
e_unknown_20 = 1 << 20,
|
// e_unknown_20 = 1 << 20,
|
||||||
e_unknown_21 = 1 << 21,
|
// e_unknown_21 = 1 << 21,
|
||||||
e_unknown_22 = 1 << 22,
|
// e_unknown_22 = 1 << 22,
|
||||||
e_unknown_23 = 1 << 23,
|
// e_unknown_23 = 1 << 23,
|
||||||
e_flag_field_size_64_bit = 1 << 24, // Not sure what is
|
// e_flag_field_size_64_bit = 1 << 24, // Not sure what is
|
||||||
e_unknown_25 = 1 << 25,
|
// e_unknown_25 = 1 << 25,
|
||||||
e_unknown_26 = 1 << 26,
|
// e_unknown_26 = 1 << 26,
|
||||||
e_unknown_27 = 1 << 27,
|
// e_unknown_27 = 1 << 27,
|
||||||
e_unknown_28 = 1 << 28,
|
// e_unknown_28 = 1 << 28,
|
||||||
e_unknown_29 = 1 << 29,
|
// e_unknown_29 = 1 << 29,
|
||||||
e_unknown_30 = 1 << 30,
|
// e_unknown_30 = 1 << 30,
|
||||||
e_unknown_31 = 1 << 31
|
// e_unknown_31 = 1 << 31
|
||||||
};
|
//};
|
||||||
|
//
|
||||||
bool check_flag(uint32_t flags, Flag to_check)
|
//bool check_flag(uint32_t flags, Flag to_check)
|
||||||
{
|
//{
|
||||||
return (flags & to_check) != 0;
|
// return (flags & to_check) != 0;
|
||||||
}
|
//}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Token::Token(const char* sbegin, const char* send, TokenType type, unsigned int offset)
|
Token::Token(const char* sbegin, const char* send, TokenType type, unsigned int offset)
|
||||||
:
|
:
|
||||||
|
@ -341,10 +340,10 @@ void ReadData(const char*& sbegin_out, const char*& send_out, const char* input,
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
bool ReadScope(TokenList& output_tokens, const char* input, const char*& cursor, const char* end, uint32_t const flags)
|
bool ReadScope(TokenList& output_tokens, const char* input, const char*& cursor, const char* end, bool const is64bits)
|
||||||
{
|
{
|
||||||
// the first word contains the offset at which this block ends
|
// the first word contains the offset at which this block ends
|
||||||
const uint64_t end_offset = /*check_flag(flags, e_flag_field_size_64_bit) ? ReadDoubleWord(input, cursor, end) : */ReadWord(input, cursor, end);
|
const uint64_t end_offset = is64bits ? ReadDoubleWord(input, cursor, end) : ReadWord(input, cursor, end);
|
||||||
|
|
||||||
// we may get 0 if reading reached the end of the file -
|
// we may get 0 if reading reached the end of the file -
|
||||||
// fbx files have a mysterious extra footer which I don't know
|
// fbx files have a mysterious extra footer which I don't know
|
||||||
|
@ -362,10 +361,10 @@ bool ReadScope(TokenList& output_tokens, const char* input, const char*& cursor,
|
||||||
}
|
}
|
||||||
|
|
||||||
// the second data word contains the number of properties in the scope
|
// the second data word contains the number of properties in the scope
|
||||||
const uint64_t prop_count = /*check_flag(flags, e_flag_field_size_64_bit) ? ReadDoubleWord(input, cursor, end) : */ReadWord(input, cursor, end);
|
const uint64_t prop_count = is64bits ? ReadDoubleWord(input, cursor, end) : ReadWord(input, cursor, end);
|
||||||
|
|
||||||
// the third data word contains the length of the property list
|
// the third data word contains the length of the property list
|
||||||
const uint64_t prop_length = /*check_flag(flags, e_flag_field_size_64_bit) ? ReadDoubleWord(input, cursor, end) :*/ ReadWord(input, cursor, end);
|
const uint64_t prop_length = is64bits ? ReadDoubleWord(input, cursor, end) : ReadWord(input, cursor, end);
|
||||||
|
|
||||||
// now comes the name of the scope/key
|
// now comes the name of the scope/key
|
||||||
const char* sbeg, *send;
|
const char* sbeg, *send;
|
||||||
|
@ -392,7 +391,7 @@ bool ReadScope(TokenList& output_tokens, const char* input, const char*& cursor,
|
||||||
// at the end of each nested block, there is a NUL record to indicate
|
// at the end of each nested block, there is a NUL record to indicate
|
||||||
// that the sub-scope exists (i.e. to distinguish between P: and P : {})
|
// that the sub-scope exists (i.e. to distinguish between P: and P : {})
|
||||||
// this NUL record is 13 bytes long on 32 bit version and 25 bytes long on 64 bit.
|
// this NUL record is 13 bytes long on 32 bit version and 25 bytes long on 64 bit.
|
||||||
const size_t sentinel_block_length = /*check_flag(flags, e_flag_field_size_64_bit) ? (sizeof(uint64_t) * 3 + 1) : */(sizeof(uint32_t) * 3 + 1);
|
const size_t sentinel_block_length = is64bits ? (sizeof(uint64_t)* 3 + 1) : (sizeof(uint32_t)* 3 + 1);
|
||||||
|
|
||||||
if (Offset(input, cursor) < end_offset) {
|
if (Offset(input, cursor) < end_offset) {
|
||||||
if (end_offset - Offset(input, cursor) < sentinel_block_length) {
|
if (end_offset - Offset(input, cursor) < sentinel_block_length) {
|
||||||
|
@ -403,7 +402,7 @@ bool ReadScope(TokenList& output_tokens, const char* input, const char*& cursor,
|
||||||
|
|
||||||
// XXX this is vulnerable to stack overflowing ..
|
// XXX this is vulnerable to stack overflowing ..
|
||||||
while(Offset(input, cursor) < end_offset - sentinel_block_length) {
|
while(Offset(input, cursor) < end_offset - sentinel_block_length) {
|
||||||
ReadScope(output_tokens, input, cursor, input + end_offset - sentinel_block_length, flags);
|
ReadScope(output_tokens, input, cursor, input + end_offset - sentinel_block_length, is64bits);
|
||||||
}
|
}
|
||||||
output_tokens.push_back(new_Token(cursor, cursor + 1, TokenType_CLOSE_BRACKET, Offset(input, cursor) ));
|
output_tokens.push_back(new_Token(cursor, cursor + 1, TokenType_CLOSE_BRACKET, Offset(input, cursor) ));
|
||||||
|
|
||||||
|
@ -426,6 +425,7 @@ bool ReadScope(TokenList& output_tokens, const char* input, const char*& cursor,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// TODO: Test FBX Binary files newer than the 7500 version to check if the 64 bits address behaviour is consistent
|
||||||
void TokenizeBinary(TokenList& output_tokens, const char* input, unsigned int length)
|
void TokenizeBinary(TokenList& output_tokens, const char* input, unsigned int length)
|
||||||
{
|
{
|
||||||
ai_assert(input);
|
ai_assert(input);
|
||||||
|
@ -438,19 +438,17 @@ void TokenizeBinary(TokenList& output_tokens, const char* input, unsigned int le
|
||||||
TokenizeError("magic bytes not found",0);
|
TokenizeError("magic bytes not found",0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* cursor = input + 18;
|
||||||
//uint32_t offset = 0x15;
|
const uint8_t unknown_1 = ReadByte(input, cursor, input + length);
|
||||||
const char* cursor = input + 0x15;
|
const uint8_t unknown_2 = ReadByte(input, cursor, input + length);
|
||||||
|
const uint8_t unknown_3 = ReadByte(input, cursor, input + length);
|
||||||
const uint32_t flags = ReadWord(input, cursor, input + length);
|
const uint8_t unknown_4 = ReadByte(input, cursor, input + length);
|
||||||
|
const uint8_t unknown_5 = ReadByte(input, cursor, input + length);
|
||||||
const uint8_t padding_0 = ReadByte(input, cursor, input + length); // unused
|
const uint32_t version = ReadWord(input, cursor, input + length);
|
||||||
(void) padding_0;
|
const bool is64bits = version >= 7500;
|
||||||
const uint8_t padding_1 = ReadByte(input, cursor, input + length); // unused
|
|
||||||
(void) padding_1;
|
|
||||||
while (cursor < input + length)
|
while (cursor < input + length)
|
||||||
{
|
{
|
||||||
if(!ReadScope(output_tokens, input, cursor, input + length, flags)) {
|
if (!ReadScope(output_tokens, input, cursor, input + length, is64bits)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2367,8 +2367,13 @@ void Converter::ConvertAnimationStack( const AnimationStack& st )
|
||||||
|
|
||||||
int64_t start_time = st.LocalStart();
|
int64_t start_time = st.LocalStart();
|
||||||
int64_t stop_time = st.LocalStop();
|
int64_t stop_time = st.LocalStop();
|
||||||
double start_timeF = CONVERT_FBX_TIME( start_time );
|
bool has_local_startstop = start_time != 0 || stop_time != 0;
|
||||||
double stop_timeF = CONVERT_FBX_TIME( stop_time );
|
if ( !has_local_startstop ) {
|
||||||
|
// no time range given, so accept every keyframe and use the actual min/max time
|
||||||
|
// the numbers are INT64_MIN/MAX, the 20000 is for safety because GenerateNodeAnimations uses an epsilon of 10000
|
||||||
|
start_time = -9223372036854775807ll + 20000;
|
||||||
|
stop_time = 9223372036854775807ll - 20000;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for( const NodeMap::value_type& kv : node_map ) {
|
for( const NodeMap::value_type& kv : node_map ) {
|
||||||
|
@ -2400,27 +2405,23 @@ void Converter::ConvertAnimationStack( const AnimationStack& st )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//adjust relative timing for animation
|
double start_time_fps = has_local_startstop ? (CONVERT_FBX_TIME(start_time) * anim_fps) : min_time;
|
||||||
{
|
double stop_time_fps = has_local_startstop ? (CONVERT_FBX_TIME(stop_time) * anim_fps) : max_time;
|
||||||
double start_fps = start_timeF * anim_fps;
|
|
||||||
|
|
||||||
for ( unsigned int c = 0; c < anim->mNumChannels; c++ )
|
// adjust relative timing for animation
|
||||||
{
|
for ( unsigned int c = 0; c < anim->mNumChannels; c++ ) {
|
||||||
aiNodeAnim* channel = anim->mChannels[ c ];
|
aiNodeAnim* channel = anim->mChannels[ c ];
|
||||||
for ( uint32_t i = 0; i < channel->mNumPositionKeys; i++ )
|
for ( uint32_t i = 0; i < channel->mNumPositionKeys; i++ )
|
||||||
channel->mPositionKeys[ i ].mTime -= start_fps;
|
channel->mPositionKeys[ i ].mTime -= start_time_fps;
|
||||||
for ( uint32_t i = 0; i < channel->mNumRotationKeys; i++ )
|
for ( uint32_t i = 0; i < channel->mNumRotationKeys; i++ )
|
||||||
channel->mRotationKeys[ i ].mTime -= start_fps;
|
channel->mRotationKeys[ i ].mTime -= start_time_fps;
|
||||||
for ( uint32_t i = 0; i < channel->mNumScalingKeys; i++ )
|
for ( uint32_t i = 0; i < channel->mNumScalingKeys; i++ )
|
||||||
channel->mScalingKeys[ i ].mTime -= start_fps;
|
channel->mScalingKeys[ i ].mTime -= start_time_fps;
|
||||||
}
|
|
||||||
|
|
||||||
max_time -= min_time;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// for some mysterious reason, mDuration is simply the maximum key -- the
|
// for some mysterious reason, mDuration is simply the maximum key -- the
|
||||||
// validator always assumes animations to start at zero.
|
// validator always assumes animations to start at zero.
|
||||||
anim->mDuration = ( stop_timeF - start_timeF ) * anim_fps;
|
anim->mDuration = stop_time_fps - start_time_fps;
|
||||||
anim->mTicksPerSecond = anim_fps;
|
anim->mTicksPerSecond = anim_fps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ void ProcessParametrizedProfile(const IfcParameterizedProfileDef& def, TempMesh&
|
||||||
meshout.verts.push_back( IfcVector3( std::cos(angle)*radius, std::sin(angle)*radius, 0.f ));
|
meshout.verts.push_back( IfcVector3( std::cos(angle)*radius, std::sin(angle)*radius, 0.f ));
|
||||||
}
|
}
|
||||||
|
|
||||||
meshout.vertcnt.push_back(segments);
|
meshout.vertcnt.push_back(static_cast<unsigned int>(segments));
|
||||||
}
|
}
|
||||||
else if( const IfcIShapeProfileDef* const ishape = def.ToPtr<IfcIShapeProfileDef>()) {
|
else if( const IfcIShapeProfileDef* const ishape = def.ToPtr<IfcIShapeProfileDef>()) {
|
||||||
// construct simplified IBeam shape
|
// construct simplified IBeam shape
|
||||||
|
|
|
@ -164,7 +164,7 @@ struct Header {
|
||||||
|
|
||||||
//! Could be the total size of the file (and not a float)
|
//! Could be the total size of the file (and not a float)
|
||||||
float size;
|
float size;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
|
@ -223,7 +223,7 @@ struct Header_MDL7 {
|
||||||
|
|
||||||
//! Size of the Frame_MDL7 data structure used in the file
|
//! Size of the Frame_MDL7 data structure used in the file
|
||||||
uint16_t frame_stc_size;
|
uint16_t frame_stc_size;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
|
@ -242,7 +242,7 @@ struct Bone_MDL7 {
|
||||||
|
|
||||||
//! Optional name of the bone
|
//! Optional name of the bone
|
||||||
char name[1 /* DUMMY SIZE */];
|
char name[1 /* DUMMY SIZE */];
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
#if (!defined AI_MDL7_BONE_STRUCT_SIZE__NAME_IS_20_CHARS)
|
#if (!defined AI_MDL7_BONE_STRUCT_SIZE__NAME_IS_20_CHARS)
|
||||||
# define AI_MDL7_BONE_STRUCT_SIZE__NAME_IS_20_CHARS (16 + 20)
|
# define AI_MDL7_BONE_STRUCT_SIZE__NAME_IS_20_CHARS (16 + 20)
|
||||||
|
@ -290,7 +290,7 @@ struct Group_MDL7 {
|
||||||
|
|
||||||
//! Number of frames
|
//! Number of frames
|
||||||
int32_t numframes;
|
int32_t numframes;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
#define AI_MDL7_SKINTYPE_MIPFLAG 0x08
|
#define AI_MDL7_SKINTYPE_MIPFLAG 0x08
|
||||||
#define AI_MDL7_SKINTYPE_MATERIAL 0x10
|
#define AI_MDL7_SKINTYPE_MATERIAL 0x10
|
||||||
|
@ -312,7 +312,7 @@ struct Deformer_MDL7 {
|
||||||
int32_t group_index;
|
int32_t group_index;
|
||||||
int32_t elements;
|
int32_t elements;
|
||||||
int32_t deformerdata_size;
|
int32_t deformerdata_size;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
|
@ -324,7 +324,7 @@ struct DeformerElement_MDL7 {
|
||||||
int32_t element_index;
|
int32_t element_index;
|
||||||
char element_name[AI_MDL7_MAX_BONENAMESIZE];
|
char element_name[AI_MDL7_MAX_BONENAMESIZE];
|
||||||
int32_t weights;
|
int32_t weights;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
/** \struct DeformerWeight_MDL7
|
/** \struct DeformerWeight_MDL7
|
||||||
|
@ -334,7 +334,7 @@ struct DeformerWeight_MDL7 {
|
||||||
//! for deformer_typ==0 (==bones) index == vertex index
|
//! for deformer_typ==0 (==bones) index == vertex index
|
||||||
int32_t index;
|
int32_t index;
|
||||||
float weight;
|
float weight;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
// don't know why this was in the original headers ...
|
// don't know why this was in the original headers ...
|
||||||
typedef int32_t MD7_MATERIAL_ASCDEFSIZE;
|
typedef int32_t MD7_MATERIAL_ASCDEFSIZE;
|
||||||
|
@ -345,7 +345,7 @@ typedef int32_t MD7_MATERIAL_ASCDEFSIZE;
|
||||||
*/
|
*/
|
||||||
struct ColorValue_MDL7 {
|
struct ColorValue_MDL7 {
|
||||||
float r,g,b,a;
|
float r,g,b,a;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
/** \struct Material_MDL7
|
/** \struct Material_MDL7
|
||||||
|
@ -366,7 +366,7 @@ struct Material_MDL7 {
|
||||||
|
|
||||||
//! Phong power
|
//! Phong power
|
||||||
float Power;
|
float Power;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
/** \struct Skin
|
/** \struct Skin
|
||||||
|
@ -388,7 +388,7 @@ struct Skin {
|
||||||
|
|
||||||
//! Texture data
|
//! Texture data
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
|
@ -399,7 +399,7 @@ struct Skin {
|
||||||
struct Skin_MDL5 {
|
struct Skin_MDL5 {
|
||||||
int32_t size, width, height;
|
int32_t size, width, height;
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
// maximum length of texture file name
|
// maximum length of texture file name
|
||||||
#if (!defined AI_MDL7_MAX_TEXNAMESIZE)
|
#if (!defined AI_MDL7_MAX_TEXNAMESIZE)
|
||||||
|
@ -416,7 +416,7 @@ struct Skin_MDL7 {
|
||||||
int32_t width;
|
int32_t width;
|
||||||
int32_t height;
|
int32_t height;
|
||||||
char texture_name[AI_MDL7_MAX_TEXNAMESIZE];
|
char texture_name[AI_MDL7_MAX_TEXNAMESIZE];
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
/** \struct RGB565
|
/** \struct RGB565
|
||||||
|
@ -426,7 +426,7 @@ struct RGB565 {
|
||||||
uint16_t r : 5;
|
uint16_t r : 5;
|
||||||
uint16_t g : 6;
|
uint16_t g : 6;
|
||||||
uint16_t b : 5;
|
uint16_t b : 5;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
/** \struct ARGB4
|
/** \struct ARGB4
|
||||||
|
@ -455,7 +455,7 @@ struct GroupSkin {
|
||||||
|
|
||||||
//! Data of each image
|
//! Data of each image
|
||||||
uint8_t **data;
|
uint8_t **data;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
/** \struct TexCoord
|
/** \struct TexCoord
|
||||||
|
@ -470,7 +470,7 @@ struct TexCoord {
|
||||||
|
|
||||||
//! Texture coordinate in the ty direction
|
//! Texture coordinate in the ty direction
|
||||||
int32_t t;
|
int32_t t;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
/** \struct TexCoord_MDL3
|
/** \struct TexCoord_MDL3
|
||||||
|
@ -482,7 +482,7 @@ struct TexCoord_MDL3 {
|
||||||
|
|
||||||
//! position, vertically in range 0..skinheight-1
|
//! position, vertically in range 0..skinheight-1
|
||||||
int16_t v;
|
int16_t v;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
/** \struct TexCoord_MDL7
|
/** \struct TexCoord_MDL7
|
||||||
|
@ -494,7 +494,7 @@ struct TexCoord_MDL7 {
|
||||||
|
|
||||||
//! position, vertically in range 0..1
|
//! position, vertically in range 0..1
|
||||||
float v;
|
float v;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
/** \struct SkinSet_MDL7
|
/** \struct SkinSet_MDL7
|
||||||
|
@ -510,7 +510,7 @@ struct SkinSet_MDL7
|
||||||
|
|
||||||
//! Material index
|
//! Material index
|
||||||
int32_t material; // size 4
|
int32_t material; // size 4
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
/** \struct Triangle
|
/** \struct Triangle
|
||||||
|
@ -523,7 +523,7 @@ struct Triangle
|
||||||
|
|
||||||
//! Vertex indices
|
//! Vertex indices
|
||||||
int32_t vertex[3];
|
int32_t vertex[3];
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
/** \struct Triangle_MDL3
|
/** \struct Triangle_MDL3
|
||||||
|
@ -536,7 +536,7 @@ struct Triangle_MDL3
|
||||||
|
|
||||||
//! Index of 3 skin vertices in range 0..numskinverts
|
//! Index of 3 skin vertices in range 0..numskinverts
|
||||||
uint16_t index_uv[3];
|
uint16_t index_uv[3];
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
/** \struct Triangle_MDL7
|
/** \struct Triangle_MDL7
|
||||||
|
@ -549,7 +549,7 @@ struct Triangle_MDL7
|
||||||
|
|
||||||
//! Two skinsets. The second will be used for multi-texturing
|
//! Two skinsets. The second will be used for multi-texturing
|
||||||
SkinSet_MDL7 skinsets[2];
|
SkinSet_MDL7 skinsets[2];
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
#if (!defined AI_MDL7_TRIANGLE_STD_SIZE_ONE_UV)
|
#if (!defined AI_MDL7_TRIANGLE_STD_SIZE_ONE_UV)
|
||||||
# define AI_MDL7_TRIANGLE_STD_SIZE_ONE_UV (6+sizeof(SkinSet_MDL7)-sizeof(uint32_t))
|
# define AI_MDL7_TRIANGLE_STD_SIZE_ONE_UV (6+sizeof(SkinSet_MDL7)-sizeof(uint32_t))
|
||||||
|
@ -577,7 +577,7 @@ struct Vertex
|
||||||
{
|
{
|
||||||
uint8_t v[3];
|
uint8_t v[3];
|
||||||
uint8_t normalIndex;
|
uint8_t normalIndex;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
|
@ -603,7 +603,7 @@ struct Vertex_MDL7
|
||||||
uint8_t norm162index;
|
uint8_t norm162index;
|
||||||
float norm[3];
|
float norm[3];
|
||||||
};
|
};
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
/** \struct BoneTransform_MDL7
|
/** \struct BoneTransform_MDL7
|
||||||
|
@ -620,7 +620,7 @@ struct BoneTransform_MDL7
|
||||||
//! I HATE 3DGS AND THE SILLY DEVELOPER WHO DESIGNED
|
//! I HATE 3DGS AND THE SILLY DEVELOPER WHO DESIGNED
|
||||||
//! THIS STUPID FILE FORMAT!
|
//! THIS STUPID FILE FORMAT!
|
||||||
int8_t _unused_[2];
|
int8_t _unused_[2];
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
|
|
||||||
#define AI_MDL7_MAX_FRAMENAMESIZE 16
|
#define AI_MDL7_MAX_FRAMENAMESIZE 16
|
||||||
|
@ -654,7 +654,7 @@ struct SimpleFrame
|
||||||
|
|
||||||
//! Vertex list of the frame
|
//! Vertex list of the frame
|
||||||
Vertex *verts;
|
Vertex *verts;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
/** \struct Frame
|
/** \struct Frame
|
||||||
|
@ -667,7 +667,7 @@ struct Frame
|
||||||
|
|
||||||
//! Frame data
|
//! Frame data
|
||||||
SimpleFrame frame;
|
SimpleFrame frame;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
|
@ -684,7 +684,7 @@ struct SimpleFrame_MDLn_SP
|
||||||
|
|
||||||
//! Vertex list of the frame
|
//! Vertex list of the frame
|
||||||
Vertex_MDL4 *verts;
|
Vertex_MDL4 *verts;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
/** \struct GroupFrame
|
/** \struct GroupFrame
|
||||||
|
@ -706,7 +706,7 @@ struct GroupFrame
|
||||||
|
|
||||||
//! List of single frames
|
//! List of single frames
|
||||||
SimpleFrame *frames;
|
SimpleFrame *frames;
|
||||||
} /* PACK_STRUCT */;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
#include "./../include/assimp/Compiler/poppack1.h"
|
#include "./../include/assimp/Compiler/poppack1.h"
|
||||||
|
|
||||||
|
|
|
@ -278,7 +278,7 @@ aiMesh *MMDImporter::CreateMesh(const pmx::PmxModel *pModel,
|
||||||
bone_vertex_map[vsBDEF2_ptr->bone_index1].push_back(
|
bone_vertex_map[vsBDEF2_ptr->bone_index1].push_back(
|
||||||
aiVertexWeight(index, vsBDEF2_ptr->bone_weight));
|
aiVertexWeight(index, vsBDEF2_ptr->bone_weight));
|
||||||
bone_vertex_map[vsBDEF2_ptr->bone_index2].push_back(
|
bone_vertex_map[vsBDEF2_ptr->bone_index2].push_back(
|
||||||
aiVertexWeight(index, 1.0 - vsBDEF2_ptr->bone_weight));
|
aiVertexWeight(index, 1.0f - vsBDEF2_ptr->bone_weight));
|
||||||
break;
|
break;
|
||||||
case pmx::PmxVertexSkinningType::BDEF4:
|
case pmx::PmxVertexSkinningType::BDEF4:
|
||||||
bone_vertex_map[vsBDEF4_ptr->bone_index1].push_back(
|
bone_vertex_map[vsBDEF4_ptr->bone_index1].push_back(
|
||||||
|
@ -295,7 +295,7 @@ aiMesh *MMDImporter::CreateMesh(const pmx::PmxModel *pModel,
|
||||||
bone_vertex_map[vsSDEF_ptr->bone_index1].push_back(
|
bone_vertex_map[vsSDEF_ptr->bone_index1].push_back(
|
||||||
aiVertexWeight(index, vsSDEF_ptr->bone_weight));
|
aiVertexWeight(index, vsSDEF_ptr->bone_weight));
|
||||||
bone_vertex_map[vsSDEF_ptr->bone_index2].push_back(
|
bone_vertex_map[vsSDEF_ptr->bone_index2].push_back(
|
||||||
aiVertexWeight(index, 1.0 - vsSDEF_ptr->bone_weight));
|
aiVertexWeight(index, 1.0f - vsSDEF_ptr->bone_weight));
|
||||||
break;
|
break;
|
||||||
case pmx::PmxVertexSkinningType::QDEF:
|
case pmx::PmxVertexSkinningType::QDEF:
|
||||||
const auto vsQDEF_ptr =
|
const auto vsQDEF_ptr =
|
||||||
|
@ -325,7 +325,7 @@ aiMesh *MMDImporter::CreateMesh(const pmx::PmxModel *pModel,
|
||||||
aiMatrix4x4::Translation(-pos, pBone->mOffsetMatrix);
|
aiMatrix4x4::Translation(-pos, pBone->mOffsetMatrix);
|
||||||
auto it = bone_vertex_map.find(ii);
|
auto it = bone_vertex_map.find(ii);
|
||||||
if (it != bone_vertex_map.end()) {
|
if (it != bone_vertex_map.end()) {
|
||||||
pBone->mNumWeights = it->second.size();
|
pBone->mNumWeights = static_cast<unsigned int>(it->second.size());
|
||||||
pBone->mWeights = it->second.data();
|
pBone->mWeights = it->second.data();
|
||||||
it->second.swap(*(new vector<aiVertexWeight>));
|
it->second.swap(*(new vector<aiVertexWeight>));
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,7 +304,7 @@ void ObjFileMtlImporter::createMaterial()
|
||||||
m_pModel->m_pCurrentMaterial = new ObjFile::Material();
|
m_pModel->m_pCurrentMaterial = new ObjFile::Material();
|
||||||
m_pModel->m_pCurrentMaterial->MaterialName.Set( name );
|
m_pModel->m_pCurrentMaterial->MaterialName.Set( name );
|
||||||
if (m_pModel->m_pCurrentMesh) {
|
if (m_pModel->m_pCurrentMesh) {
|
||||||
m_pModel->m_pCurrentMesh->m_uiMaterialIndex = m_pModel->m_MaterialLib.size() - 1;
|
m_pModel->m_pCurrentMesh->m_uiMaterialIndex = static_cast<unsigned int>(m_pModel->m_MaterialLib.size() - 1);
|
||||||
}
|
}
|
||||||
m_pModel->m_MaterialLib.push_back( name );
|
m_pModel->m_MaterialLib.push_back( name );
|
||||||
m_pModel->m_MaterialMap[ name ] = m_pModel->m_pCurrentMaterial;
|
m_pModel->m_MaterialMap[ name ] = m_pModel->m_pCurrentMaterial;
|
||||||
|
|
|
@ -555,10 +555,15 @@ void ObjFileParser::getMaterialDesc() {
|
||||||
// Search for material
|
// Search for material
|
||||||
std::map<std::string, ObjFile::Material*>::iterator it = m_pModel->m_MaterialMap.find(strName);
|
std::map<std::string, ObjFile::Material*>::iterator it = m_pModel->m_MaterialMap.find(strName);
|
||||||
if (it == m_pModel->m_MaterialMap.end()) {
|
if (it == m_pModel->m_MaterialMap.end()) {
|
||||||
// Not found, use default material
|
// Not found, so we don't know anything about the material except for its name.
|
||||||
m_pModel->m_pCurrentMaterial = m_pModel->m_pDefaultMaterial;
|
// This may be the case if the material library is missing. We don't want to lose all
|
||||||
DefaultLogger::get()->error("OBJ: failed to locate material " + strName + ", skipping");
|
// materials if that happens, so create a new named material instead of discarding it
|
||||||
strName = m_pModel->m_pDefaultMaterial->MaterialName.C_Str();
|
// completely.
|
||||||
|
DefaultLogger::get()->error("OBJ: failed to locate material " + strName + ", creating new material");
|
||||||
|
m_pModel->m_pCurrentMaterial = new ObjFile::Material();
|
||||||
|
m_pModel->m_pCurrentMaterial->MaterialName.Set(strName);
|
||||||
|
m_pModel->m_MaterialLib.push_back(strName);
|
||||||
|
m_pModel->m_MaterialMap[strName] = m_pModel->m_pCurrentMaterial;
|
||||||
} else {
|
} else {
|
||||||
// Found, using detected material
|
// Found, using detected material
|
||||||
m_pModel->m_pCurrentMaterial = (*it).second;
|
m_pModel->m_pCurrentMaterial = (*it).second;
|
||||||
|
|
|
@ -538,7 +538,7 @@ void PLYImporter::LoadFace(const PLY::Element* pcElement, const PLY::ElementInst
|
||||||
ai_assert(NULL != instElement);
|
ai_assert(NULL != instElement);
|
||||||
|
|
||||||
if (mGeneratedMesh == NULL)
|
if (mGeneratedMesh == NULL)
|
||||||
throw DeadlyImportError("Invalid .ply file: Vertices shoud be declared before faces");
|
throw DeadlyImportError("Invalid .ply file: Vertices should be declared before faces");
|
||||||
|
|
||||||
bool bOne = false;
|
bool bOne = false;
|
||||||
|
|
||||||
|
|
|
@ -618,7 +618,7 @@ bool PLY::DOM::ParseInstanceBinary(IOStreamBuffer<char> &streamBuffer, DOM* p_pc
|
||||||
}
|
}
|
||||||
|
|
||||||
streamBuffer.getNextBlock(buffer);
|
streamBuffer.getNextBlock(buffer);
|
||||||
unsigned int bufferSize = buffer.size();
|
unsigned int bufferSize = static_cast<unsigned int>(buffer.size());
|
||||||
const char* pCur = (char*)&buffer[0];
|
const char* pCur = (char*)&buffer[0];
|
||||||
if (!p_pcOut->ParseElementInstanceListsBinary(streamBuffer, buffer, pCur, bufferSize, loader, p_bBE))
|
if (!p_pcOut->ParseElementInstanceListsBinary(streamBuffer, buffer, pCur, bufferSize, loader, p_bBE))
|
||||||
{
|
{
|
||||||
|
@ -1025,7 +1025,7 @@ bool PLY::PropertyInstance::ParseValueBinary(IOStreamBuffer<char> &streamBuffer,
|
||||||
buffer = std::vector<char>(buffer.end() - bufferSize, buffer.end());
|
buffer = std::vector<char>(buffer.end() - bufferSize, buffer.end());
|
||||||
buffer.insert(buffer.end(), nbuffer.begin(), nbuffer.end());
|
buffer.insert(buffer.end(), nbuffer.begin(), nbuffer.end());
|
||||||
nbuffer.clear();
|
nbuffer.clear();
|
||||||
bufferSize = buffer.size();
|
bufferSize = static_cast<unsigned int>(buffer.size());
|
||||||
pCur = (char*)&buffer[0];
|
pCur = (char*)&buffer[0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -160,6 +160,11 @@ void PretransformVertices::CollectData( aiScene* pcScene, aiNode* pcNode, unsign
|
||||||
unsigned int& num_ref = num_refs[pcNode->mMeshes[i]];
|
unsigned int& num_ref = num_refs[pcNode->mMeshes[i]];
|
||||||
ai_assert(0 != num_ref);
|
ai_assert(0 != num_ref);
|
||||||
--num_ref;
|
--num_ref;
|
||||||
|
// Save the name of the last mesh
|
||||||
|
if (num_ref==0)
|
||||||
|
{
|
||||||
|
pcMeshOut->mName = pcMesh->mName;
|
||||||
|
}
|
||||||
|
|
||||||
if (identity) {
|
if (identity) {
|
||||||
// copy positions without modifying them
|
// copy positions without modifying them
|
||||||
|
@ -626,9 +631,10 @@ void PretransformVertices::Execute( aiScene* pScene)
|
||||||
|
|
||||||
// now delete all nodes in the scene and build a new
|
// now delete all nodes in the scene and build a new
|
||||||
// flat node graph with a root node and some level 1 children
|
// flat node graph with a root node and some level 1 children
|
||||||
|
aiNode* newRoot = new aiNode();
|
||||||
|
newRoot->mName = pScene->mRootNode->mName;
|
||||||
delete pScene->mRootNode;
|
delete pScene->mRootNode;
|
||||||
pScene->mRootNode = new aiNode();
|
pScene->mRootNode = new aiNode();
|
||||||
pScene->mRootNode->mName.Set("<dummy_root>");
|
|
||||||
|
|
||||||
if (1 == pScene->mNumMeshes && !pScene->mNumLights && !pScene->mNumCameras)
|
if (1 == pScene->mNumMeshes && !pScene->mNumLights && !pScene->mNumCameras)
|
||||||
{
|
{
|
||||||
|
@ -646,7 +652,7 @@ void PretransformVertices::Execute( aiScene* pScene)
|
||||||
{
|
{
|
||||||
aiNode* pcNode = *nodes = new aiNode();
|
aiNode* pcNode = *nodes = new aiNode();
|
||||||
pcNode->mParent = pScene->mRootNode;
|
pcNode->mParent = pScene->mRootNode;
|
||||||
pcNode->mName.length = ::ai_snprintf(pcNode->mName.data,MAXLEN,"mesh_%u",i);
|
pcNode->mName = pScene->mMeshes[i]->mName;
|
||||||
|
|
||||||
// setup mesh indices
|
// setup mesh indices
|
||||||
pcNode->mNumMeshes = 1;
|
pcNode->mNumMeshes = 1;
|
||||||
|
|
|
@ -39,14 +39,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER
|
||||||
|
|
||||||
#include "Q3BSPZipArchive.h"
|
#include "Q3BSPZipArchive.h"
|
||||||
#include <algorithm>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdlib>
|
|
||||||
#include <assimp/ai_assert.h>
|
#include <assimp/ai_assert.h>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
@ -137,7 +133,6 @@ zlib_filefunc_def IOSystem2Unzip::get(IOSystem* pIOHandler) {
|
||||||
return mapping;
|
return mapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
ZipFile::ZipFile(size_t size) : m_Size(size) {
|
ZipFile::ZipFile(size_t size) : m_Size(size) {
|
||||||
ai_assert(m_Size != 0);
|
ai_assert(m_Size != 0);
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <contrib/unzip/unzip.h>
|
#include <contrib/unzip/unzip.h>
|
||||||
#include <assimp/IOStream.hpp>
|
#include <assimp/IOStream.hpp>
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
|
@ -58,6 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
#include <assimp/mesh.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "ScenePrivate.h"
|
#include "ScenePrivate.h"
|
||||||
|
|
||||||
|
@ -757,7 +758,7 @@ void SceneCombiner::MergeBones(aiMesh* out,std::vector<aiMesh*>::const_iterator
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Merge a list of meshes
|
// Merge a list of meshes
|
||||||
void SceneCombiner::MergeMeshes(aiMesh** _out,unsigned int /*flags*/,
|
void SceneCombiner::MergeMeshes(aiMesh** _out, unsigned int /*flags*/,
|
||||||
std::vector<aiMesh*>::const_iterator begin,
|
std::vector<aiMesh*>::const_iterator begin,
|
||||||
std::vector<aiMesh*>::const_iterator end)
|
std::vector<aiMesh*>::const_iterator end)
|
||||||
{
|
{
|
||||||
|
@ -772,8 +773,14 @@ void SceneCombiner::MergeMeshes(aiMesh** _out,unsigned int /*flags*/,
|
||||||
aiMesh* out = *_out = new aiMesh();
|
aiMesh* out = *_out = new aiMesh();
|
||||||
out->mMaterialIndex = (*begin)->mMaterialIndex;
|
out->mMaterialIndex = (*begin)->mMaterialIndex;
|
||||||
|
|
||||||
|
std::string name;
|
||||||
// Find out how much output storage we'll need
|
// Find out how much output storage we'll need
|
||||||
for (std::vector<aiMesh*>::const_iterator it = begin; it != end;++it) {
|
for (std::vector<aiMesh*>::const_iterator it = begin; it != end; ++it) {
|
||||||
|
const char *meshName( (*it)->mName.C_Str() );
|
||||||
|
name += std::string( meshName );
|
||||||
|
if ( it != end - 1 ) {
|
||||||
|
name += ".";
|
||||||
|
}
|
||||||
out->mNumVertices += (*it)->mNumVertices;
|
out->mNumVertices += (*it)->mNumVertices;
|
||||||
out->mNumFaces += (*it)->mNumFaces;
|
out->mNumFaces += (*it)->mNumFaces;
|
||||||
out->mNumBones += (*it)->mNumBones;
|
out->mNumBones += (*it)->mNumBones;
|
||||||
|
@ -781,6 +788,7 @@ void SceneCombiner::MergeMeshes(aiMesh** _out,unsigned int /*flags*/,
|
||||||
// combine primitive type flags
|
// combine primitive type flags
|
||||||
out->mPrimitiveTypes |= (*it)->mPrimitiveTypes;
|
out->mPrimitiveTypes |= (*it)->mPrimitiveTypes;
|
||||||
}
|
}
|
||||||
|
out->mName.Set( name.c_str() );
|
||||||
|
|
||||||
if (out->mNumVertices) {
|
if (out->mNumVertices) {
|
||||||
aiVector3D* pv2;
|
aiVector3D* pv2;
|
||||||
|
@ -789,7 +797,7 @@ void SceneCombiner::MergeMeshes(aiMesh** _out,unsigned int /*flags*/,
|
||||||
if ((**begin).HasPositions()) {
|
if ((**begin).HasPositions()) {
|
||||||
|
|
||||||
pv2 = out->mVertices = new aiVector3D[out->mNumVertices];
|
pv2 = out->mVertices = new aiVector3D[out->mNumVertices];
|
||||||
for (std::vector<aiMesh*>::const_iterator it = begin; it != end;++it) {
|
for (std::vector<aiMesh*>::const_iterator it = begin; it != end; ++it) {
|
||||||
if ((*it)->mVertices) {
|
if ((*it)->mVertices) {
|
||||||
::memcpy(pv2,(*it)->mVertices,(*it)->mNumVertices*sizeof(aiVector3D));
|
::memcpy(pv2,(*it)->mVertices,(*it)->mNumVertices*sizeof(aiVector3D));
|
||||||
}
|
}
|
||||||
|
@ -809,7 +817,7 @@ void SceneCombiner::MergeMeshes(aiMesh** _out,unsigned int /*flags*/,
|
||||||
pv2 += (*it)->mNumVertices;
|
pv2 += (*it)->mNumVertices;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// copy tangents and bitangents
|
// copy tangents and bi-tangents
|
||||||
if ((**begin).HasTangentsAndBitangents()) {
|
if ((**begin).HasTangentsAndBitangents()) {
|
||||||
|
|
||||||
pv2 = out->mTangents = new aiVector3D[out->mNumVertices];
|
pv2 = out->mTangents = new aiVector3D[out->mNumVertices];
|
||||||
|
|
|
@ -95,8 +95,8 @@ struct WordIterator: public std::iterator<std::input_iterator_tag, const char*>
|
||||||
end_ = other.end_;
|
end_ = other.end_;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
bool operator==(WordIterator &other) const { return start_ == other.start_; }
|
bool operator==(const WordIterator &other) const { return start_ == other.start_; }
|
||||||
bool operator!=(WordIterator &other) const { return start_ != other.start_; }
|
bool operator!=(const WordIterator &other) const { return start_ != other.start_; }
|
||||||
WordIterator &operator++() {
|
WordIterator &operator++() {
|
||||||
start_ += strcspn(start_, whitespace);
|
start_ += strcspn(start_, whitespace);
|
||||||
start_ += strspn(start_, whitespace);
|
start_ += strspn(start_, whitespace);
|
||||||
|
@ -558,7 +558,7 @@ void X3DImporter::XML_ReadNode_GetAttrVal_AsArrF(const int pAttrIdx, std::vector
|
||||||
|
|
||||||
WordIterator wordItBegin(val, val + strlen(val));
|
WordIterator wordItBegin(val, val + strlen(val));
|
||||||
WordIterator wordItEnd;
|
WordIterator wordItEnd;
|
||||||
std::transform(wordItBegin, wordItEnd, std::back_inserter(pValue), [](const char *match) { return atof(match); });
|
std::transform(wordItBegin, wordItEnd, std::back_inserter(pValue), [](const char *match) { return static_cast<float>(atof(match)); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -242,7 +242,7 @@ Ref<T> LazyDict<T>::Create(const char* id)
|
||||||
}
|
}
|
||||||
T* inst = new T();
|
T* inst = new T();
|
||||||
inst->id = id;
|
inst->id = id;
|
||||||
inst->index = mObjs.size();
|
inst->index = static_cast<int>(mObjs.size());
|
||||||
return Add(inst);
|
return Add(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -886,7 +886,7 @@ inline void ExtractAnimationData(Asset& mAsset, std::string& animId, Ref<Animati
|
||||||
timeData[i] = nodeChannel->mPositionKeys[frameIndex].mTime / ticksPerSecond;
|
timeData[i] = nodeChannel->mPositionKeys[frameIndex].mTime / ticksPerSecond;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<Accessor> timeAccessor = ExportData(mAsset, animId, buffer, numKeyframes, &timeData[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_FLOAT);
|
Ref<Accessor> timeAccessor = ExportData(mAsset, animId, buffer, static_cast<unsigned int>(numKeyframes), &timeData[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_FLOAT);
|
||||||
if (timeAccessor) animRef->Parameters.TIME = timeAccessor;
|
if (timeAccessor) animRef->Parameters.TIME = timeAccessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -899,7 +899,7 @@ inline void ExtractAnimationData(Asset& mAsset, std::string& animId, Ref<Animati
|
||||||
translationData[i] = nodeChannel->mPositionKeys[frameIndex].mValue;
|
translationData[i] = nodeChannel->mPositionKeys[frameIndex].mValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<Accessor> tranAccessor = ExportData(mAsset, animId, buffer, numKeyframes, translationData, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
|
Ref<Accessor> tranAccessor = ExportData(mAsset, animId, buffer, static_cast<unsigned int>(numKeyframes), translationData, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
|
||||||
if ( tranAccessor ) {
|
if ( tranAccessor ) {
|
||||||
animRef->Parameters.translation = tranAccessor;
|
animRef->Parameters.translation = tranAccessor;
|
||||||
}
|
}
|
||||||
|
@ -915,7 +915,7 @@ inline void ExtractAnimationData(Asset& mAsset, std::string& animId, Ref<Animati
|
||||||
scaleData[i] = nodeChannel->mScalingKeys[frameIndex].mValue;
|
scaleData[i] = nodeChannel->mScalingKeys[frameIndex].mValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<Accessor> scaleAccessor = ExportData(mAsset, animId, buffer, numKeyframes, scaleData, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
|
Ref<Accessor> scaleAccessor = ExportData(mAsset, animId, buffer, static_cast<unsigned int>(numKeyframes), scaleData, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
|
||||||
if ( scaleAccessor ) {
|
if ( scaleAccessor ) {
|
||||||
animRef->Parameters.scale = scaleAccessor;
|
animRef->Parameters.scale = scaleAccessor;
|
||||||
}
|
}
|
||||||
|
@ -934,7 +934,7 @@ inline void ExtractAnimationData(Asset& mAsset, std::string& animId, Ref<Animati
|
||||||
rotationData[i][3] = nodeChannel->mRotationKeys[frameIndex].mValue.w;
|
rotationData[i][3] = nodeChannel->mRotationKeys[frameIndex].mValue.w;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<Accessor> rotAccessor = ExportData(mAsset, animId, buffer, numKeyframes, rotationData, AttribType::VEC4, AttribType::VEC4, ComponentType_FLOAT);
|
Ref<Accessor> rotAccessor = ExportData(mAsset, animId, buffer, static_cast<unsigned int>(numKeyframes), rotationData, AttribType::VEC4, AttribType::VEC4, ComponentType_FLOAT);
|
||||||
if ( rotAccessor ) {
|
if ( rotAccessor ) {
|
||||||
animRef->Parameters.rotation = rotAccessor;
|
animRef->Parameters.rotation = rotAccessor;
|
||||||
}
|
}
|
||||||
|
@ -989,7 +989,7 @@ void glTF2Exporter::ExportAnimations()
|
||||||
Animation::AnimChannel tmpAnimChannel;
|
Animation::AnimChannel tmpAnimChannel;
|
||||||
Animation::AnimSampler tmpAnimSampler;
|
Animation::AnimSampler tmpAnimSampler;
|
||||||
|
|
||||||
tmpAnimChannel.sampler = animRef->Samplers.size();
|
tmpAnimChannel.sampler = static_cast<int>(animRef->Samplers.size());
|
||||||
tmpAnimChannel.target.path = channelType;
|
tmpAnimChannel.target.path = channelType;
|
||||||
tmpAnimSampler.output = channelType;
|
tmpAnimSampler.output = channelType;
|
||||||
tmpAnimSampler.id = name + "_" + channelType;
|
tmpAnimSampler.id = name + "_" + channelType;
|
||||||
|
|
|
@ -875,7 +875,7 @@ inline void ExtractAnimationData(Asset& mAsset, std::string& animId, Ref<Animati
|
||||||
timeData[i] = nodeChannel->mPositionKeys[frameIndex].mTime / ticksPerSecond;
|
timeData[i] = nodeChannel->mPositionKeys[frameIndex].mTime / ticksPerSecond;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<Accessor> timeAccessor = ExportData(mAsset, animId, buffer, numKeyframes, &timeData[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_FLOAT);
|
Ref<Accessor> timeAccessor = ExportData(mAsset, animId, buffer, static_cast<unsigned int>(numKeyframes), &timeData[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_FLOAT);
|
||||||
if (timeAccessor) animRef->Parameters.TIME = timeAccessor;
|
if (timeAccessor) animRef->Parameters.TIME = timeAccessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -888,7 +888,7 @@ inline void ExtractAnimationData(Asset& mAsset, std::string& animId, Ref<Animati
|
||||||
translationData[i] = nodeChannel->mPositionKeys[frameIndex].mValue;
|
translationData[i] = nodeChannel->mPositionKeys[frameIndex].mValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<Accessor> tranAccessor = ExportData(mAsset, animId, buffer, numKeyframes, translationData, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
|
Ref<Accessor> tranAccessor = ExportData(mAsset, animId, buffer, static_cast<unsigned int>(numKeyframes), translationData, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
|
||||||
if ( tranAccessor ) {
|
if ( tranAccessor ) {
|
||||||
animRef->Parameters.translation = tranAccessor;
|
animRef->Parameters.translation = tranAccessor;
|
||||||
}
|
}
|
||||||
|
@ -904,7 +904,7 @@ inline void ExtractAnimationData(Asset& mAsset, std::string& animId, Ref<Animati
|
||||||
scaleData[i] = nodeChannel->mScalingKeys[frameIndex].mValue;
|
scaleData[i] = nodeChannel->mScalingKeys[frameIndex].mValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<Accessor> scaleAccessor = ExportData(mAsset, animId, buffer, numKeyframes, scaleData, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
|
Ref<Accessor> scaleAccessor = ExportData(mAsset, animId, buffer, static_cast<unsigned int>(numKeyframes), scaleData, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
|
||||||
if ( scaleAccessor ) {
|
if ( scaleAccessor ) {
|
||||||
animRef->Parameters.scale = scaleAccessor;
|
animRef->Parameters.scale = scaleAccessor;
|
||||||
}
|
}
|
||||||
|
@ -923,7 +923,7 @@ inline void ExtractAnimationData(Asset& mAsset, std::string& animId, Ref<Animati
|
||||||
rotationData[i][3] = nodeChannel->mRotationKeys[frameIndex].mValue.w;
|
rotationData[i][3] = nodeChannel->mRotationKeys[frameIndex].mValue.w;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<Accessor> rotAccessor = ExportData(mAsset, animId, buffer, numKeyframes, rotationData, AttribType::VEC4, AttribType::VEC4, ComponentType_FLOAT);
|
Ref<Accessor> rotAccessor = ExportData(mAsset, animId, buffer, static_cast<unsigned int>(numKeyframes), rotationData, AttribType::VEC4, AttribType::VEC4, ComponentType_FLOAT);
|
||||||
if ( rotAccessor ) {
|
if ( rotAccessor ) {
|
||||||
animRef->Parameters.rotation = rotAccessor;
|
animRef->Parameters.rotation = rotAccessor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,3 +11,7 @@ set( IrrXML_SRCS
|
||||||
add_library(IrrXML STATIC ${IrrXML_SRCS})
|
add_library(IrrXML STATIC ${IrrXML_SRCS})
|
||||||
set(IRRXML_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "IrrXML_Include" )
|
set(IRRXML_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "IrrXML_Include" )
|
||||||
set(IRRXML_LIBRARY "IrrXML" CACHE INTERNAL "IrrXML" )
|
set(IRRXML_LIBRARY "IrrXML" CACHE INTERNAL "IrrXML" )
|
||||||
|
|
||||||
|
install(TARGETS IrrXML
|
||||||
|
ARCHIVE DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||||
|
COMPONENT ${LIBASSIMP_COMPONENT})
|
||||||
|
|
|
@ -217,10 +217,9 @@ public:
|
||||||
static void MergeScenes(aiScene** dest,std::vector<aiScene*>& src,
|
static void MergeScenes(aiScene** dest,std::vector<aiScene*>& src,
|
||||||
unsigned int flags = 0);
|
unsigned int flags = 0);
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Merges two or more scenes and attaches all sceenes to a specific
|
/** Merges two or more scenes and attaches all scenes to a specific
|
||||||
* position in the node graph of the masteer scene.
|
* position in the node graph of the master scene.
|
||||||
*
|
*
|
||||||
* @param dest Receives a pointer to the destination scene. If the
|
* @param dest Receives a pointer to the destination scene. If the
|
||||||
* pointer doesn't point to NULL when the function is called, the
|
* pointer doesn't point to NULL when the function is called, the
|
||||||
|
@ -236,7 +235,6 @@ public:
|
||||||
std::vector<AttachmentInfo>& src,
|
std::vector<AttachmentInfo>& src,
|
||||||
unsigned int flags = 0);
|
unsigned int flags = 0);
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Merges two or more meshes
|
/** Merges two or more meshes
|
||||||
*
|
*
|
||||||
|
@ -255,7 +253,6 @@ public:
|
||||||
std::vector<aiMesh*>::const_iterator begin,
|
std::vector<aiMesh*>::const_iterator begin,
|
||||||
std::vector<aiMesh*>::const_iterator end);
|
std::vector<aiMesh*>::const_iterator end);
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Merges two or more bones
|
/** Merges two or more bones
|
||||||
*
|
*
|
||||||
|
|
|
@ -9,6 +9,10 @@ import ctypes
|
||||||
from ctypes import POINTER
|
from ctypes import POINTER
|
||||||
import operator
|
import operator
|
||||||
|
|
||||||
|
from distutils.sysconfig import get_python_lib
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
try: import numpy
|
try: import numpy
|
||||||
except: numpy = None
|
except: numpy = None
|
||||||
|
|
||||||
|
@ -26,7 +30,15 @@ if os.name=='posix':
|
||||||
additional_dirs.append('/usr/lib/x86_64-linux-gnu')
|
additional_dirs.append('/usr/lib/x86_64-linux-gnu')
|
||||||
additional_dirs.append('/usr/local/lib/')
|
additional_dirs.append('/usr/local/lib/')
|
||||||
|
|
||||||
# note - this won't catch libassimp.so.N.n, but
|
# check if running from anaconda.
|
||||||
|
if "conda" or "continuum" in sys.version.lower():
|
||||||
|
cur_path = get_python_lib()
|
||||||
|
pattern = re.compile('.*\/lib\/')
|
||||||
|
conda_lib = pattern.match(cur_path).group()
|
||||||
|
logger.info("Adding Anaconda lib path:"+ conda_lib)
|
||||||
|
additional_dirs.append(conda_lib)
|
||||||
|
|
||||||
|
# note - this won't catch libassimp.so.N.n, but
|
||||||
# currently there's always a symlink called
|
# currently there's always a symlink called
|
||||||
# libassimp.so in /usr/local/lib.
|
# libassimp.so in /usr/local/lib.
|
||||||
ext_whitelist.append('.so')
|
ext_whitelist.append('.so')
|
||||||
|
@ -39,7 +51,7 @@ elif os.name=='nt':
|
||||||
for dir_candidate in path_dirs:
|
for dir_candidate in path_dirs:
|
||||||
if 'assimp' in dir_candidate.lower():
|
if 'assimp' in dir_candidate.lower():
|
||||||
additional_dirs.append(dir_candidate)
|
additional_dirs.append(dir_candidate)
|
||||||
|
|
||||||
#print(additional_dirs)
|
#print(additional_dirs)
|
||||||
def vec2tuple(x):
|
def vec2tuple(x):
|
||||||
""" Converts a VECTOR3D to a Tuple """
|
""" Converts a VECTOR3D to a Tuple """
|
||||||
|
@ -61,10 +73,10 @@ def transform(vector3, matrix4x4):
|
||||||
m2[0]*x + m2[1]*y + m2[2]*z + m2[3],
|
m2[0]*x + m2[1]*y + m2[2]*z + m2[3],
|
||||||
m3[0]*x + m3[1]*y + m3[2]*z + m3[3]
|
m3[0]*x + m3[1]*y + m3[2]*z + m3[3]
|
||||||
]
|
]
|
||||||
|
|
||||||
def _inv(matrix4x4):
|
def _inv(matrix4x4):
|
||||||
m0,m1,m2,m3 = matrix4x4
|
m0,m1,m2,m3 = matrix4x4
|
||||||
|
|
||||||
det = m0[3]*m1[2]*m2[1]*m3[0] - m0[2]*m1[3]*m2[1]*m3[0] - \
|
det = m0[3]*m1[2]*m2[1]*m3[0] - m0[2]*m1[3]*m2[1]*m3[0] - \
|
||||||
m0[3]*m1[1]*m2[2]*m3[0] + m0[1]*m1[3]*m2[2]*m3[0] + \
|
m0[3]*m1[1]*m2[2]*m3[0] + m0[1]*m1[3]*m2[2]*m3[0] + \
|
||||||
m0[2]*m1[1]*m2[3]*m3[0] - m0[1]*m1[2]*m2[3]*m3[0] - \
|
m0[2]*m1[1]*m2[3]*m3[0] - m0[1]*m1[2]*m2[3]*m3[0] - \
|
||||||
|
@ -77,7 +89,7 @@ def _inv(matrix4x4):
|
||||||
m0[2]*m1[1]*m2[0]*m3[3] + m0[1]*m1[2]*m2[0]*m3[3] + \
|
m0[2]*m1[1]*m2[0]*m3[3] + m0[1]*m1[2]*m2[0]*m3[3] + \
|
||||||
m0[2]*m1[0]*m2[1]*m3[3] - m0[0]*m1[2]*m2[1]*m3[3] - \
|
m0[2]*m1[0]*m2[1]*m3[3] - m0[0]*m1[2]*m2[1]*m3[3] - \
|
||||||
m0[1]*m1[0]*m2[2]*m3[3] + m0[0]*m1[1]*m2[2]*m3[3]
|
m0[1]*m1[0]*m2[2]*m3[3] + m0[0]*m1[1]*m2[2]*m3[3]
|
||||||
|
|
||||||
return[[( m1[2]*m2[3]*m3[1] - m1[3]*m2[2]*m3[1] + m1[3]*m2[1]*m3[2] - m1[1]*m2[3]*m3[2] - m1[2]*m2[1]*m3[3] + m1[1]*m2[2]*m3[3]) /det,
|
return[[( m1[2]*m2[3]*m3[1] - m1[3]*m2[2]*m3[1] + m1[3]*m2[1]*m3[2] - m1[1]*m2[3]*m3[2] - m1[2]*m2[1]*m3[3] + m1[1]*m2[2]*m3[3]) /det,
|
||||||
( m0[3]*m2[2]*m3[1] - m0[2]*m2[3]*m3[1] - m0[3]*m2[1]*m3[2] + m0[1]*m2[3]*m3[2] + m0[2]*m2[1]*m3[3] - m0[1]*m2[2]*m3[3]) /det,
|
( m0[3]*m2[2]*m3[1] - m0[2]*m2[3]*m3[1] - m0[3]*m2[1]*m3[2] + m0[1]*m2[3]*m3[2] + m0[2]*m2[1]*m3[3] - m0[1]*m2[2]*m3[3]) /det,
|
||||||
( m0[2]*m1[3]*m3[1] - m0[3]*m1[2]*m3[1] + m0[3]*m1[1]*m3[2] - m0[1]*m1[3]*m3[2] - m0[2]*m1[1]*m3[3] + m0[1]*m1[2]*m3[3]) /det,
|
( m0[2]*m1[3]*m3[1] - m0[3]*m1[2]*m3[1] + m0[3]*m1[1]*m3[2] - m0[1]*m1[3]*m3[2] - m0[2]*m1[1]*m3[3] + m0[1]*m1[2]*m3[3]) /det,
|
||||||
|
@ -94,7 +106,7 @@ def _inv(matrix4x4):
|
||||||
( m0[1]*m2[2]*m3[0] - m0[2]*m2[1]*m3[0] + m0[2]*m2[0]*m3[1] - m0[0]*m2[2]*m3[1] - m0[1]*m2[0]*m3[2] + m0[0]*m2[1]*m3[2]) /det,
|
( m0[1]*m2[2]*m3[0] - m0[2]*m2[1]*m3[0] + m0[2]*m2[0]*m3[1] - m0[0]*m2[2]*m3[1] - m0[1]*m2[0]*m3[2] + m0[0]*m2[1]*m3[2]) /det,
|
||||||
( m0[2]*m1[1]*m3[0] - m0[1]*m1[2]*m3[0] - m0[2]*m1[0]*m3[1] + m0[0]*m1[2]*m3[1] + m0[1]*m1[0]*m3[2] - m0[0]*m1[1]*m3[2]) /det,
|
( m0[2]*m1[1]*m3[0] - m0[1]*m1[2]*m3[0] - m0[2]*m1[0]*m3[1] + m0[0]*m1[2]*m3[1] + m0[1]*m1[0]*m3[2] - m0[0]*m1[1]*m3[2]) /det,
|
||||||
( m0[1]*m1[2]*m2[0] - m0[2]*m1[1]*m2[0] + m0[2]*m1[0]*m2[1] - m0[0]*m1[2]*m2[1] - m0[1]*m1[0]*m2[2] + m0[0]*m1[1]*m2[2]) /det]]
|
( m0[1]*m1[2]*m2[0] - m0[2]*m1[1]*m2[0] + m0[2]*m1[0]*m2[1] - m0[0]*m1[2]*m2[1] - m0[1]*m1[0]*m2[2] + m0[0]*m1[1]*m2[2]) /det]]
|
||||||
|
|
||||||
def get_bounding_box(scene):
|
def get_bounding_box(scene):
|
||||||
bb_min = [1e10, 1e10, 1e10] # x,y,z
|
bb_min = [1e10, 1e10, 1e10] # x,y,z
|
||||||
bb_max = [-1e10, -1e10, -1e10] # x,y,z
|
bb_max = [-1e10, -1e10, -1e10] # x,y,z
|
||||||
|
@ -129,7 +141,7 @@ def get_bounding_box_for_node(node, bb_min, bb_max, transformation):
|
||||||
t3[0]*T0[2] + t3[1]*T1[2] + t3[2]*T2[2] + t3[3]*T3[2],
|
t3[0]*T0[2] + t3[1]*T1[2] + t3[2]*T2[2] + t3[3]*T3[2],
|
||||||
t3[0]*T0[3] + t3[1]*T1[3] + t3[2]*T2[3] + t3[3]*T3[3]
|
t3[0]*T0[3] + t3[1]*T1[3] + t3[2]*T2[3] + t3[3]*T3[3]
|
||||||
] ]
|
] ]
|
||||||
|
|
||||||
for mesh in node.meshes:
|
for mesh in node.meshes:
|
||||||
for v in mesh.vertices:
|
for v in mesh.vertices:
|
||||||
v = transform(v, transformation)
|
v = transform(v, transformation)
|
||||||
|
@ -149,25 +161,25 @@ def get_bounding_box_for_node(node, bb_min, bb_max, transformation):
|
||||||
def try_load_functions(library_path, dll):
|
def try_load_functions(library_path, dll):
|
||||||
'''
|
'''
|
||||||
Try to bind to aiImportFile and aiReleaseImport
|
Try to bind to aiImportFile and aiReleaseImport
|
||||||
|
|
||||||
Arguments
|
Arguments
|
||||||
---------
|
---------
|
||||||
library_path: path to current lib
|
library_path: path to current lib
|
||||||
dll: ctypes handle to library
|
dll: ctypes handle to library
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
---------
|
---------
|
||||||
If unsuccessful:
|
If unsuccessful:
|
||||||
None
|
None
|
||||||
If successful:
|
If successful:
|
||||||
Tuple containing (library_path,
|
Tuple containing (library_path,
|
||||||
load from filename function,
|
load from filename function,
|
||||||
load from memory function,
|
load from memory function,
|
||||||
export to filename function,
|
export to filename function,
|
||||||
release function,
|
release function,
|
||||||
ctypes handle to assimp library)
|
ctypes handle to assimp library)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
load = dll.aiImportFile
|
load = dll.aiImportFile
|
||||||
release = dll.aiReleaseImport
|
release = dll.aiReleaseImport
|
||||||
|
@ -176,7 +188,7 @@ def try_load_functions(library_path, dll):
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
#OK, this is a library, but it doesn't have the functions we need
|
#OK, this is a library, but it doesn't have the functions we need
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# library found!
|
# library found!
|
||||||
from .structs import Scene
|
from .structs import Scene
|
||||||
load.restype = POINTER(Scene)
|
load.restype = POINTER(Scene)
|
||||||
|
@ -185,13 +197,13 @@ def try_load_functions(library_path, dll):
|
||||||
|
|
||||||
def search_library():
|
def search_library():
|
||||||
'''
|
'''
|
||||||
Loads the assimp library.
|
Loads the assimp library.
|
||||||
Throws exception AssimpError if no library_path is found
|
Throws exception AssimpError if no library_path is found
|
||||||
|
|
||||||
Returns: tuple, (load from filename function,
|
Returns: tuple, (load from filename function,
|
||||||
load from memory function,
|
load from memory function,
|
||||||
export to filename function,
|
export to filename function,
|
||||||
release function,
|
release function,
|
||||||
dll)
|
dll)
|
||||||
'''
|
'''
|
||||||
#this path
|
#this path
|
||||||
|
@ -201,7 +213,7 @@ def search_library():
|
||||||
try:
|
try:
|
||||||
ctypes.windll.kernel32.SetErrorMode(0x8007)
|
ctypes.windll.kernel32.SetErrorMode(0x8007)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
candidates = []
|
candidates = []
|
||||||
# test every file
|
# test every file
|
||||||
|
@ -209,7 +221,7 @@ def search_library():
|
||||||
if os.path.isdir(curfolder):
|
if os.path.isdir(curfolder):
|
||||||
for filename in os.listdir(curfolder):
|
for filename in os.listdir(curfolder):
|
||||||
# our minimum requirement for candidates is that
|
# our minimum requirement for candidates is that
|
||||||
# they should contain 'assimp' somewhere in
|
# they should contain 'assimp' somewhere in
|
||||||
# their name
|
# their name
|
||||||
if filename.lower().find('assimp')==-1 or\
|
if filename.lower().find('assimp')==-1 or\
|
||||||
os.path.splitext(filename)[-1].lower() not in ext_whitelist:
|
os.path.splitext(filename)[-1].lower() not in ext_whitelist:
|
||||||
|
@ -248,10 +260,10 @@ def hasattr_silent(object, name):
|
||||||
"""
|
"""
|
||||||
Calls hasttr() with the given parameters and preserves the legacy (pre-Python 3.2)
|
Calls hasttr() with the given parameters and preserves the legacy (pre-Python 3.2)
|
||||||
functionality of silently catching exceptions.
|
functionality of silently catching exceptions.
|
||||||
|
|
||||||
Returns the result of hasatter() or False if an exception was raised.
|
Returns the result of hasatter() or False if an exception was raised.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return hasattr(object, name)
|
return hasattr(object, name)
|
||||||
except:
|
except:
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -8,6 +8,9 @@ setup(name='pyassimp',
|
||||||
description='Python bindings for the Open Asset Import Library (ASSIMP)',
|
description='Python bindings for the Open Asset Import Library (ASSIMP)',
|
||||||
url='https://github.com/assimp/assimp',
|
url='https://github.com/assimp/assimp',
|
||||||
packages=['pyassimp'],
|
packages=['pyassimp'],
|
||||||
data_files=[('share/pyassimp', ['README.md']),
|
data_files=[
|
||||||
('share/examples/pyassimp', ['scripts/' + f for f in os.listdir('scripts/')])], requires=['numpy']
|
('share/pyassimp', ['README.md']),
|
||||||
|
('share/examples/pyassimp', ['scripts/' + f for f in os.listdir('scripts/')])
|
||||||
|
],
|
||||||
|
requires=['numpy']
|
||||||
)
|
)
|
||||||
|
|
|
@ -116,6 +116,7 @@ SET( TEST_SRCS
|
||||||
unit/utRemoveRedundantMaterials.cpp
|
unit/utRemoveRedundantMaterials.cpp
|
||||||
unit/utRemoveVCProcess.cpp
|
unit/utRemoveVCProcess.cpp
|
||||||
unit/utScenePreprocessor.cpp
|
unit/utScenePreprocessor.cpp
|
||||||
|
unit/utSceneCombiner.cpp
|
||||||
unit/utSharedPPData.cpp
|
unit/utSharedPPData.cpp
|
||||||
unit/utStringUtils.cpp
|
unit/utStringUtils.cpp
|
||||||
unit/utSMDImportExport.cpp
|
unit/utSMDImportExport.cpp
|
||||||
|
@ -130,6 +131,7 @@ SET( TEST_SRCS
|
||||||
unit/utVector3.cpp
|
unit/utVector3.cpp
|
||||||
unit/utXImporterExporter.cpp
|
unit/utXImporterExporter.cpp
|
||||||
unit/utD3MFImportExport.cpp
|
unit/utD3MFImportExport.cpp
|
||||||
|
unit/utQ3DImportExport.cpp
|
||||||
unit/utProfiler.cpp
|
unit/utProfiler.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -43,13 +43,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/scene.h>
|
||||||
|
|
||||||
class utD3MFImporterExporter : public AbstractImportExportBase {
|
class utD3MFImporterExporter : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3MF/box.3mf", 0);
|
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3MF/box.3mf", 0);
|
||||||
return nullptr != scene;
|
EXPECT_EQ( 1u, scene->mNumMeshes );
|
||||||
|
aiMesh *mesh = scene->mMeshes[ 0 ];
|
||||||
|
EXPECT_NE( nullptr, mesh );
|
||||||
|
EXPECT_EQ( 12u, mesh->mNumFaces );
|
||||||
|
EXPECT_EQ( 8u, mesh->mNumVertices );
|
||||||
|
|
||||||
|
return ( nullptr != scene );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,6 @@ public:
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OpenGEX/Example.ogex", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OpenGEX/Example.ogex", 0 );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
Open Asset Import Library (assimp)
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2006-2017, 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 "UnitTestPCH.h"
|
||||||
|
|
||||||
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
|
#include <assimp/Importer.hpp>
|
||||||
|
|
||||||
|
using namespace Assimp;
|
||||||
|
|
||||||
|
class utQ3DImportExport : public AbstractImportExportBase {
|
||||||
|
public:
|
||||||
|
virtual bool importerTest() {
|
||||||
|
Assimp::Importer importer;
|
||||||
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/Q3D/earth.q3o", 0 );
|
||||||
|
return nullptr != scene;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(utQ3DImportExport, importTest) {
|
||||||
|
EXPECT_TRUE( importerTest() );
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
/*
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
Open Asset Import Library (assimp)
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2006-2017, 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 "UnitTestPCH.h"
|
||||||
|
#include <assimp/SceneCombiner.h>
|
||||||
|
#include <assimp/mesh.h>
|
||||||
|
|
||||||
|
using namespace ::Assimp;
|
||||||
|
|
||||||
|
class utSceneCombiner : public ::testing::Test {
|
||||||
|
// empty
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F( utSceneCombiner, MergeMeshes_ValidNames_Test ) {
|
||||||
|
std::vector<aiMesh*> merge_list;
|
||||||
|
aiMesh *mesh1 = new aiMesh;
|
||||||
|
mesh1->mName.Set( "mesh_1" );
|
||||||
|
merge_list.push_back( mesh1 );
|
||||||
|
|
||||||
|
aiMesh *mesh2 = new aiMesh;
|
||||||
|
mesh2->mName.Set( "mesh_2" );
|
||||||
|
merge_list.push_back( mesh2 );
|
||||||
|
|
||||||
|
aiMesh *mesh3 = new aiMesh;
|
||||||
|
mesh3->mName.Set( "mesh_3" );
|
||||||
|
merge_list.push_back( mesh3 );
|
||||||
|
|
||||||
|
aiMesh *out( nullptr );
|
||||||
|
SceneCombiner::MergeMeshes( &out, 0, merge_list.begin(), merge_list.end() );
|
||||||
|
std::string outName = out->mName.C_Str();
|
||||||
|
EXPECT_EQ( "mesh_1.mesh_2.mesh_3", outName );
|
||||||
|
}
|
|
@ -6,7 +6,11 @@
|
||||||
#include "glview.hpp"
|
#include "glview.hpp"
|
||||||
|
|
||||||
// Header files, OpenGL.
|
// Header files, OpenGL.
|
||||||
#include <GL/glu.h>
|
#if defined(__APPLE__)
|
||||||
|
# include <OpenGL/glu.h>
|
||||||
|
#else
|
||||||
|
# include <GL/glu.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// Header files, DevIL.
|
// Header files, DevIL.
|
||||||
#include <il.h>
|
#include <il.h>
|
||||||
|
|
Loading…
Reference in New Issue