Moving vegetation test to the renderer

This commit is contained in:
2023-01-04 15:57:08 +01:00
parent 0f9be33bd6
commit d5a6ddb9d5
9 changed files with 185 additions and 34 deletions

View File

@ -14,7 +14,6 @@
#include "SceneSerializer.h"
#include "AssetManagement/AssetManager.h"
#include "UI/MainMenuBar.h"
const unsigned int MS_PER_UPDATE = 2;
void CreateTestProject(std::unique_ptr<Project>& project, Scene& scene);
RendererConfig EditorSceneRendererConfig{
@ -25,7 +24,7 @@ RendererConfig EditorSceneRendererConfig{
};
glm::vec3 temp = glm::vec3(0);
Camera cam = Camera(glm::vec3(12.0f, 1.0f, 0.0f), glm::vec3(45.0f, 0.0f, 0.0f), 90);
Camera cam = Camera(glm::vec3(14.0f, 1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 0.0f), 90);
class Editor : public Application {
public:
Editor()
@ -120,7 +119,11 @@ public:
// Create the physics engine demo!
Physics Physics;
//Physics.Demo();
Physics.Demo();
/*Physics.EnableDebugVisuals();
Physics.Step(0);
Physics.SubmitMesh();
*/
double previous = glfwGetTime();
double lag = 0.0;
@ -134,21 +137,12 @@ public:
AppWindow.Poll();
if (SimulatePhysics)
{
Physics.Step(1.0f / 60.0f);
}
while (lag >= MS_PER_UPDATE)
{
ActiveScene.Update();
lag -= MS_PER_UPDATE;
}
Physics.Step(elapsed);
ActiveScene.Update();
RenderScene();
/*Physics.DebugRender(*framebuffer);*/
RenderEditorGUI();
@ -173,7 +167,7 @@ private:
GUIRenderer EditorGUIRenderer;
// Editor State
bool SimulatePhysics = false;
bool SimulatePhysics = true;
entt::entity Selected;
std::unique_ptr<Project> CurrentProject;
@ -218,10 +212,11 @@ void CreateTestProject(std::unique_ptr<Project>& project, Scene& scene ) {
auto cube2 = scene.AddEntity("Cube2");
auto& rendercube2 = cube2.AddComponent<Render3DComponent>();
rendercube2.mesh = *(model->renderable->mesh);
auto relationcube = cube.AddComponent<RelationComponent>(cube2);
auto Grass = scene.AddEntity("Grass/Window-Pane");
//auto& renderGrass = Grass.AddComponent<Render3DComponent>();
}