diff --git a/ParticleGenerator/src/Interface/Generator/PathGeneratorInterface.cpp b/ParticleGenerator/src/Interface/Generator/PathGeneratorInterface.cpp index 1661a228ce9c3def9676930e321ed4dddaaa370f..6f712d1ad71f0c45630d7c0618dc5963f4d895a1 100644 --- a/ParticleGenerator/src/Interface/Generator/PathGeneratorInterface.cpp +++ b/ParticleGenerator/src/Interface/Generator/PathGeneratorInterface.cpp @@ -23,6 +23,7 @@ namespace pg { if(ImGui::CollapsingHeader("Generator Position")) { ImGui::DragFloat3("Generator Position (x, y, z)", &this->_generator->m_position[0], 0.1f); + ImGui::SliderFloat3("Generator Roation (x, y, z)", &this->_generator->m_rotation[0], -360.f, 360.f); ImGui::DragFloat("Position Variation", &this->_generator->m_positionVariation, 0.001f, 0.f, 0.f, "%.4f"); } diff --git a/ParticleGenerator/src/Particle/generator/PathParticleGenerator.cpp b/ParticleGenerator/src/Particle/generator/PathParticleGenerator.cpp index cb692113e414e2319a12c7b71b56ceedfb93a56c..009867c3d03d0558227528eb01589d252c771451 100644 --- a/ParticleGenerator/src/Particle/generator/PathParticleGenerator.cpp +++ b/ParticleGenerator/src/Particle/generator/PathParticleGenerator.cpp @@ -2,6 +2,9 @@ #include <random> +#define GLM_ENABLE_EXPERIMENTAL +#include <glm/gtx/rotate_vector.hpp> + namespace pg { PathParticleGenerator::PathParticleGenerator(ct::CurveGenerator * generator, const ct::Curve& controlPoints, const ct::Point& position, float positionVariation) : ParticleGenerator(position, positionVariation), m_generator(generator), m_controlPoints(), m_u(0.0), m_spacing(0.0), m_increment(0.0) { @@ -22,7 +25,13 @@ namespace pg { std::vector<ct::Point> realCtrlPoint; for(auto & point : m_controlPoints) { - realCtrlPoint.push_back(point + ct::Point(m_position)); + 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;