mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add 'angle_spread' property
This commit is contained in:
parent
90b1f63406
commit
c6de7f62fe
5 changed files with 28 additions and 4 deletions
|
|
@ -23,8 +23,9 @@ Emitter::Emitter(
|
|||
texture(texture),
|
||||
count(count),
|
||||
preset(std::move(preset)) {
|
||||
random.setSeed(rand());
|
||||
this->prototype.emitter = this;
|
||||
timer = preset.spawnInterval;
|
||||
timer = preset.spawnInterval * random.randFloat();
|
||||
}
|
||||
|
||||
const Texture* Emitter::getTexture() const {
|
||||
|
|
@ -83,6 +84,10 @@ void Emitter::update(
|
|||
Particle particle = prototype;
|
||||
particle.emitter = this;
|
||||
particle.random = random.rand32();
|
||||
if (glm::abs(preset.angleSpread) >= 0.005f) {
|
||||
particle.angle =
|
||||
random.randFloat() * preset.angleSpread * glm::pi<float>() * 2;
|
||||
}
|
||||
|
||||
glm::vec3 spawnOffset = generate_coord(preset.spawnShape);
|
||||
spawnOffset *= preset.spawnSpread;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue