Adding basic impl of Jolt
Update positions on 60tps, position of objects can be modified while physic simulation is running. Position is owned by transform comps but the truth is held by the physics engine for affected entities
This commit is contained in:
@@ -3,9 +3,15 @@
|
||||
|
||||
#include <open_engine.hpp>
|
||||
|
||||
#include "open_engine/renderer/renderer3d.hpp"
|
||||
#include "open_engine/scene/components.hpp"
|
||||
#include "panels/content_browser.hpp"
|
||||
#include "panels/scene_hierarchy.hpp"
|
||||
|
||||
#include <Jolt/Physics/Collision/Shape/Shape.h>
|
||||
#include <Jolt/Math/Real.h>
|
||||
#include <Jolt/Math/Vec3.h>
|
||||
#include <Jolt/Physics/Body/BodyCreationSettings.h>
|
||||
#include <glm/ext/matrix_transform.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
#include <glm/matrix.hpp>
|
||||
@@ -95,12 +101,12 @@ namespace OpenEngine {
|
||||
// =============================================
|
||||
Entity cube = scene->CreateEntity("cube");
|
||||
|
||||
|
||||
cube.AddComponent<TransformComponent>();
|
||||
auto& tc = cube.AddComponent<TransformComponent>();
|
||||
|
||||
Ref<Mesh> mesh = CreateCube(cube);
|
||||
|
||||
cube.AddComponent<MeshComponent>(mesh);
|
||||
auto& mc = cube.AddComponent<MeshComponent>(mesh);
|
||||
mc.primitive_type = PrimitiveType::Cube;
|
||||
|
||||
// =============================================
|
||||
Entity quad = scene->CreateEntity("quad");
|
||||
@@ -109,7 +115,8 @@ namespace OpenEngine {
|
||||
|
||||
Ref<Mesh> quad_mesh = CreateQuad(quad, true);
|
||||
|
||||
quad.AddComponent<MeshComponent>(quad_mesh);
|
||||
auto& mc3 = quad.AddComponent<MeshComponent>(quad_mesh);
|
||||
mc3.primitive_type = PrimitiveType::Quad;
|
||||
|
||||
// =============================================
|
||||
Entity cube2 = scene->CreateEntity("cube2");
|
||||
@@ -118,7 +125,8 @@ namespace OpenEngine {
|
||||
|
||||
Ref<Mesh> mesh2 = CreateCube(cube2);
|
||||
|
||||
cube2.AddComponent<MeshComponent>(mesh2);
|
||||
auto& mc2 = cube2.AddComponent<MeshComponent>(mesh2);
|
||||
mc2.primitive_type = PrimitiveType::Cube;
|
||||
|
||||
/*
|
||||
auto view = scene->GetRegistry().view<TagComponent>();
|
||||
@@ -562,10 +570,12 @@ namespace OpenEngine {
|
||||
void OnScenePlay()
|
||||
{
|
||||
state = PlayState::Play;
|
||||
scene->OnRuntimeStart();
|
||||
}
|
||||
void OnSceneStop()
|
||||
{
|
||||
state = PlayState::Edit;
|
||||
scene->OnRuntimeStop();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user