Skip to content
Snippets Groups Projects
Commit ef4888f9 authored by BATON Theau's avatar BATON Theau
Browse files

Write spawn method

parent 7be23643
No related branches found
No related tags found
No related merge requests found
......@@ -4,5 +4,5 @@ Size=400,400
[Window][Particle Generator]
Pos=60,60
Size=533,291
Size=838,505
#include "SceneParticle.hpp"
#include "../../Scene/Scene.hpp"
#include <imgui.h>
namespace pg::interface {
......@@ -7,6 +9,7 @@ namespace pg::interface {
: _scene(scene) {}
void SceneParticle::draw(double) {
ImGui::Text("Particule Number : %i / %i", this->_scene->_particles.size(), this->_scene->_max);
ImGui::Text("Scene Particle Interface !");
}
}
\ No newline at end of file
......@@ -14,7 +14,6 @@ namespace pg::scene {
_meshPosition(0.f),
_meshRotation(0.f),
_generators(),
_particles(),
_billboard(),
_billboardTexture(),
_billboardProgram(),
......
......@@ -20,7 +20,6 @@ namespace pg::scene {
glm::vec3 _meshRotation;
std::vector<PhysicsParticleGenerator> _generators;
std::vector<std::unique_ptr<Particle>> _particles;
Billboard _billboard;
Material _billboardTexture;
Program _billboardProgram;
......
......@@ -11,7 +11,6 @@ namespace pg::scene {
_texture(),
_generator(generator, ctrlpoint),
_trajectory(&this->_generator),
_particles(),
_interface(this, &this->_generator) {}
void Path::initialize() {
......@@ -63,8 +62,7 @@ namespace pg::scene {
if(duration_cast<std::chrono::milliseconds>(end - start).count() >= 500) {
start = std::chrono::high_resolution_clock::now();
if((5 + this->_particles.size() <= 1024) && true) {
std::vector<std::unique_ptr<pg::Particle>> newParticles = this->_generator.generate(5, static_cast<size_t>(current_time));
this->_particles.insert(this->_particles.begin(), std::make_move_iterator(newParticles.begin()), std::make_move_iterator(newParticles.end()));
this->spawn(5, current_time);
}
}
......@@ -126,6 +124,7 @@ namespace pg::scene {
}
void Path::spawn(size_t count, double current_time) {
std::vector<std::unique_ptr<pg::Particle>> newParticles = this->_generator.generate(count, static_cast<size_t>(current_time));
this->_particles.insert(this->_particles.begin(), std::make_move_iterator(newParticles.begin()), std::make_move_iterator(newParticles.end()));
}
}
\ No newline at end of file
......@@ -19,7 +19,6 @@ namespace pg::scene {
Trajectory _trajectory;
Material _texture;
PathParticleGenerator _generator;
std::vector<std::unique_ptr<Particle>> _particles;
interface::Path _interface;
......
......@@ -10,7 +10,6 @@ namespace pg::scene {
_program(),
_texture(),
_generator(),
_particles(),
_interface(this, &this->_generator) {}
void Physic::initialize() {
......@@ -59,8 +58,7 @@ namespace pg::scene {
if(duration_cast<std::chrono::milliseconds>(end - start).count() >= 500) {
start = std::chrono::high_resolution_clock::now();
if((5 + this->_particles.size()) <= 1024 && true) {
std::vector<std::unique_ptr<pg::Particle>> newParticles = this->_generator.generate(5, static_cast<size_t>(current_time));
this->_particles.insert(this->_particles.begin(), std::make_move_iterator(newParticles.begin()), std::make_move_iterator(newParticles.end()));
this->spawn(5, current_time);
}
}
......@@ -120,6 +118,7 @@ namespace pg::scene {
}
void Physic::spawn(size_t count, double current_time) {
std::vector<std::unique_ptr<pg::Particle>> newParticles = this->_generator.generate(count, static_cast<size_t>(current_time));
this->_particles.insert(this->_particles.begin(), std::make_move_iterator(newParticles.begin()), std::make_move_iterator(newParticles.end()));
}
}
\ No newline at end of file
......@@ -17,7 +17,6 @@ namespace pg::scene {
Material _texture;
Billboard _billboards;
PhysicsParticleGenerator _generator;
std::vector<std::unique_ptr<Particle>> _particles;
interface::Physic _interface;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment