Editing the modelimporter to allow to create scene graphs

This commit is contained in:
2022-07-08 21:35:14 +02:00
parent 85f9c78adf
commit b7e3465406
19 changed files with 241 additions and 256 deletions

View File

@ -11,11 +11,11 @@ Camera* cam;
Shader* shader;
Renderable* Cube;
BarinkEngine::Renderable* Cube;
Material* matCube;
Texture* textureCube;
Renderable* Cube2;
BarinkEngine::Renderable* Cube2;
Material* matCube2;
char* code = new char[254];
@ -26,35 +26,15 @@ const std::string fragmentShaderSource = "build/SandboxApplication/Debug/test.fs
/*
* Runs once at startup
* - USe to initialize the game/sandbox/demo
*/
void Start() {
/*
Building a very basic scene graph
*/
SceneNode MyCube = SceneNode();
MyCube.name = "MyCube";
SceneNode MyBaby = SceneNode();
MyBaby.name = "Baby";
SceneNode MySecondCube = SceneNode();
MySecondCube.name = "MySecondCube";
MyCube.addChild(MyBaby);
Scene scene = Scene("My awesome Game Scene");
scene.GetRoot().addChild(MyCube);
scene.GetRoot().addChild(MySecondCube);
// Walk scene graph
PrintSceneTree(scene.GetRoot(),0);
// Walk scene graph
//PrintSceneTree(scene.GetRoot(),0);
shader = new Shader(vertexShaderSource, fragmentShaderSource);
@ -69,7 +49,7 @@ void Start() {
/*
* load meshes
*/
Cube = Renderable::Load();
Cube =
Cube2 = Renderable::Load();
Cube->addChild(*Cube2);

View File

@ -1,6 +1,6 @@
#include "Util.h"
void PrintSceneTree(SceneNode& node, int depth) {
void PrintSceneTree(Node& node, int depth) {
// Indent name based on depth
std::cout << " ";
for (int i = 0; i < depth; i++) {

View File

@ -1,6 +1,6 @@
#pragma once
#include "BarinkEngine.h"
void PrintSceneTree(SceneNode& node, int depth);
void PrintSceneTree(Node& node, int depth);
glm::mat4 CalculateModelMat(Transform& transform);