overhauled physics engine
This commit is contained in:
+24
-11
@@ -3,6 +3,7 @@
|
||||
#include "MinimalEngine.h"
|
||||
#include "Graphics/GraphicsResources.h"
|
||||
#include "Graphics/MeshBatch.h"
|
||||
#include "Physics/PhysicsSystem.h"
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
@@ -11,16 +12,16 @@ DECLARE_REF(Entity)
|
||||
|
||||
struct DirectionalLight
|
||||
{
|
||||
Math::Vector4 color;
|
||||
Math::Vector4 direction;
|
||||
Math::Vector4 intensity;
|
||||
Vector4 color;
|
||||
Vector4 direction;
|
||||
Vector4 intensity;
|
||||
};
|
||||
|
||||
struct PointLight
|
||||
{
|
||||
Math::Vector4 positionWS;
|
||||
Vector4 positionWS;
|
||||
//Vector4 positionVS;
|
||||
Math::Vector4 colorRange;
|
||||
Vector4 colorRange;
|
||||
};
|
||||
|
||||
#define MAX_DIRECTIONAL_LIGHTS 4
|
||||
@@ -38,17 +39,19 @@ class Scene
|
||||
public:
|
||||
Scene(Gfx::PGraphics graphics);
|
||||
~Scene();
|
||||
void start();
|
||||
void beginUpdate(double deltaTime);
|
||||
void commitUpdate();
|
||||
void update(float deltaTime);
|
||||
entt::entity createEntity()
|
||||
{
|
||||
return registry.create();
|
||||
}
|
||||
template<typename Component, typename... Args>
|
||||
Component& attachComponent(entt::entity entity, Args... args)
|
||||
void destroyEntity(entt::entity identifier)
|
||||
{
|
||||
return registry.emplace<Component>(entity, args...);
|
||||
registry.destroy(identifier);
|
||||
}
|
||||
template<typename Component, typename... Args>
|
||||
Component& attachComponent(entt::entity entity, Args&&... args)
|
||||
{
|
||||
return registry.emplace<Component>(entity, std::forward<Args>(args)...);
|
||||
}
|
||||
template<typename Component>
|
||||
Component& accessComponent(entt::entity entity)
|
||||
@@ -62,9 +65,19 @@ public:
|
||||
}
|
||||
Array<StaticMeshBatch> getStaticMeshes();
|
||||
LightEnv getLightBuffer() const;
|
||||
Gfx::PStructuredBuffer getSceneDataBuffer() const { return sceneDataBuffer; }
|
||||
|
||||
entt::registry registry;
|
||||
private:
|
||||
struct PrimitiveSceneData
|
||||
{
|
||||
Matrix4 localToWorld;
|
||||
Matrix4 worldToLocal;
|
||||
Vector4 actorLocation;
|
||||
};
|
||||
Array<PrimitiveSceneData> sceneData;
|
||||
Gfx::PStructuredBuffer sceneDataBuffer;
|
||||
PhysicsSystem physics;
|
||||
Gfx::PGraphics graphics;
|
||||
};
|
||||
DEFINE_REF(Scene)
|
||||
|
||||
Reference in New Issue
Block a user