61 lines
2.2 KiB
C++
61 lines
2.2 KiB
C++
#pragma once
|
|
#include "hd2d/Billboard.h"
|
|
#include "hd2d/GroundOcclusion.h"
|
|
#include "hd2d/Model.h"
|
|
#include "hd2d/Particles.h"
|
|
#include "hd2d/Terrain.h"
|
|
#include "hd2d/Water.h"
|
|
|
|
#include <glm/glm.hpp>
|
|
#include <vector>
|
|
|
|
namespace hd2d {
|
|
|
|
struct PointLight {
|
|
glm::vec3 position{0.0f};
|
|
float radius = 3.0f;
|
|
glm::vec3 color{1.0f}; // linear HDR
|
|
};
|
|
|
|
struct Sun {
|
|
float azimuth = -0.6f; // radians, rotation around Y (0 = toward -Z, the default view direction)
|
|
float elevation = 0.66f; // radians above horizon
|
|
glm::vec3 color{1.0f, 0.86f, 0.66f};
|
|
float intensity = 3.2f;
|
|
glm::vec3 direction() const; // unit vector pointing toward the sun
|
|
};
|
|
|
|
struct Sky {
|
|
glm::vec3 zenith{0.22f, 0.42f, 0.78f};
|
|
glm::vec3 horizon{0.70f, 0.76f, 0.80f};
|
|
glm::vec3 ground{0.20f, 0.24f, 0.14f}; // bounce light from below
|
|
float ambient = 0.55f;
|
|
float fill = 0.35f; // light from the camera side onto faces turned toward the viewer
|
|
};
|
|
|
|
// Everything the renderer draws. Pointers are non-owning; null entries skip.
|
|
struct Scene {
|
|
Terrain* terrain = nullptr;
|
|
Water* water = nullptr;
|
|
ParticleSystem* particles = nullptr;
|
|
std::vector<BillboardBatch*> billboards; // pixel-art sprites (characters, small props)
|
|
std::vector<ModelBatch*> models; // 3D scenery (trees, bushes, rocks, bridge)
|
|
const GroundOcclusion* groundOcclusion = nullptr; // baked contact AO under scenery
|
|
std::vector<PointLight> lights;
|
|
int volumetricLights = 0; // the first N lights also scatter in the fog (e.g. fires)
|
|
Sun sun;
|
|
Sky sky;
|
|
glm::vec3 focusPoint{0.0f}; // depth-of-field focus (usually the player)
|
|
glm::vec3 interactor{0.0f}; // pushes foliage aside (usually the player)
|
|
float interactorRadius = 1.1f;
|
|
glm::vec3 blobShadowPos{0.0f}; // soft contact shadow under the player
|
|
float blobShadowRadius = 0.0f; // 0 disables
|
|
|
|
// Precipitation, usually driven by Weather.
|
|
float rain = 0.0f; // 0..1: rain streaks, water ripples, overcast sky
|
|
float wetness = 0.0f; // 0..1: darker, glossy surfaces (lags behind `rain`)
|
|
float rainSpeed = 15.0f; // drop fall speed (world units / s)
|
|
};
|
|
|
|
} // namespace hd2d
|