Commit 2f3bed52 authored by Daniel Bross's avatar Daniel Bross 😽
Browse files

Finally partially fixed MacOS stalls.

parents 0a770978 12abe496
#include <assimp/cimport.h> // Plain-C interface
#include <assimp/scene.h> // Output data structure
#include <assimp/postprocess.h> // Post processing flags
#include <assimp/cimport.h>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
bool import_file(char* file)
void print_node(aiNode *node, const aiScene *scene)
{
// Start the import on the given file with some example postprocessing
// Usually - if speed is not the most important aspect for you - you'll t
// probably to request more postprocessing than we do in this example.
const aiScene* scene = aiImportFile(file,
aiProcess_CalcTangentSpace |
aiProcess_Triangulate |
aiProcess_JoinIdenticalVertices |
aiProcess_SortByPType);
// If the import failed, report it
printf("Node: %s\n", node->mName.data);
for (i32 i = 0; i < node->mNumMeshes; i++)
{
const struct aiMesh* mesh = scene->mMeshes[node->mMeshes[i]];
printf("%d: %s\n", i, mesh->mName.data);
}
for(i32 i = 0; i < node->mNumChildren; i++)
{
print_node(node->mChildren[i], scene);
}
}
// Currently loads any model file and prints all node- and mesh-name
b32 load_model_file(char* file_path)
{
const aiScene* scene = aiImportFile(file_path, aiProcess_CalcTangentSpace |
aiProcess_Triangulate |
aiProcess_JoinIdenticalVertices |
aiProcess_SortByPType);
if(!scene)
{
printf("%s\n", aiGetErrorString());
return false;
}
aiNode *root_node = scene->mRootNode;
print_node(root_node, scene);
// Now we can access the file's contents
//DoTheSceneProcessing( scene);
// We're done. Release all resources associated with this import
aiReleaseImport( scene);
aiReleaseImport(scene);
return true;
}
......@@ -3,8 +3,6 @@
#define VC_EXTRA_LEAN
#endif
#include "assimp_loader.cpp"
#include "imgui/imgui.h"
#include "shared.h"
......@@ -62,6 +60,7 @@ static MemoryState memory_state;
#include "fmod_sound.cpp"
#include "filehandling.h"
#include "assimp_loader.cpp"
#include "shader_loader.cpp"
#include "render_pipeline.cpp"
#include "rendering.cpp"
......@@ -863,10 +862,10 @@ int main(int argc, char **args)
init_renderer(game, renderer, &reload_queue, &reload_thread, particle_api);
// if(import_file("../assets/models/arrow.obj"))
// {
// printf("Arrow loaded successfuly!\n");
// }
if(load_model_file("../assets/models/arrow.obj"))
{
printf("Arrow loaded successfuly!\n");
}
scene::SceneManager *scene_manager = scene::create_scene_manager(&platform_state->perm_arena, renderer);
......
......@@ -2992,6 +2992,11 @@ static void render_all_passes(RenderState &render_state, Renderer *renderer)
static void swap_buffers(RenderState &render_state)
{
// @Note(Daniel): Temporary fix for MacOS
#if __APPLE__
glFinish();
#endif
glfwSwapBuffers(render_state.window);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment