Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
glitchheart
glitchheartengine
Commits
ae581b98
Commit
ae581b98
authored
Jul 09, 2019
by
Daniel Bross
😽
Browse files
Finally partially fixed MacOS stalls.
Former-commit-id:
2f3bed52
parents
182dc5dd
8b8deb1d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
23 deletions
+41
-23
src/assimp_loader.cpp
src/assimp_loader.cpp
+31
-17
src/main.cpp
src/main.cpp
+5
-6
src/opengl_rendering.cpp
src/opengl_rendering.cpp
+5
-0
No files found.
src/assimp_loader.cpp
View file @
ae581b98
#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
*
fil
e
)
void
print_node
(
aiNode
*
node
,
const
aiScene
*
scen
e
)
{
// 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
;
}
src/main.cpp
View file @
ae581b98
...
...
@@ -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
);
...
...
src/opengl_rendering.cpp
View file @
ae581b98
...
...
@@ -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
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment