3
\$\begingroup\$

I started a directX 12 universal app project on visual studios and started coding some stuff to create a physics engine. I was currently working on implmenting Assimp into the engine too load whatever 3d models I want. I believe I set the Assimp up incorrectly somehow. The code for loading the models worked on my last project with dx11 (non universal app). I will add the code anyways.

Mesh mesh;
// Create assimp importer to load the file
Assimp::Importer importer;
const aiScene* aiscene = importer.ReadFile(contentDirPath + filePath, aiProcess_OptimizeMeshes
    | aiProcess_PreTransformVertices
    | aiProcess_Triangulate
    | aiProcess_GenSmoothNormals
    | aiProcess_FlipUVs
    | aiProcess_OptimizeGraph
    | aiProcess_LimitBoneWeights);

// Append filePath to use file name as mesh name
mesh.name = filePath.substr(0, filePath.size());
mesh.name = mesh.name.substr(0, mesh.name.size() - 4);

for (UINT i = 0; i < aiscene->mNumMeshes; i++)
{
    // Set the size of indices and vertices
    mesh.vertices.resize(aiscene->mMeshes[i][0].mNumVertices);
    mesh.indices.resize(aiscene->mMeshes[i][0].mNumVertices);

    // Iterate through vertices
    for (UINT j = 0; j < aiscene->mMeshes[i][0].mNumVertices; j++)
    {
        if (aiscene->mMeshes[i][0].HasPositions())
            mesh.vertices[j].pos = XMFLOAT3(aiscene->mMeshes[i][0].mVertices[j].x, aiscene->mMeshes[i][0].mVertices[j].y, aiscene->mMeshes[i][0].mVertices[j].z);

        mesh.indices[j] = j;
    }
}

Now I think it has something to do with setting up the project. I went to Project->Properties->VC++Directories and in Executable, Include, & Library I added Assimp\bin, Assimp\include, and Assimp\lib respectively. Then in Project->Properties->Linker->Input->Additional Dependencies I added assimp.lib. I then included these into my project where needed. This is what I did for my non universal dx11 project and it worked fine.

#include <assimp\scene.h>
#include <assimp\Importer.hpp>
#include <assimp\postprocess.h>

Now when I run the program. I get this,

"Unable to activate Windows Store app 'App name here' The 'exe name here' process started, but the activation request failed with error 'The app didn't start'."

So I looked at the output and it says,

'A dependent dll was not found'

I checked to see if there was even a dll for assimp in the bin I added, there was. I also tried moving it to where the exe was located, that didn't work either. Am I doing something wrong? Does assimp not work in universl apps? If I comment out my assimp code and rebuild it runs fine so I figured the dll it said was not found was the assimp.dll

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

There are several solutions to this problem:

  • build assimp as a static library. When doing this make sure to link all dependencies into the library (you have to change the project properties for this, Properties->Linker->Link Library Dependencies). This way you get a proper static library (thats the way I did it). Then just link it with your Universal App.
  • You can try and load the DLL yourself, make sure to use LoadPackagedLibrary and that the DLL is included in your deployed application (I did not try this with assimp, might not work depending on assimp)
  • You can change the assimp project to a UniversalApp project, there is a How-To from Microsoft on this topic: https://msdn.microsoft.com/en-us/library/mt186162.aspx

That being said, the easiest way to go is by using the static library version. Universal Apps are run in a protected environment and are not allowed to load DLLs from outside this sandbox. So you have to include the DLL anyway, so there is no drawback when using a static library.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .