diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index c4106042b..7870524e8 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -961,6 +961,12 @@ ENDIF() SOURCE_GROUP( Contrib\\Poly2Tri FILES ${Poly2Tri_SRCS}) #ENDIF() +# mikktspacetangets + SET( MikkTSpaceTangents_SRCS + ../contrib/MikkTSpace/mikktspace.c + ../contrib/MikkTSpace/mikktspace.h + ) + # minizip/unzip IF(ASSIMP_HUNTER_ENABLED) hunter_add_package(minizip) @@ -1159,6 +1165,7 @@ SET( assimp_src ${ziplib_SRCS} ${Pugixml_SRCS} ${stb_SRCS} + ${MikkTSpaceTangents_SRCS} # Necessary to show the headers in the project when using the VC++ generator: ${PUBLIC_HEADERS} diff --git a/code/PostProcessing/GenerateMikkTSpaceTangents.cpp b/code/PostProcessing/GenerateMikkTSpaceTangents.cpp index 37f2cad50..da9af59e3 100644 --- a/code/PostProcessing/GenerateMikkTSpaceTangents.cpp +++ b/code/PostProcessing/GenerateMikkTSpaceTangents.cpp @@ -50,7 +50,7 @@ static void get_tex_coords(const SMikkTSpaceContext *context, float outuv[], int } else if (currentMesh->mNumUVComponents[iVert] == 3){ outuv[0] = t.x; outuv[1] = t.y; - outuv[2] = t.z; + outuv[2] = 0.0; } } diff --git a/code/PostProcessing/GenerateMikkTSpaceTangents.h b/code/PostProcessing/GenerateMikkTSpaceTangents.h index 9ca21b718..ef0182cf3 100644 --- a/code/PostProcessing/GenerateMikkTSpaceTangents.h +++ b/code/PostProcessing/GenerateMikkTSpaceTangents.h @@ -11,9 +11,11 @@ public: ~GenerateMikkTSpaceTangents() override = default; bool IsActive(unsigned int pFlags) const override; void Execute(aiScene* pScene) override; + void SetupProperties(const Importer *pImp) override; void ExecutePerMesh(aiMesh *mesh); private: + bool mActive = false; SMikkTSpaceInterface mIface; SMikkTSpaceContext mContext; };