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

Add multy pargGenerator Scene

parent f08c6bb1
No related branches found
No related tags found
No related merge requests found
Showing
with 475 additions and 42 deletions
...@@ -3,8 +3,9 @@ Pos=60,60 ...@@ -3,8 +3,9 @@ Pos=60,60
Size=400,400 Size=400,400
[Window][Dear ImGui Demo] [Window][Dear ImGui Demo]
Pos=650,20 Pos=926,43
Size=550,680 Size=550,680
Collapsed=1
[Window][Particle Generator] [Window][Particle Generator]
Pos=60,60 Pos=60,60
......
#pragma once #pragma once
#include "PathUniqueGenerator.hpp" #include "PathGenerator.hpp"
#include <imgui.h> #include <imgui.h>
#include "../../Particle/generator/PathUniqueGenerator.hpp" #include "../../Particle/generator/PathGenerator.hpp"
namespace pg::interface { namespace pg::interface {
PathUniqueGenerator::PathUniqueGenerator(particle::PathUniqueGenerator * parent, scene::Trajectory * trajectory) PathGenerator::PathGenerator(particle::PathGenerator * parent, scene::Trajectory * trajectory)
: Generator(parent), : Generator(parent),
_trajectory(trajectory), _trajectory(trajectory),
_next(0.f, 0.f, 0.f), _next(0.f, 0.f, 0.f),
_index(0) {} _index(0) {}
void PathUniqueGenerator::draw(double current_time) { void PathGenerator::draw(double current_time) {
ImGui::Text("Physic generator at %f / %f / %f (x, y, z) - variation : %f.", this->parent()->m_position.x, this->parent()->m_position.y, this->parent()->m_position.z, this->parent()->m_positionVariation); ImGui::Text("Physic generator at %f / %f / %f (x, y, z) - variation : %f.", this->parent()->m_position.x, this->parent()->m_position.y, this->parent()->m_position.z, this->parent()->m_positionVariation);
ImGui::Text("Default u : %f", this->parent()->m_u); ImGui::Text("Default u : %f", this->parent()->m_u);
ImGui::Text("u increment : %f", this->parent()->m_increment); ImGui::Text("u increment : %f", this->parent()->m_increment);
......
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
#include <glm/vec3.hpp> #include <glm/vec3.hpp>
namespace pg::particle { namespace pg::particle {
class PathUniqueGenerator; class PathGenerator;
} }
namespace pg::interface { namespace pg::interface {
class PathUniqueGenerator : public Generator<particle::PathUniqueGenerator> { class PathGenerator : public Generator<particle::PathGenerator> {
private: private:
scene::Trajectory * _trajectory; scene::Trajectory * _trajectory;
...@@ -18,8 +18,8 @@ namespace pg::interface { ...@@ -18,8 +18,8 @@ namespace pg::interface {
int _index; int _index;
public: public:
PathUniqueGenerator(particle::PathUniqueGenerator *, scene::Trajectory * = nullptr); PathGenerator(particle::PathGenerator *, scene::Trajectory * = nullptr);
virtual ~PathUniqueGenerator() = default; virtual ~PathGenerator() = default;
void draw(double) override; void draw(double) override;
virtual inline std::string title() const {return "Path Generator Interface";} virtual inline std::string title() const {return "Path Generator Interface";}
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "../../tfd/tinyfiledialogs.h" #include "../../tfd/tinyfiledialogs.h"
namespace pg::interface { namespace pg::interface {
Path::Path(scene::Path * parent, particle::PathUniqueGenerator * generator, scene::Trajectory * trajectory) Path::Path(scene::Path * parent, particle::PathGenerator * generator, scene::Trajectory * trajectory)
: Scene(parent), SceneParticle(parent), _interface(generator, trajectory) {} : Scene(parent), SceneParticle(parent), _interface(generator, trajectory) {}
void Path::draw(double current_time) { void Path::draw(double current_time) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include "../Interface.hpp" #include "../Interface.hpp"
#include "SceneParticle.hpp" #include "SceneParticle.hpp"
#include "../Generator/PathUniqueGenerator.hpp" #include "../Generator/PathGenerator.hpp"
#include "../../Scene/Scenes/Trajectory.hpp" #include "../../Scene/Scenes/Trajectory.hpp"
#include <glm/vec4.hpp> #include <glm/vec4.hpp>
...@@ -15,10 +15,10 @@ namespace pg::scene { ...@@ -15,10 +15,10 @@ namespace pg::scene {
namespace pg::interface { namespace pg::interface {
class Path : public Scene<scene::Path>, public SceneParticle { class Path : public Scene<scene::Path>, public SceneParticle {
private: private:
PathUniqueGenerator _interface; PathGenerator _interface;
public: public:
Path(scene::Path *, particle::PathUniqueGenerator *, pg::scene::Trajectory * = nullptr); Path(scene::Path *, particle::PathGenerator *, pg::scene::Trajectory * = nullptr);
virtual ~Path() = default; virtual ~Path() = default;
virtual void draw(double); virtual void draw(double);
......
#include "PathGenerator.hpp"
namespace pg::particle {
PathGenerator::PathGenerator(const ct::Curve& controlPoints, const ct::Point& position, float positionVariation)
: Generator(position, positionVariation), m_controlPoints(), m_u(0.0), m_spacing(0.0), m_increment(0.0) {
for(auto & point : controlPoints) {
this->m_controlPoints.push_back(this->m_position + glm::vec3(point));
}
}
}
\ No newline at end of file
#pragma once
#include "Generator.hpp"
#include "../Path.hpp"
namespace pg::interface {
class PathGenerator;
}
namespace pg::particle {
class PathGenerator : public Generator<Path> {
private:
ct::Curve m_controlPoints;
float m_u, m_spacing, m_increment, m_limitor;
public:
PathGenerator(const ct::Curve& controlPoints, const ct::Point& position = ct::Point(), float positionVariation = 0.0);
inline const ct::Curve& getControlPoint() const {return this->m_controlPoints;}
inline float getParameter() const {return this->m_u;}
inline float getSpacing() const {return this->m_spacing;}
inline float getParameterIncrement() const {return this->m_increment;}
inline float getParameterLifeLimitor() const {return this->m_limitor;}
inline void setControlPoint(const ct::Curve& points) {this->m_controlPoints = points;}
inline void setDefaultParameterValue(float u) {this->m_u = u;}
inline void setParameterIncrement(float inc) {this->m_increment = inc;}
inline void setParameterLifeLimitor(float limitor) {this->m_limitor = limitor;}
friend class pg::interface::PathGenerator;
};
}
\ No newline at end of file
#include "PathMultyGenerator.hpp"
#include <random>
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/rotate_vector.hpp>
namespace pg::particle {
PathMultyGenerator::PathMultyGenerator(const ct::Curve& controlPoints, const ct::Point& position, float positionVariation)
: PathGenerator(controlPoints, position, positionVariation), _generators() {}
std::vector<std::unique_ptr<Path>> PathMultyGenerator::generate(size_t count, size_t birth) const {
std::random_device device;
std::mt19937 randomEngine(device());
using ureal_dist = std::uniform_real_distribution<double>;
using uint_dist = std::uniform_int_distribution<>;
ureal_dist positionGenerator(-this->getPositionVariation(), this->getPositionVariation());
uint_dist generatorIndex(0, static_cast<int>(this->_generators.size()-1));
std::vector<std::unique_ptr<Path>> particles;
particles.reserve(count);
std::vector<ct::Point> realCtrlPoint;
for(auto & point : this->getControlPoint()) {
glm::dvec3 glmPoint = point;
glmPoint = glm::rotateZ<double>(glmPoint, glm::radians<double>(this->m_rotation.z));
glmPoint = glm::rotateY<double>(glmPoint, glm::radians<double>(this->m_rotation.y));
glmPoint = glm::rotateX<double>(glmPoint, glm::radians<double>(this->m_rotation.x));
realCtrlPoint.push_back(glmPoint + ct::Point(m_position));
}
double u_space = 0.0;
std::vector<std::string> names;
for(auto&[name, generator] : this->_generators) {
names.push_back(name);
}
for (unsigned int i = 0; i < count; ++i) {
glm::dvec3 positionVariation(0.0);
positionVariation.x = positionGenerator(randomEngine);
positionVariation.y = positionGenerator(randomEngine);
positionVariation.z = positionGenerator(randomEngine);
ct::CurveGenerator * generator = this->_generators.at(names.at(generatorIndex(randomEngine))).get();
Path * particle = new Path(birth, generator, realCtrlPoint, this->getParameter() + u_space, this->getParameterIncrement());
particle->setPositionVariation(positionVariation);
particle->setParameterLifeLimitor(this->getParameterLifeLimitor());
u_space += this->getSpacing();
if(u_space > 1.0) {
u_space = 0.0;
}
particles.push_back(std::unique_ptr<Path>(particle));
}
return particles;
}
}
\ No newline at end of file
#pragma once
#include "PathGenerator.hpp"
#include "../Path.hpp"
#include <map>
#include <memory>
namespace pg::particle {
class PathMultyGenerator : public PathGenerator {
private:
std::map<std::string, std::unique_ptr<ct::CurveGenerator>> _generators;
public:
PathMultyGenerator(const ct::Curve& controlPoints, const ct::Point& position = ct::Point(), float positionVariation = 0.0);
inline void add(const std::string & name, ct::CurveGenerator * generator) {this->_generators.insert(std::pair<std::string, ct::CurveGenerator *>(name, generator));}
inline const std::map<std::string, std::unique_ptr<ct::CurveGenerator>> & getGenerators() const {return this->_generators;}
virtual std::vector<std::unique_ptr<Path>> generate(size_t count, size_t birth = 0) const;
};
}
\ No newline at end of file
...@@ -7,10 +7,8 @@ ...@@ -7,10 +7,8 @@
namespace pg::particle { namespace pg::particle {
PathUniqueGenerator::PathUniqueGenerator(ct::CurveGenerator * generator, const ct::Curve& controlPoints, const ct::Point& position, float positionVariation) PathUniqueGenerator::PathUniqueGenerator(ct::CurveGenerator * generator, const ct::Curve& controlPoints, const ct::Point& position, float positionVariation)
: Generator(position, positionVariation), m_generator(generator), m_controlPoints(), m_u(0.0), m_spacing(0.0), m_increment(0.0) { : PathGenerator(controlPoints, position, positionVariation), m_generator(generator) {
for(auto & point : controlPoints) {
this->m_controlPoints.push_back(this->m_position + glm::vec3(point));
}
} }
std::vector<std::unique_ptr<Path>> PathUniqueGenerator::generate(size_t count, size_t birth) const { std::vector<std::unique_ptr<Path>> PathUniqueGenerator::generate(size_t count, size_t birth) const {
...@@ -24,7 +22,7 @@ namespace pg::particle { ...@@ -24,7 +22,7 @@ namespace pg::particle {
particles.reserve(count); particles.reserve(count);
std::vector<ct::Point> realCtrlPoint; std::vector<ct::Point> realCtrlPoint;
for(auto & point : m_controlPoints) { for(auto & point : this->getControlPoint()) {
glm::dvec3 glmPoint = point; glm::dvec3 glmPoint = point;
glmPoint = glm::rotateZ<double>(glmPoint, glm::radians<double>(this->m_rotation.z)); glmPoint = glm::rotateZ<double>(glmPoint, glm::radians<double>(this->m_rotation.z));
...@@ -34,7 +32,7 @@ namespace pg::particle { ...@@ -34,7 +32,7 @@ namespace pg::particle {
realCtrlPoint.push_back(glmPoint + ct::Point(m_position)); realCtrlPoint.push_back(glmPoint + ct::Point(m_position));
} }
double u_space = 0.0; float u_space = 0.0;
for (unsigned int i = 0; i < count; ++i) for (unsigned int i = 0; i < count; ++i)
{ {
glm::dvec3 positionVariation(0.0); glm::dvec3 positionVariation(0.0);
...@@ -43,11 +41,11 @@ namespace pg::particle { ...@@ -43,11 +41,11 @@ namespace pg::particle {
positionVariation.y = positionGenerator(randomEngine); positionVariation.y = positionGenerator(randomEngine);
positionVariation.z = positionGenerator(randomEngine); positionVariation.z = positionGenerator(randomEngine);
Path * particle = new Path(birth, m_generator, realCtrlPoint, m_u + u_space, m_increment); Path * particle = new Path(birth, m_generator, realCtrlPoint, this->getParameter() + this->getSpacing(), this->getParameterIncrement());
particle->setPositionVariation(positionVariation); particle->setPositionVariation(positionVariation);
particle->setParameterLifeLimitor(this->m_limitor); particle->setParameterLifeLimitor(this->getParameterLifeLimitor());
u_space += m_spacing; u_space += this->getSpacing();
if(u_space > 1.0) { if(u_space > 1.0) {
u_space = 0.0; u_space = 0.0;
} }
......
#pragma once #pragma once
#include "Generator.hpp" #include "PathGenerator.hpp"
#include "../Path.hpp" #include "../Path.hpp"
#include <set>
namespace pg::interface { namespace pg::interface {
class PathUniqueGenerator; class PathUniqueGenerator;
} }
namespace pg::particle { namespace pg::particle {
class PathUniqueGenerator : public Generator<Path> { class PathUniqueGenerator : public PathGenerator {
private: private:
ct::Curve m_controlPoints;
ct::CurveGenerator * m_generator; ct::CurveGenerator * m_generator;
float m_u, m_spacing, m_increment, m_limitor;
public: public:
PathUniqueGenerator(ct::CurveGenerator * generator, const ct::Curve& controlPoints, const ct::Point& position = ct::Point(), float positionVariation = 0.0); PathUniqueGenerator(ct::CurveGenerator * generator, const ct::Curve& controlPoints, const ct::Point& position = ct::Point(), float positionVariation = 0.0);
inline ct::CurveGenerator * getGenerator() const {return this->m_generator;} inline ct::CurveGenerator * getGenerator() const {return this->m_generator;}
inline const ct::Curve& getControlPoint() const {return this->m_controlPoints;}
inline float getParameter() const {return this->m_u;}
inline float getSpacing() const {return this->m_spacing;}
inline float getParameterIncrement() const {return this->m_increment;}
inline float getParameterLifeLimitor() const {return this->m_limitor;}
inline void setGenerator(ct::CurveGenerator * genertor) {this->m_generator = genertor;} inline void setGenerator(ct::CurveGenerator * genertor) {this->m_generator = genertor;}
inline void setControlPoint(const ct::Curve& points) {this->m_controlPoints = points;}
inline void setDefaultParameterValue(float u) {this->m_u = u;}
inline void setParameterIncrement(float inc) {this->m_increment = inc;}
inline void setParameterLifeLimitor(float limitor) {this->m_limitor = limitor;}
virtual std::vector<std::unique_ptr<Path>> generate(size_t count, size_t birth = 0) const; virtual std::vector<std::unique_ptr<Path>> generate(size_t count, size_t birth = 0) const;
friend class interface::PathUniqueGenerator;
}; };
} }
\ No newline at end of file
#include "MultyPath.hpp"
#include <chrono>
#include <glm/gtc/matrix_transform.hpp>
#include <CurveTools/CPU/BezierGenerator.hpp>
#include <CurveTools/CPU/CatmullRomGenerator.hpp>
#include <CurveTools/CPU/LinearGenerator.hpp>
namespace pg::scene {
MultyPath::MultyPath(const ct::Curve & ctrlpoint)
: SceneParticle(1024),
_ubo(0),
_program(),
_texture(),
_generator(ctrlpoint),
_trajectory(&this->_generator) {
this->_generator.add("Bezier", new ct::BezierGenerator());
this->_generator.add("Catmull-Rom", new ct::CatmullRomGenerator());
this->_generator.add("Linear", new ct::LinearGenerator());
}
void MultyPath::initialize() {
this->_billboard.initialize();
this->_trajectory.initialize();
if(!this->_program.usable()) {
pg::Source vertices("res/shaders/scene/Billboard.vert", pg::Source::Categorie::VERTEX);
pg::Source fragment("res/shaders/scene/Billboard.frag", pg::Source::Categorie::FRAGMENT);
this->_program << vertices;
this->_program << fragment;
this->_program.link();
vertices.release();
fragment.release();
}
pg::error::OpenGLError::check();
glCreateBuffers(1, &this->_ubo);
glBindBuffer(GL_UNIFORM_BUFFER, this->_ubo);
glBufferData(GL_UNIFORM_BUFFER, 1024 * sizeof(glm::mat4), nullptr, GL_DYNAMIC_DRAW);
GLuint uniforme_index = glGetUniformBlockIndex(this->_program.id(), "uModels_t");
glBindBufferBase(GL_UNIFORM_BUFFER, uniforme_index, this->_ubo);
pg::error::OpenGLError::check();
this->_texture.load("res/textures/smoke1.png");
pg::error::OpenGLError::check();
this->_generator.setPosition({0.f, 0.f, 0.f});
this->_generator.setPositionVariation(0.5f);
this->_generator.setParameterIncrement(0.01f);
this->_generator.setParameterLifeLimitor(1.0f);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glClearColor(0.25f, 0.f, 0.15f, 1.0f);
}
void MultyPath::update(double current_time) {
static auto start = std::chrono::high_resolution_clock::now();
auto end = std::chrono::high_resolution_clock::now();
if(!this->isFreezeEnable()) {
pg::particle::Particle::purge(this->_particles, static_cast<size_t>(current_time), this->getLifetime());
if(duration_cast<std::chrono::milliseconds>(end - start).count() >= 500) {
start = std::chrono::high_resolution_clock::now();
if(this->isSpawnEnable()) {
this->spawn(this->getSpawnCount(), current_time);
}
}
if(duration_cast<std::chrono::milliseconds>(end - start).count() >= 10) {
for(auto& particle : this->_particles) {
particle->update(0.0);
}
}
}
}
void MultyPath::render(const Camera & camera, double current_time) {
const glm::mat4 VIEW_MATRIX = camera.getViewMatrix();
const glm::mat4 PROJECTION_MATRIX = camera.getViewFrustum().getProjectionMatrix();
this->_trajectory.render(camera, current_time);
pg::error::OpenGLError::check();
std::vector<glm::mat4> models;
for(auto & particle : this->_particles) {
glm::mat4 model = glm::mat4(1.0);
model = glm::translate(model, glm::vec3(particle->getPosition()));
models.push_back(model);
}
pg::error::OpenGLError::check();
glBindBuffer(GL_UNIFORM_BUFFER, this->_ubo);
glBufferSubData(GL_UNIFORM_BUFFER, 0, models.size() * sizeof(glm::mat4), models.data());
pg::error::OpenGLError::check();
this->_program.use();
this->_program.setUniform("uView", VIEW_MATRIX);
this->_program.setUniform("uProj", PROJECTION_MATRIX);
this->_program.setUniform("uSlot", 0);
this->_program.setUniform("uColor", glm::vec4(1.f));
pg::error::OpenGLError::check();
this->_texture.bind();
if(this->isRenderEnable()) {
this->_billboard.draw(this->_particles.size());
}
pg::error::OpenGLError::check();
}
void MultyPath::destroy() {
glDeleteBuffers(1, &this->_ubo);
this->_billboard.destroy();
this->_particles.clear();
pg::error::OpenGLError::check();
}
void MultyPath::changeParticletexture(const std::string & Multypath) {
this->_texture.load(Multypath);
}
void MultyPath::spawn(int count, double current_time) {
if((count + this->_particles.size()) <= this->getMaxParticles()) {
std::vector<std::unique_ptr<pg::particle::Path>> 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
#pragma once
#include "../Scene.hpp"
#include "../../Renderer/Renderer.hpp"
#include "../../Particle/generator/PathMultyGenerator.hpp"
#include "../../Mesh/Billboard.hpp"
#include "TrajectoryMulty.hpp"
namespace pg::scene {
class MultyPath : public SceneParticle {
private:
GLuint _ubo;
Program _program;
Billboard _billboard;
TrajectoryMulty _trajectory;
Material _texture;
particle::PathMultyGenerator _generator;
public:
MultyPath(const ct::Curve &);
virtual ~MultyPath() = default;
virtual void initialize();
virtual void render(const Camera &, double);
virtual void update(double);
virtual void destroy();
inline const Program & getProgram() const {return this->_program;}
inline const Material & getTexture() const {return this->_texture;}
inline const particle::PathMultyGenerator & getGenerator() const {return this->_generator;}
void changeParticletexture(const std::string &);
virtual std::string name() const {return "Multy Path Scene";}
virtual void spawn(int, double);
};
}
\ No newline at end of file
#include "TrajectoryMulty.hpp"
namespace pg::scene {
TrajectoryMulty::TrajectoryMulty(particle::PathMultyGenerator * generator, double increment, const std::vector<glm::vec4> & colors)
: _generators(generator),
_colors(colors),
_vao(),
_vbo(this->_vao, {layout::POSITION, layout::COLOR}),
_increment(increment),
_pointSize(8.f),
_lineSize(1.f),
_controlLine(false) {}
void TrajectoryMulty::initialize() {
this->update(0.0);
if(!this->_program.usable()) {
Source vert("res/shaders/scene/Trajectory.vert", Source::Categorie::VERTEX);
Source frag("res/shaders/scene/Trajectory.frag", Source::Categorie::FRAGMENT);
this->_program << vert;
this->_program << frag;
this->_program.link();
vert.release();
frag.release();
}
}
void TrajectoryMulty::update(double) {
std::vector<float> traj;
for(auto & point : this->_generators->getControlPoint()) {
traj.push_back(static_cast<float>(point.x));
traj.push_back(static_cast<float>(point.y));
traj.push_back(static_cast<float>(point.z));
traj.push_back(1.0f);
traj.push_back(1.0f);
traj.push_back(1.0f);
}
std::vector<double> ps;
double degre_max = 1.f;
for(auto &[name, generator] : this->_generators->getGenerators()) {
uint16_t degree = generator->getDegree();
if(degree > degre_max) {
degre_max = degree;
}
}
for(double i = 0.f; i < degre_max; i += this->_increment) {
ps.push_back(i);
}
size_t color_nb = this->_colors.size();
size_t i = 0;
for(auto &[name, generator] : this->_generators->getGenerators()) {
ct::Curve curve = generator->generate(this->_generators->getControlPoint(), ps);
size_t index = i%color_nb;
for(auto & point : curve) {
traj.push_back(static_cast<float>(point.x));
traj.push_back(static_cast<float>(point.y));
traj.push_back(static_cast<float>(point.z));
traj.push_back(this->_colors.at(index).r);
traj.push_back(this->_colors.at(index).g);
traj.push_back(this->_colors.at(index).b);
}
++i;
}
this->_vbo.set(traj);
}
void TrajectoryMulty::render(const Camera & camera, double current_time) {
glEnable(GL_LINE_SMOOTH);
glLineWidth(this->_lineSize);
this->_vao.bind();
glEnable(GL_PROGRAM_POINT_SIZE);
this->_program.use();
this->_program.setUniform("uProj", camera.getViewFrustum().getProjectionMatrix());
this->_program.setUniform("uView", camera.getViewMatrix());
this->_program.setUniform("uColor", glm::vec4(1.f));
this->_program.setUniform("uPointSize", this->_pointSize);
GLsizei raw = static_cast<GLsizei>(this->_generators->getControlPoint().size());
GLsizei total = static_cast<GLsizei>(this->_vbo.vertices());
glDrawArrays(GL_LINE_STRIP, raw, total - raw);
glDrawArrays(this->_controlLine ? GL_LINE_STRIP : GL_POINTS, 0, static_cast<GLsizei>(this->_generators->getControlPoint().size()));
}
void TrajectoryMulty::destroy() {
}
}
\ No newline at end of file
#pragma once
#include "../Scene.hpp"
#include <glm/vec4.hpp>
#include "../../Renderer/Renderer.hpp"
#include "../../Particle/generator/PathMultyGenerator.hpp"
namespace pg::scene {
class TrajectoryMulty : public Scene {
private:
particle::PathMultyGenerator * _generators;
std::vector<glm::vec4> _colors;
VertexArray _vao;
VerticeBuffer _vbo;
Program _program;
double _increment;
float _pointSize;
float _lineSize;
bool _controlLine;
public:
TrajectoryMulty(particle::PathMultyGenerator *, double = 0.01, const std::vector<glm::vec4> & colors = {{1.f, 0.f, 0.f, 1.f}, {0.f, 1.f, 0.f, 1.f}, {0.f, 1.f, 0.f, 1.f}});
void initialize();
void render(const Camera &, double);
void update(double);
void destroy();
};
}
\ No newline at end of file
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "Scene/Scenes/MeshGenerator.hpp" #include "Scene/Scenes/MeshGenerator.hpp"
#include "Scene/Scenes/Grid.hpp" #include "Scene/Scenes/Grid.hpp"
#include "Scene/Scenes/PhysicSprite.hpp" #include "Scene/Scenes/PhysicSprite.hpp"
#include "Scene/Scenes/MultyPath.hpp"
#include "Interface/Manager.hpp" #include "Interface/Manager.hpp"
...@@ -69,7 +70,9 @@ int main(int argc, const char * argv[]) { ...@@ -69,7 +70,9 @@ int main(int argc, const char * argv[]) {
ct::Curve ctrlPoints { ct::Curve ctrlPoints {
{ 10.f, 0.f, 0.f}, { 10.f, 0.f, 0.f},
{-10.f, 0.f, 0.f} {-10.f, 0.f, 0.f},
{-10.f, 10.f, 0.f},
{ 10.f, 10.f, 0.f}
}; };
ct::BezierGenerator bezier(static_cast<unsigned int>(ctrlPoints.size())); ct::BezierGenerator bezier(static_cast<unsigned int>(ctrlPoints.size()));
...@@ -78,6 +81,7 @@ int main(int argc, const char * argv[]) { ...@@ -78,6 +81,7 @@ int main(int argc, const char * argv[]) {
pg::scene::PhysicSprite physicSprite; pg::scene::PhysicSprite physicSprite;
pg::scene::MeshGenerator meshGenerator; pg::scene::MeshGenerator meshGenerator;
pg::scene::Path path(&bezier, ctrlPoints); pg::scene::Path path(&bezier, ctrlPoints);
pg::scene::MultyPath multyPath(ctrlPoints);
pg::Manager manager(window); pg::Manager manager(window);
pg::interface::Manager imanager(window, manager); pg::interface::Manager imanager(window, manager);
...@@ -86,6 +90,7 @@ int main(int argc, const char * argv[]) { ...@@ -86,6 +90,7 @@ int main(int argc, const char * argv[]) {
manager.add(&physic); manager.add(&physic);
manager.add(&physicSprite); manager.add(&physicSprite);
manager.add(&meshGenerator); manager.add(&meshGenerator);
manager.add(&multyPath);
while(window.isOpen()) { while(window.isOpen()) {
double current_time = glfwGetTime(); double current_time = glfwGetTime();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment