Saturday, June 24, 2017

c++ - Assimp and directX12 universal apps


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 
#include
#include

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




No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...