示例#1
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);
}
示例#2
0
文件: testApp.cpp 项目: egelor/ofxSPK
//--------------------------------------------------------------
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);
}