Skip to content

Commit

Permalink
Fix Emscripten build in absence of assimp headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkCallow committed Aug 5, 2024
1 parent d3ac8ab commit cdde9d3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/loadtests/glloadtests/shader-based/EncodeTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

#include "GL3LoadTestSample.h"

#include <iostream>

class EncodeTexture : public GL3LoadTestSample {
public:
EncodeTexture(uint32_t width, uint32_t height,
Expand Down
13 changes: 13 additions & 0 deletions tests/loadtests/glloadtests/shader-based/GL3LoadTestSample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,14 @@ GL3LoadTestSample::framebufferColorEncoding()
return encoding;
}

#if !defined(__EMSCRIPTEN__)
void
GL3LoadTestSample::loadMesh(std::string filename,
glMeshLoader::MeshBuffer& meshBuffer,
std::vector<glMeshLoader::VertexLayout> vertexLayout,
float scale)
{
// Emscripten assimp port not yet available.
GLMeshLoader *mesh = new GLMeshLoader();

mesh->LoadMesh(filename);
Expand All @@ -262,4 +264,15 @@ GL3LoadTestSample::loadMesh(std::string filename,

delete(mesh);
}
#else
void
GL3LoadTestSample::loadMesh(std::string,
glMeshLoader::MeshBuffer&,
std::vector<glMeshLoader::VertexLayout>,
float)
{
}
#endif



7 changes: 7 additions & 0 deletions tests/loadtests/glloadtests/utils/GLMeshLoader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@
#else
#endif

// Emscripten assimp port not yet available.
#if !defined(__EMSCRIPTEN__)
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#endif

#include "disable_glm_warnings.h"
#include <glm/glm.hpp>
Expand Down Expand Up @@ -88,6 +91,7 @@ namespace glMeshLoader
}
};

#if !defined(__EMSCRIPTEN__)
// Get vertex size from vertex layout
static uint32_t vertexSize(std::vector<glMeshLoader::VertexLayout> layout)
{
Expand All @@ -106,8 +110,10 @@ namespace glMeshLoader
}
return vSize;
}
#endif
}

#if !defined(__EMSCRIPTEN__)
// Simple mesh class for getting all the necessary stuff from models
// loaded via ASSIMP.
class GLMeshLoader {
Expand Down Expand Up @@ -506,4 +512,5 @@ class GLMeshLoader {
glBindVertexArray(0);
}
};
#endif // !defined(__EMSCRIPTEN__)

0 comments on commit cdde9d3

Please sign in to comment.