From 9defe9d1c211bcf91ceb6d23b15139dba77a023f Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 20 Dec 2023 09:54:01 +0100 Subject: [PATCH] MeshInstance test setup. --- game_scene.cpp | 24 ++++++++++++++++++------ game_scene.h | 2 ++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/game_scene.cpp b/game_scene.cpp index 42feb49..b9b291c 100644 --- a/game_scene.cpp +++ b/game_scene.cpp @@ -100,20 +100,21 @@ void GameScene::render() { glClear(GL_COLOR_BUFFER_BIT); static float rot = 0; - camera->camera_transform.basis = Basis(Vector3(0, 1, 0), rot); - rot += 0.01; camera->bind(); //tile_map->render(); - //sprite->render(); - //material->bind(); - color_material->bind(); - mesh->render(); + //color_material->bind(); + //mesh->render(); + + static float rotmi = 0; + mi->transform.basis = Basis(Vector3(1, 0, 0), rotmi); + rotmi += 0.01; + mi->render(); //sprite->render(); } @@ -190,6 +191,17 @@ GameScene::GameScene() { MeshUtils::create_cone(mesh); mesh->upload(); + mi = memnew(MeshInstance()); + mi->material = color_material; + mi->mesh = mesh; + + mi2 = memnew(MeshInstance()); + mi2->material = color_material; + mi2->mesh = mesh; + mi2->transform.origin.x = 1; + + mi->children.push_back(mi2); + //float width = 1; //float height = 1; diff --git a/game_scene.h b/game_scene.h index 4d1504f..f6994fa 100644 --- a/game_scene.h +++ b/game_scene.h @@ -44,6 +44,8 @@ public: Camera *camera; Mesh *mesh; + MeshInstance *mi; + MeshInstance *mi2; ColorMaterial *color_material; //ColoredMaterial *cmaterial;