Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8a85505

Browse files
committed
updated file
1 parent 66efb39 commit 8a85505

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

‎src/physics/ofxParticles.h‎

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// ofxParticles.h
33
//
44
// Created by Timothy Scaffidi on 6/14/12.
5-
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
5+
//
6+
// Updated for ofxVP
67
//
78

89
#pragma once
@@ -385,25 +386,25 @@ class ofxParticleSystem {
385386
}
386387

387388
void attractTo(ofPoint p, const float accel, const float minDist, const bool consumeParticle = false) {
388-
for(list<ofxParticle*>::iterator it = particles.begin(); it != particles.end(); it++) {
389+
for(std::list<ofxParticle*>::iterator it = particles.begin(); it != particles.end(); it++) {
389390
(**it).attractTo(p, accel, minDist, consumeParticle);
390391
}
391392
}
392393

393394
void gravitateTo(ofPoint p, const float gravity, const float mass, const float minDist, const float consumeParticle) {
394-
for(list<ofxParticle*>::iterator it = particles.begin(); it != particles.end(); it++) {
395+
for(std::list<ofxParticle*>::iterator it = particles.begin(); it != particles.end(); it++) {
395396
(**it).gravitateTo(p, gravity, mass, minDist, consumeParticle);
396397
}
397398
}
398399

399400
void rotateAround(ofPoint p, const float accel, const float minDist, const float consumeParticle) {
400-
for(list<ofxParticle*>::iterator it = particles.begin(); it != particles.end(); it++) {
401+
for(std::list<ofxParticle*>::iterator it = particles.begin(); it != particles.end(); it++) {
401402
(**it).rotateAround(p, accel, minDist, consumeParticle);
402403
}
403404
}
404405

405406
void applyVectorField(float * field, int fieldWidth, int fieldHeight, int numComponents, ofRectangle areaOfInfluence, float force) {
406-
for(list<ofxParticle*>::iterator it = particles.begin(); it != particles.end(); it++) {
407+
for(std::list<ofxParticle*>::iterator it = particles.begin(); it != particles.end(); it++) {
407408
ofxParticle & p = (**it);
408409
ofVec2f pos(p.position.x,p.position.y);
409410
if(areaOfInfluence.inside(pos)) {
@@ -419,7 +420,7 @@ class ofxParticleSystem {
419420

420421
int update(float timeStep, float drag) {
421422
int particlesRemoved = 0;
422-
for(list<ofxParticle*>::iterator it = particles.begin(); it != particles.end(); it++) {
423+
for(std::list<ofxParticle*>::iterator it = particles.begin(); it != particles.end(); it++) {
423424
if((**it).isAlive()) {
424425
(**it).update(timeStep, drag);
425426
}
@@ -435,19 +436,19 @@ class ofxParticleSystem {
435436
}
436437

437438
void draw() {
438-
for(list<ofxParticle*>::iterator it = particles.begin(); it != particles.end(); it++) {
439+
for(std::list<ofxParticle*>::iterator it = particles.begin(); it != particles.end(); it++) {
439440
(**it).draw();
440441
}
441442
}
442443

443444
void draw(ofTexture &tex) {
444-
for(list<ofxParticle*>::iterator it = particles.begin(); it != particles.end(); it++) {
445+
for(std::list<ofxParticle*>::iterator it = particles.begin(); it != particles.end(); it++) {
445446
(**it).draw(tex);
446447
}
447448
}
448449

449450
void draw(ofTexture &tex, ofTexture &tex2) {
450-
for(list<ofxParticle*>::iterator it = particles.begin(); it != particles.end(); it++) {
451+
for(std::list<ofxParticle*>::iterator it = particles.begin(); it != particles.end(); it++) {
451452
int index = (**it).particleID;
452453
if(index%2==0)
453454
(**it).draw(tex);
@@ -458,7 +459,7 @@ class ofxParticleSystem {
458459

459460
int getNumParticles() {return numParticles;}
460461

461-
void binParticles(vector<ofxParticle *> particles, const int binPower, const ofRectangle bounds) {
462+
void binParticles(std::vector<ofxParticle *> particles, const int binPower, const ofRectangle bounds) {
462463
if (this->binPower != binPower || bounds != binBounds) {
463464
this->binPower = binPower;
464465

@@ -486,15 +487,15 @@ class ofxParticleSystem {
486487
}
487488
}
488489

489-
int getNeighbors(vector<ofxParticle *> &neighbors, const ofxParticle p, const float radius) {
490+
int getNeighbors(std::vector<ofxParticle *> &neighbors, const ofxParticle p, const float radius) {
490491
return getNeighbors(neighbors, p.position, radius);
491492
}
492493

493-
int getNeighbors(vector<ofxParticle *> &neighbors, const ofVec3f p, const float radius) {
494+
int getNeighbors(std::vector<ofxParticle *> &neighbors, const ofVec3f p, const float radius) {
494495
return getNeighbors(neighbors, p.x, p.y, radius);
495496
}
496497

497-
int getNeighbors(vector<ofxParticle *> &neighbors, float targetX, float targetY, const float radius) {
498+
int getNeighbors(std::vector<ofxParticle *> &neighbors, float targetX, float targetY, const float radius) {
498499
//adapted from kylemcdonalds binned particle system
499500
int x, y, p, bindex, minX, minY, maxX, maxY;
500501
unsigned int minXBin, maxXBin, minYBin, maxYBin;
@@ -534,11 +535,11 @@ class ofxParticleSystem {
534535

535536

536537
private:
537-
list<ofxParticle*> particles;
538+
std::list<ofxParticle*> particles;
538539
int numParticles;
539540
int totalParticlesEmitted;
540541

541-
vector<vector<ofxParticle *>> bins;
542+
std::vector<vector<ofxParticle *>> bins;
542543
ofRectangle binBounds;
543544
int binPower;
544545
int xbins, ybins;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /