From a68d31f31941bb9fc492c738c8267996f3d73d9d Mon Sep 17 00:00:00 2001 From: J3oss Date: Mon, 14 Jun 2021 02:36:17 +0200 Subject: [PATCH] added Materials and pipelines to scene JSON Co-Authored-By: Robear Selwans --- res/project/res/scenes/MainScene.evsc | 40 ++++++++++++++++++++++++++- res/project/res/scenes/SideScene.evsc | 38 +++++++++++++++++++++++++ res/project/res/scenes/TestScene.evsc | 38 +++++++++++++++++++++++++ src/main.c | 5 ++-- 4 files changed, 117 insertions(+), 4 deletions(-) diff --git a/res/project/res/scenes/MainScene.evsc b/res/project/res/scenes/MainScene.evsc index 8a708f2..abad1fa 100644 --- a/res/project/res/scenes/MainScene.evsc +++ b/res/project/res/scenes/MainScene.evsc @@ -6,7 +6,7 @@ "components": [ { "type": "TransformComponent", - "position": [0.0, 0.0, 5.0], + "position": [0.0, -2.0, -11.0], "rotation": [0.0, 0.0, 0.0], "scale": [1.0, 1.0, 1.0] }, @@ -243,5 +243,43 @@ ] } ], + "materials": [ + { + "id": "GreenMaterial", + "pipeline": "DefaultPipeline", + "baseColor": [0.0, 1.0, 0.0, 1.0] + }, + { + "id": "RedMaterial", + "pipeline": "DefaultPipeline", + "baseColor": [1.0, 0.0, 0.0, 1.0] + }, + { + "id": "BlueMaterial", + "pipeline": "DefaultPipeline", + "baseColor": [0.0, 0.0, 1.0, 1.0] + }, + { + "id": "WhiteMaterial", + "pipeline": "DefaultPipeline", + "baseColor": [1.0, 1.0, 0.0, 1.0] + }, + ], + + "pipelines": [ + { + "id": "DefaultPipeline", + "shaderStages": [ + { + "type": "Vertex", + "shaderPath": "shaders://default.vert" + }, + { + "type": "Fragment", + "shaderPath": "shaders://default.frag" + } + ] + } + ], "activeCamera": "Camera.RotationHelper" } diff --git a/res/project/res/scenes/SideScene.evsc b/res/project/res/scenes/SideScene.evsc index 19c7af6..bd5cdac 100644 --- a/res/project/res/scenes/SideScene.evsc +++ b/res/project/res/scenes/SideScene.evsc @@ -128,5 +128,43 @@ ] } ], + "materials": [ + { + "id": "GreenMaterial", + "pipeline": "DefaultPipeline", + "baseColor": [0.0, 1.0, 0.0, 1.0] + }, + { + "id": "RedMaterial", + "pipeline": "DefaultPipeline", + "baseColor": [1.0, 0.0, 0.0, 1.0] + }, + { + "id": "BlueMaterial", + "pipeline": "DefaultPipeline", + "baseColor": [0.0, 0.0, 1.0, 1.0] + }, + { + "id": "WhiteMaterial", + "pipeline": "DefaultPipeline", + "baseColor": [1.0, 1.0, 0.0, 1.0] + }, + ], + + "pipelines": [ + { + "id": "DefaultPipeline", + "shaderStages": [ + { + "type": "Vertex", + "shaderPath": "shaders://default.vert" + }, + { + "type": "Fragment", + "shaderPath": "shaders://default.frag" + } + ] + } + ], "activeCamera": "Camera" } diff --git a/res/project/res/scenes/TestScene.evsc b/res/project/res/scenes/TestScene.evsc index 3d043c7..9a6054e 100644 --- a/res/project/res/scenes/TestScene.evsc +++ b/res/project/res/scenes/TestScene.evsc @@ -1459,5 +1459,43 @@ ] } ], + "materials": [ + { + "id": "GreenMaterial", + "pipeline": "DefaultPipeline", + "baseColor": [0.0, 1.0, 0.0, 1.0] + }, + { + "id": "RedMaterial", + "pipeline": "DefaultPipeline", + "baseColor": [1.0, 0.0, 0.0, 1.0] + }, + { + "id": "BlueMaterial", + "pipeline": "DefaultPipeline", + "baseColor": [0.0, 0.0, 1.0, 1.0] + }, + { + "id": "WhiteMaterial", + "pipeline": "DefaultPipeline", + "baseColor": [1.0, 1.0, 0.0, 1.0] + }, + ], + + "pipelines": [ + { + "id": "DefaultPipeline", + "shaderStages": [ + { + "type": "Vertex", + "shaderPath": "shaders://default.vert" + }, + { + "type": "Fragment", + "shaderPath": "shaders://default.frag" + } + ] + } + ], "activeCamera": "CameraTransformOverride.Camera.RotationHelper", } diff --git a/src/main.c b/src/main.c index b58a0eb..c2a1e41 100644 --- a/src/main.c +++ b/src/main.c @@ -181,6 +181,7 @@ load_project() evstring_free(path_id); } + Renderer->setWindow((GenericHandle)State.window); // Loading Scenes double scene_count = evjs_get(project_desc.json_data, "scenes.len")->as_num; @@ -205,17 +206,15 @@ load_project() } evstring_free(project_dir); - Renderer->setWindow((GenericHandle)State.window); - } void unload_project() { + evol_unloadmodule(State.renderer_mod); evol_unloadmodule(State.game_mod); evol_unloadmodule(State.input_mod); evol_unloadmodule(State.window_mod); - evol_unloadmodule(State.renderer_mod); } int main(int argc, char **argv)