summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-07-22 00:19:58 +1000
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-07-22 00:19:58 +1000
commit4f09bcb7dc48dc9b0d97ce3a9f73ffc6eee49045 (patch)
treee94bb84660061941c12eb25455a1a855649416a7 /examples
parentda1ddc29ac15e511086b8b5343b735a34be1fcea (diff)
error handling loading pbr textures
Diffstat (limited to 'examples')
-rw-r--r--examples/game_demo/game_demo.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/examples/game_demo/game_demo.c b/examples/game_demo/game_demo.c
index 7f3496a..9688808 100644
--- a/examples/game_demo/game_demo.c
+++ b/examples/game_demo/game_demo.c
@@ -8,6 +8,7 @@
#include "core.h"
#include "input.h"
#include "keys.h"
+#include "loaders.h"
#include "maths.h"
#include "primitives.h"
#include "ral_types.h"
@@ -32,8 +33,8 @@ int main() {
// TODO: Move camera with model
// --- Render Scene
- Vec3 camera_pos = vec3(-8.0, 10.0, 0.);
- Camera cam = Camera_Create(camera_pos, vec3_normalise(vec3_negate(camera_pos)), VEC3_Y, 45.0);
+ Vec3 camera_pos = vec3(0.0, 1.3, 3.0);
+ Camera cam = Camera_Create(camera_pos, VEC3_NEG_Z, VEC3_Y, 45.0);
SetCamera(cam); // update the camera in RenderScene
DirectionalLight sun = {
@@ -72,11 +73,19 @@ int main() {
.pbr_normal_map = normal_map,
.pbr_ao_map = ao_map };
+ // ModelHandle cube_handle = ModelLoad_gltf("assets/models/gltf/Cube/glTF/Cube.gltf", false);
+ ModelHandle cube_handle = ModelLoad_gltf("../../assets/prototyper/prototyper_m.gltf", false);
+ Model* Cube = MODEL_GET(cube_handle);
+ RenderEnt cube_r = { .mesh = &Cube->meshes->data[0],
+ .material = &Cube->materials->data[0],
+ .affine = mat4_ident(),
+ .casts_shadows = true };
+
RenderEnt crate_renderable = {
.mesh = &crate_mesh, .material = &crate_mat, .affine = mat4_scale(3.0), .casts_shadows = true
};
- RenderEnt entities[] = { crate_renderable };
+ RenderEnt entities[] = { cube_r, crate_renderable };
size_t entity_count = 1;
// --- Transforms
@@ -84,10 +93,6 @@ int main() {
// TODO: parent camera to model - to start with I can just manually update it every frame
// TODO: query joints of the gltf to get the hand bone to parent a sword to
- // RenderEnt player_r = { .model = player_model, .affine = mat4_ident(), .casts_shadows = true };
-
- // RenderEnt entities[] = { player_r };
-
bool draw_debug = true;
while (!ShouldExit()) {
@@ -103,7 +108,6 @@ int main() {
Shadow_Run(entities, entity_count);
- /*
if (draw_debug) {
// draw the player model with shadows
Render_RenderEntities(entities, entity_count);
@@ -112,7 +116,7 @@ int main() {
} else {
Shadow_DrawDebugQuad();
}
- */
+
Terrain_Draw(terrain);
// END Draw calls