mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add ParticlesPreset
This commit is contained in:
parent
83ddbda90b
commit
9728c674fc
5 changed files with 47 additions and 14 deletions
|
|
@ -35,12 +35,12 @@ ParticlesRenderer::~ParticlesRenderer() = default;
|
|||
static inline void update_particle(
|
||||
Particle& particle, float delta, const Chunks& chunks
|
||||
) {
|
||||
const auto& behave = particle.emitter->behaviour;
|
||||
const auto& preset = particle.emitter->preset;
|
||||
auto& pos = particle.position;
|
||||
auto& vel = particle.velocity;
|
||||
|
||||
vel += delta * behave.gravity;
|
||||
if (behave.collision && chunks.isObstacleAt(pos + vel * delta)) {
|
||||
vel += delta * preset.acceleration;
|
||||
if (preset.collision && chunks.isObstacleAt(pos + vel * delta)) {
|
||||
vel *= 0.0f;
|
||||
}
|
||||
pos += vel * delta;
|
||||
|
|
@ -72,7 +72,7 @@ void ParticlesRenderer::renderParticles(const Camera& camera, float delta) {
|
|||
update_particle(particle, delta, chunks);
|
||||
|
||||
glm::vec4 light(1, 1, 1, 0);
|
||||
if (particle.emitter->behaviour.lighting) {
|
||||
if (particle.emitter->preset.lighting) {
|
||||
light = MainBatch::sampleLight(
|
||||
particle.position, chunks, backlight
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue