Merge branch 'master' into kimkulling/refactoring_geoutils

This commit is contained in:
Kim Kulling
2023-05-04 21:10:00 +02:00
committed by GitHub
155 changed files with 20577 additions and 369 deletions

View File

@@ -111,6 +111,12 @@ void MakeLeftHandedProcess::Execute(aiScene *pScene) {
ProcessAnimation(nodeAnim);
}
}
// process the cameras accordingly
for( unsigned int a = 0; a < pScene->mNumCameras; ++a)
{
ProcessCamera(pScene->mCameras[a]);
}
ASSIMP_LOG_DEBUG("MakeLeftHandedProcess finished");
}
@@ -222,6 +228,13 @@ void MakeLeftHandedProcess::ProcessAnimation(aiNodeAnim *pAnim) {
}
}
// ------------------------------------------------------------------------------------------------
// Converts a single camera to left handed coordinates.
void MakeLeftHandedProcess::ProcessCamera( aiCamera* pCam)
{
pCam->mLookAt = ai_real(2.0f) * pCam->mPosition - pCam->mLookAt;
}
#endif // !! ASSIMP_BUILD_NO_MAKELEFTHANDED_PROCESS
#ifndef ASSIMP_BUILD_NO_FLIPUVS_PROCESS
// # FlipUVsProcess

View File

@@ -58,6 +58,7 @@ struct aiMesh;
struct aiNodeAnim;
struct aiNode;
struct aiMaterial;
struct aiCamera;
namespace Assimp {
@@ -109,6 +110,14 @@ protected:
* @param pAnim The bone animation to transform
*/
void ProcessAnimation( aiNodeAnim* pAnim);
// -------------------------------------------------------------------
/** Converts a single camera to left handed coordinates.
* The camera viewing direction is inverted by reflecting mLookAt
* across mPosition.
* @param pCam The camera to convert
*/
void ProcessCamera( aiCamera* pCam);
};

View File

@@ -588,7 +588,7 @@ void PretransformVertices::Execute(aiScene *pScene) {
// multiply all properties of the camera with the absolute
// transformation of the corresponding node
cam->mPosition = nd->mTransformation * cam->mPosition;
cam->mLookAt = aiMatrix3x3(nd->mTransformation) * cam->mLookAt;
cam->mLookAt = nd->mTransformation * cam->mLookAt;
cam->mUp = aiMatrix3x3(nd->mTransformation) * cam->mUp;
}

View File

@@ -286,7 +286,6 @@ void ValidateDSProcess::Validate(const aiMesh *pMesh) {
switch (face.mNumIndices) {
case 0:
ReportError("aiMesh::mFaces[%i].mNumIndices is 0", i);
break;
case 1:
if (0 == (pMesh->mPrimitiveTypes & aiPrimitiveType_POINT)) {
ReportError("aiMesh::mFaces[%i] is a POINT but aiMesh::mPrimitiveTypes "
@@ -898,7 +897,12 @@ void ValidateDSProcess::Validate(const aiNode *pNode) {
nodeName, pNode->mNumChildren);
}
for (unsigned int i = 0; i < pNode->mNumChildren; ++i) {
Validate(pNode->mChildren[i]);
const aiNode *pChild = pNode->mChildren[i];
Validate(pChild);
if (pChild->mParent != pNode) {
const char *parentName = (pChild->mParent != nullptr) ? pChild->mParent->mName.C_Str() : "null";
ReportError("aiNode \"%s\" child %i \"%s\" parent is someone else: \"%s\"", pNode->mName.C_Str(), i, pChild->mName.C_Str(), parentName);
}
}
}
}