Files
Modularity/src/SceneObject.h

109 lines
2.7 KiB
C++

#pragma once
#include "Common.h"
enum class ObjectType {
Cube,
Sphere,
Capsule,
OBJMesh,
Model, // New type for Assimp-loaded models (FBX, GLTF, etc.)
DirectionalLight,
PointLight,
SpotLight,
AreaLight,
Camera,
PostFXNode
};
struct MaterialProperties {
glm::vec3 color = glm::vec3(1.0f);
float ambientStrength = 0.2f;
float specularStrength = 0.5f;
float shininess = 32.0f;
float textureMix = 0.3f; // Blend factor between albedo and overlay
};
enum class LightType {
Directional = 0,
Point = 1,
Spot = 2,
Area = 3
};
struct LightComponent {
LightType type = LightType::Point;
glm::vec3 color = glm::vec3(1.0f);
float intensity = 1.0f;
float range = 10.0f;
// Spot
float innerAngle = 15.0f;
float outerAngle = 25.0f;
// Area (rect) size in world units
glm::vec2 size = glm::vec2(1.0f, 1.0f);
bool enabled = true;
};
enum class SceneCameraType {
Scene = 0,
Player = 1
};
struct CameraComponent {
SceneCameraType type = SceneCameraType::Scene;
float fov = FOV;
float nearClip = NEAR_PLANE;
float farClip = FAR_PLANE;
};
struct PostFXSettings {
bool enabled = true;
bool bloomEnabled = true;
float bloomThreshold = 1.1f;
float bloomIntensity = 0.8f;
float bloomRadius = 1.5f;
bool colorAdjustEnabled = false;
float exposure = 0.0f; // in EV stops
float contrast = 1.0f;
float saturation = 1.0f;
glm::vec3 colorFilter = glm::vec3(1.0f);
bool motionBlurEnabled = false;
float motionBlurStrength = 0.15f; // 0..1 blend with previous frame
};
enum class ConsoleMessageType {
Info,
Warning,
Error,
Success
};
class SceneObject {
public:
std::string name;
ObjectType type;
glm::vec3 position;
glm::vec3 rotation;
glm::vec3 scale;
int id;
int parentId = -1;
std::vector<int> childIds;
bool isExpanded = true;
std::string meshPath; // Path to imported model file
int meshId = -1; // Index into loaded mesh caches (OBJLoader / ModelLoader)
MaterialProperties material;
std::string materialPath; // Optional external material asset
std::string albedoTexturePath;
std::string overlayTexturePath;
std::string normalMapPath;
std::string vertexShaderPath;
std::string fragmentShaderPath;
bool useOverlay = false;
LightComponent light; // Only used when type is a light
CameraComponent camera; // Only used when type is camera
PostFXSettings postFx; // Only used when type is PostFXNode
SceneObject(const std::string& name, ObjectType type, int id)
: name(name), type(type), position(0.0f), rotation(0.0f), scale(1.0f), id(id) {}
};