示例#1
0
void ofApp::generateBoids(){
    boids.clear();
    numBoids = 4096;
    for(int i=0;i<numBoids;i++){
        Boid * b = new Boid();
        b->setup();
        boids.push_back(b);
        
    }
    doSetup = false;
    ofSetBackgroundAuto(false);
}
//--------------------------------------------------------------
void ofApp::setup(){
    
    for(int i = 0; i < 20; i++){
        float startX = ofRandom(ofGetWidth());
        float startY = ofRandom(ofGetHeight());
        
        Boid boids;
        boids.setup(startX, startY);
        flock.push_back(boids);
    }
    
    force.set(0.08,0.08);
    
}