Skip to content
Snippets Groups Projects
Commit fe6e896c authored by bobarna's avatar bobarna
Browse files

put back previous working propagation

parent 79ed7b7f
Branches
No related tags found
No related merge requests found
...@@ -20,11 +20,23 @@ PBDSimulation::PBDSimulation(HeadObject *_head, size_t _nr_sims, size_t _nr_segm ...@@ -20,11 +20,23 @@ PBDSimulation::PBDSimulation(HeadObject *_head, size_t _nr_sims, size_t _nr_segm
} }
void PBDSimulation::propagateHead() { void PBDSimulation::propagateHead() {
vec3 origin(0, 0, 0); srand(time(nullptr));
vec3 head(0,0,0);
float step = M_PI / nrStrands;
float currAngle = M_PI;
float r = 0.20f;
// if there is only one strand, then place it in the middle
if (nrStrands == 1) r = 0.0;
for (size_t i = 0; i < nrStrands; i++) { for (size_t i = 0; i < nrStrands; i++) {
vec3 color = util::getRandomRGBColorAround(vec3(222.0f, 101.0f, 32.0f), vec3(40.0f, 20.0f, 20.0f)); vec3 color = util::getRandomRGBColorAround(vec3(222.0f, 101.0f, 32.0f), vec3(40.0f, 20.0f, 20.0f));
strands.emplace_back(CreateStrand(nrSegments, lSeg, origin, color)); vec3 curr_pos(head.x + cosf(currAngle) * r * 1.2f, head.y + sinf(currAngle) * r * 1.1f, head.z);
strands.emplace_back(CreateStrand(nrSegments, lSeg, curr_pos, color));
currAngle -= step;
} }
} }
void PBDSimulation::update(float dt) { void PBDSimulation::update(float dt) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment