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

Add rotation on path particle generator

parent 3f05dcc2
No related branches found
No related tags found
No related merge requests found
......@@ -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");
}
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment