Ejemplo n.º 1
0
//--------------------------------------------------------------
void testApp::update()
{
	sys.get()->setCameraPosition(ofxSPK::toSPK(cam.getPosition()));
	sys.update();

	em.setPosition(ofSignedNoise(1, 0, 0, ofGetElapsedTimef() * 0.5) * 1400,
				   ofSignedNoise(0, 1, 0, ofGetElapsedTimef() * 0.5) * 1400,
				   ofSignedNoise(0, 0, 1, ofGetElapsedTimef() * 0.5) * 1400);

	em.tilt(0.1);
	em.pan(15);
	em.roll(-3.5);

	em.update();

	mod.update();
	mod2.update();

	mod.setPosition(ofSignedNoise(100, 0, 0, ofGetElapsedTimef() * 0.1) * 1000,
				   ofSignedNoise(0, 100, 0, ofGetElapsedTimef() * 0.1) * 1000,
				   ofSignedNoise(0, 0, 100, ofGetElapsedTimef() * 0.1) * 1000);

	mod2.setPosition(ofSignedNoise(500, 0, 0, ofGetElapsedTimef() * 0.5) * 200,
					ofSignedNoise(0, 500, 0, ofGetElapsedTimef() * 0.5) * 200,
					ofSignedNoise(0, 0, 500, ofGetElapsedTimef() * 0.5) * 200);

	ofSetWindowTitle(ofToString(ofGetFrameRate()));
}
Ejemplo n.º 2
0
//--------------------------------------------------------------
void testApp::setup()
{
	// setup pointsprite texture
	// NOTES: the texture size must be Power of Two,
	// and turn off arb texture option while loading
	ofDisableArbTex();
	sprite.loadImage("image.jpg");
	ofEnableArbTex();
	
	ofSetFrameRate(60);
	ofSetVerticalSync(true);
	ofBackground(0);
	
	sys.setup();
	
	group.setup(sys);
	group.setColor(ofxSPK::RangeC(ofColor(255, 255), ofColor(255, 255)),
				   ofxSPK::RangeC(ofColor(0, 0), ofColor(255, 0)));
	
	group.setLifeTime(0.5, 5);
	group.setFriction(0.1);
	group.setSize(0, ofxSPK::RangeF(30, 250));
	
	group.setGravity(ofVec3f(0, -10, 0));
	group.setMass(0.1, 1);
	
	rot.setup(SPK::Vortex::create(SPK::Vector3D(ofGetWidth()/2, ofGetHeight()/2),
								  SPK::Vector3D(0, 1, 0),
								  200,
								  10), group);
	
	group.reserve(10000);
}
Ejemplo n.º 3
0
//--------------------------------------------------------------
void testApp::update()
{
	group.emitRandom(10, ofVec3f(ofGetMouseX(), ofGetMouseY()));
	
	sys.update();

	ofSetWindowTitle(ofToString(ofGetFrameRate()));
}
Ejemplo n.º 4
0
//--------------------------------------------------------------
void testApp::draw()
{
	ofEnableBlendMode(OF_BLENDMODE_ADD);
	
	// sys.debugDraw();
	
	// bind texture, enable point sprite while drawing particles
	sprite.bind();
	ofEnablePointSprites();
	sys.draw();
	ofDisablePointSprites();
	sprite.unbind();
}
Ejemplo n.º 5
0
//--------------------------------------------------------------
void testApp::setup()
{
	ofSetFrameRate(60);
	ofSetVerticalSync(true);
	ofBackground(0);

	sys.setup();

	group = sys.createGroup();
	group.setColor(ofxSPK::RangeC(ofColor(255, 255, 0, 255), ofColor(255, 0, 0, 255)),
				   ofxSPK::RangeC(ofColor(255, 0, 255, 0), ofColor(255, 255, 0, 0)));
	
	group.setLifeTime(10);
	group.setFriction(0.1);
	group.setSize(ofxSPK::RangeF(1), ofxSPK::RangeF(400, 100));

	group.setGravity(ofVec3f(0, 0, 0));

	group.reserve(10000);

	em = group.createEmitter(ofxSPK::Emitter::SPHERIC);

	em.setFlow(1000);
	em.setForce(100, 1350);

	em.setAngles(0.0, 0.1);

	mod = group.createModifier(ofxSPK::Modifier::POINT_MASS);
	mod.setZone(SPK::Sphere::create(ofxSPK::toSPK(ofVec3f(0, 0, 0)), 4000), false);

	mod.get<SPK::PointMass>()->setMass(200000);

	mod2 = group.createModifier(ofxSPK::Modifier::POINT_MASS);
	mod2.setZone(SPK::Sphere::create(ofxSPK::toSPK(ofVec3f(0, 0, 0)), 800), false);
	mod2.get<SPK::PointMass>()->setMass(-300000);
}
Ejemplo n.º 6
0
//--------------------------------------------------------------
void testApp::draw()
{
	ofEnableBlendMode(OF_BLENDMODE_ADD);
	
	cam.begin();

	ofEnableAlphaBlending();
	sys.draw();

	em.draw();
	
	mod.draw();
	mod2.draw();

	cam.end();
}