mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-19 14:39:18 +02:00
WIP
This commit is contained in:
@@ -8,10 +8,12 @@
|
||||
#include "glm/vec3.hpp"
|
||||
#include "glm/gtc/quaternion.hpp"
|
||||
#include "registry/FName.h"
|
||||
#include "utils/uuid.hpp"
|
||||
#include "utilities/uuid.hpp"
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
class TDynamicObject;
|
||||
|
||||
namespace ECSComponent
|
||||
{
|
||||
///< summary>
|
||||
@@ -45,6 +47,15 @@ struct Identification
|
||||
struct Parent
|
||||
{
|
||||
entt::entity value{entt::null};
|
||||
glm::dvec3 localOffset{0.0}; // position offset relative to parent
|
||||
glm::quat localRotation{1.f, 0.f, 0.f, 0.f}; // rotation relative to parent
|
||||
};
|
||||
|
||||
// Links an ECS entity to its corresponding simulation vehicle.
|
||||
// VehicleSyncSystem reads this to keep Transform in sync with vehicle world position.
|
||||
struct VehicleRef
|
||||
{
|
||||
TDynamicObject* vehicle = nullptr;
|
||||
};
|
||||
|
||||
struct SoundComponent
|
||||
|
||||
@@ -4,26 +4,23 @@
|
||||
#include "registry/FName.h"
|
||||
#include "rendering/geometrybank.h"
|
||||
|
||||
class TAnimModel;
|
||||
|
||||
namespace ECSComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Component for entities that can be rendered.
|
||||
/// </summary>
|
||||
/// <remarks>Currently empty
|
||||
/// TODO: Add component members
|
||||
/// </remarks>
|
||||
struct MeshRenderer
|
||||
{
|
||||
gfx::geometry_handle meshHandle;
|
||||
TAnimModel* modelInstance = nullptr;
|
||||
bool visible = true;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Component for entities that can cast shadows.
|
||||
/// </summary>
|
||||
/// <remarks>Currently empty
|
||||
/// TODO: Add component members
|
||||
/// </remarks>
|
||||
struct SpotLight
|
||||
{
|
||||
glm::vec3 Color{ 1.0f, 1.0f, 1.0f };
|
||||
@@ -38,16 +35,70 @@ struct SpotLight
|
||||
bool Enabled = true;
|
||||
};
|
||||
|
||||
// TODO: AreaLight like blender
|
||||
// TODO: SunLight for scene
|
||||
|
||||
|
||||
struct ParticleEmitter
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
struct AreaLight
|
||||
{
|
||||
FName particleEffectPath = ("");
|
||||
bool active = true;
|
||||
glm::vec3 Color{ 1.0f, 1.0f, 1.0f };
|
||||
float Intensity = 1.0f;
|
||||
float Width = 1.0f;
|
||||
float Height = 1.0f;
|
||||
bool CastShadows = false;
|
||||
bool Enabled = true;
|
||||
};
|
||||
|
||||
struct SunLight
|
||||
{
|
||||
glm::vec3 Color{ 1.0f, 1.0f, 1.0f };
|
||||
float Intensity = 1.0f;
|
||||
bool CastShadows = false;
|
||||
bool Enabled = true;
|
||||
};
|
||||
|
||||
|
||||
struct Particle {
|
||||
glm::vec3 position;
|
||||
glm::vec3 velocity;
|
||||
glm::vec4 color;
|
||||
float size;
|
||||
float age;
|
||||
float maxAge;
|
||||
};
|
||||
|
||||
struct ParticleEmitter {
|
||||
|
||||
// --- Kontener i Stan ---
|
||||
std::vector<Particle> particles;
|
||||
uint32_t maxParticles = 1000;
|
||||
bool isActive = true;
|
||||
float spawnAccumulator = 0.0f;
|
||||
|
||||
// --- Konfiguracja Emisji ---
|
||||
float spawnRate = 20.0f; // cząstek na sekundę
|
||||
float particleLifetime = 2.0f; // bazowy czas życia
|
||||
glm::vec3 gravity{ 0.0f, 0.0f, 0.0f }; // np. dym: 0.5, deszcz: -9.81
|
||||
float airResistance = 0.1f; // tłumienie prędkości
|
||||
|
||||
// --- Zakresy (losowanie) ---
|
||||
glm::vec3 minStartVelocity{ -0.5f, 1.0f, -0.5f };
|
||||
glm::vec3 maxStartVelocity{ 0.5f, 2.0f, 0.5f };
|
||||
|
||||
// --- Ewolucja w czasie (Modyfikatory) ---
|
||||
float sizeGrowth = 0.5f; // zmiana rozmiaru na sekundę
|
||||
glm::vec4 colorFade = { 0.0f, 0.0f, 0.0f, -0.5f }; // np. znikanie (alpha)
|
||||
|
||||
// --- Pozycja emitera ---
|
||||
glm::vec3 emitterLocation{ 0.0f, 0.0f, 0.0f };
|
||||
|
||||
// --- Flag Funkcjonalnych ---
|
||||
bool hasCollision = false; // czy sprawdzać kolizje
|
||||
float bounceFactor = 0.3f; // energia po odbiciu (0.0 - 1.0)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Component for entities that can be rendered as decals (e.g. graffiti on wagons, dirties on wall).
|
||||
/// </summary>
|
||||
struct Decal
|
||||
{
|
||||
FName decalTexturePath = ("");
|
||||
@@ -55,6 +106,10 @@ struct Decal
|
||||
bool active = true;
|
||||
};
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Component for entities that can be rendered as billboards (e.g. particles, sprites).
|
||||
/// </summary>
|
||||
struct Billboard
|
||||
{
|
||||
FName texturePath = ("");
|
||||
@@ -62,6 +117,9 @@ struct Billboard
|
||||
bool active = true;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Component for entities that can be rendered as lines.
|
||||
/// </summary>
|
||||
struct Line {
|
||||
glm::vec3 start{ 0.0f };
|
||||
glm::vec3 end{ 1.0f, 0.0f, 0.0f };
|
||||
|
||||
Reference in New Issue
Block a user