void particle::update() {
	
	life--;

	float randomness = 10.0;
	int step = 3;
	int div = 4000;
	
    // initiate velocity for debugging	
    vel = ofxVec3f(0,1,0);	
    
	// forces etc 
	ofxVec3f rand = ofxVec3f(ofRandom(-randomness, +randomness),ofRandom(-randomness, +randomness),0);
	ofxVec3f diffAttract = posAttract - pos;
	ofxVec3f diffRepel = posRepel - pos;

	float dist = diffAttract.length();
	diffAttract = diffAttract.normalize();
	diffRepel = diffRepel.normalize();
	
	acc += force*diffAttract;
	acc += -force*diffRepel;

	acc *= damping;
	vel += acc;
	vel.limit(5);
	pos += vel;
	acc *=0;
	vel *=0;
        
    size *= 0.95;
    size = ofClamp(size, 20, 1000);
	
}
Esempio n. 2
0
ofxVec3f ofxVec3f::getScaled( const float length ) const {
    float l = (float)sqrt(x*x + y*y + z*z);
    if( l > 0 )
        return ofxVec3f( (x/l)*length, (y/l)*length, (z/l)*length );
    else
        return ofxVec3f();
}
Esempio n. 3
0
ofxVec3f ofxVec3f::getLimited(float max) const {
    float length = (float)sqrt(x*x + y*y + z*z);
    if( length > max && length > 0 ) {
        return ofxVec3f( (x/length)*max, (y/length)*max, (z/length)*max );
    } else {
        return ofxVec3f( x, y, z );
    }
}
Esempio n. 4
0
ofxVec3f ofxVec3f::getNormalized() const {
    float length = (float)sqrt(x*x + y*y + z*z);
    if( length > 0 ) {
        return ofxVec3f( x/length, y/length, z/length );
    } else {
        return ofxVec3f();
    }
}
Esempio n. 5
0
//--------------------------------------------------------------
void treesV2App::setup() {
	//glEnable(GL_DEPTH_TEST);
	ofSetFrameRate(30);
	ofSetVerticalSync(true);
	ofBackground(255, 255, 255);
	myBranch = branch(ofxVec3f(ofGetWidth()/2,ofGetHeight(),0), ofxVec3f(0, -30, 0), ofxVec3f(0,0,0), 30, 0.99);
	light1.spotLight(255, 255, 255, ofGetWidth()/2, ofGetHeight()/2, -20, ofGetWidth()/2, ofGetHeight()/2, 100, 90, 1);
    shader.setup("glass","glass");
}
Esempio n. 6
0
//--------------------------------------------------------------
void testApp::drawFullScreenQuad(int w, int h) {
	
	ofxVec3f a = ofxVec3f(0, 0, 0);
	ofxVec3f b = ofxVec3f(ofGetWidth(), 0, 0);
	ofxVec3f c = ofxVec3f(ofGetWidth(), ofGetHeight(), 0);
	ofxVec3f d = ofxVec3f(0, ofGetHeight(), 0);
	ofxQuad(a, b, c, d);
	
}
ofxVirtualCamera::ofxVirtualCamera() :
newFrame(false),
maxLen(1),
stepSize(1),
nearClipping(-1024),
farClipping(1024),
orthoScale(1),
position(ofxVec3f(0, 0, 0)),
rotation(ofxVec3f(0, 0, 0)) {
}
void ofxIndustrialRobotVisualizer::drawArm(int i, int w, int h){
	float l = helper->getLength(i); //The length of the arm
	ofxVec3f axis = helper->getAxis(i); //The axis the arm rotates around
	ofxVec3f offset = helper->getOffset(i);
	float r = helper->getRotationAngle(i);
	glRotated(r, axis.x, axis.y, axis.z); // Rotate it around the axis
	glTranslated(0, l, 0);
	ofxBox(ofxVec3f(0,-l/2.0,0), ofxVec3f(w, l, h), ofxVec3f(0.0, 0.0, 0.0));
	glTranslated(-offset.y, offset.x, offset.z);	
}
Esempio n. 9
0
starParticle::starParticle() {
    drag            = 0.3;
    pos = ofxVec3f(0,0,0);
    vel = ofxVec3f(0,0,0);
    frc = ofxVec3f(0,0,0);

    energy = 0;
    radius = 4;// + ofRandom(0,6);
    bBeenPeaked = false;
    nFrameOfLastPeaking = 0;
    fiveEnergy = 0;
}
Esempio n. 10
0
ofxVec3f ofxVec3f::getPerpendicular( const ofxVec3f& vec ) const {
    float crossX = y*vec.z - z*vec.y;
    float crossY = z*vec.x - x*vec.z;
    float crossZ = x*vec.y - y*vec.x;

    float length = (float)sqrt(crossX*crossX +
                               crossY*crossY +
                               crossZ*crossZ);

    if( length > 0 )
        return ofxVec3f( crossX/length, crossY/length, crossZ/length );
    else
        return ofxVec3f();
}
Esempio n. 11
0
//--------------------------------------------------------------
void App::setup(){

	bgPlayer = new ofVideoPlayer();		
	
	ofSetFrameRate(fps);
	ofEnableAlphaBlending();
	ofEnableSmoothing();
	ofSetDataPathRoot("../Resources/");
	ofBackground(0,0,0);
		
	cam.position(ofGetWidth()/2, ofGetWidth()/2-400, 1000);
	//cam.setup(this, 1000);
	adminPanel.setup();
	sText.setup();	
	convexHull.setup(fps, &adminPanel, &cam);
	qImage.setup();
	httpClient.setup(&adminPanel);
	
	ofAddListener(adminPanel.onFileDialogueBG, this, &App::onFileChangeBG);	
	ofAddListener(adminPanel.onClearBG, this, &App::onClearBG);	
	ofAddListener(adminPanel.onFileDialogueQImg, this, &App::onFileChangeQImg);	
	ofAddListener(adminPanel.onClearQImg, this, &App::onClearQImg);		
	ofAddListener(adminPanel.onRestoreAllSMSAnswer, this, &App::onRestoreAllSMSAnswer);
	ofAddListener(httpClient.onSMSRecieved, this, &App::onSMSMsgRecieved);	
	ofAddListener(httpClient.onAllSMSRecieved, this, &App::onAllSMSMsgRecieved);
	ofAddListener(convexHull.yesSoft.onFinishAllUpdating, this, &App::resotoreCamOrbit);	
	ofAddListener(convexHull.noSoft.onFinishAllUpdating, this, &App::resotoreCamOrbit);
	ofAddListener(convexHull.yesSoft.notifyStartCamOrbit, this, &App::camOrbit);
	ofAddListener(convexHull.noSoft.notifyStartCamOrbit, this, &App::camOrbit);	
	bAlreadyRestoreAllAnswer = false;	
	ofAddListener(convexHull.yesSoft.notifyUpdateStextColorYesEvent, this, &App::onNotifyUpdateStextColorYesEvent);
	ofAddListener(convexHull.noSoft.notifyUpdateStextColorNoEvent, this, &App::onNotifyUpdateStextColorNoEvent);
	ofAddListener(convexHull.yesSoft.notifyStartStextFadingYesEvent, this, &App::onNotifyStartStextFadingYesEvent);
	ofAddListener(convexHull.noSoft.notifyStartStextFadingNoEvent, this, &App::onNotifyStartStextFadingNoEvent);	
	
	prevOrbit = 2;
	camOrbitAmt = 6.5;
	camOrbitDur = 600;
	camOrbitAxisY = ofxVec3f(0.0,1,0);
	camOrbitAxisN = ofxVec3f(0.0,1,0);	
	
	bCheckSetting = adminPanel.checkSetting();
	if (bCheckSetting) {
		httpClient.sendRequestToServer(true, false, true);
	}
	processAllSMS = false;

	generatedUpInfo.numTotalYes = 0;
	generatedUpInfo.numTotalNo = 0;
}
Esempio n. 12
0
void particleSystem::sampleImage(int sampleSize) {

	particles.clear();
	for (int y=0; y< img.getHeight(); )
	{
		for (int x=0; x< img.getWidth(); ) {
			if ((float) pixels[y*(int)img.getWidth()+x] >=thres) {
				pixelParticle* p = new pixelParticle(ofxVec3f(x,y,0), ofxVec3f(1.0f,1.0f,1.0f ));
				particles.push_back(p);
			} 
			x+=sampleSize;
		}
		y+=sampleSize;
	}
}
Esempio n. 13
0
//--------------------------------------------------------------
void testApp::setup(){

	ofSetDataPathRoot("../Resources/");
//	ofDisableArbTex();
	
	showDepthShader.setup("showdepth");
	
	depthFBO.setup(ofGetWidth(), ofGetHeight());
	
	numObj = 100;
	for (int i = 0; i < numObj; i++) {
		float x = ofRandom(ofGetWidth()/2-200, ofGetWidth()/2+200);
		float y = ofRandom(ofGetHeight()/2-200, ofGetHeight()/2+200);
		float z = ofRandom(-200, 200);
		ofxVec3f pos = ofxVec3f(x,y,z);
		float r = ofRandom(0.0, 255.0);
		float g = ofRandom(0.0, 255.0);
		float b = ofRandom(0.0, 255.0);
		float a = ofRandom(200.0, 255.0);
		ofxVec4f col = ofxVec4f(r,g,b,a);
		int size = ofRandom(10, 50);
		objPos.push_back(pos);
		objCol.push_back(col);
		objSize.push_back(size);
	}	
}
Esempio n. 14
0
////////////////////////////////////////////////////////////
/// Get the current orientation of the listener (the point
/// he's looking at)
////////////////////////////////////////////////////////////
ofxVec3f Listener::GetTarget()
{
    float Orientation[6];
    ALCheck(alGetListenerfv(AL_ORIENTATION, Orientation));

    return ofxVec3f(Orientation[0], Orientation[1], Orientation[2]);
}
sfSpiderPointsPoint::sfSpiderPointsPoint()
{
	_isHiding = false;
	_isHidden = false;
	// TODO This should be determined somehow.
	_origin = ofxVec3f( 0, 0, 0 );
}
Esempio n. 16
0
void particle::addTrailPoint(int x, int y, int z){
	ofxVec3f myPoint = ofxVec3f(x,y,z);
	trail.push_back(myPoint);
	if(trail.size() > 20){
		trail.erase(trail.begin());
	}
}
Esempio n. 17
0
void GABPuppetLimb::draw() {
  ofPushMatrix();
  
    ofxVec3f modelOrientation = ofxVec3f(0,1,0);


  ofTranslate(startJoint.x, startJoint.y, startJoint.z);

    // Axis-Angle algorithm derived from: http://www.euclideanspace.com/maths/algebra/vectors/angleBetween/index.htm
    float angle =   acos(modelOrientation.dot(controlOrientation.normalize()));
  
    ofxVec3f axis = modelOrientation.cross(controlOrientation.normalize()).normalize(); 
  
    ofRotate(ofRadToDeg(angle), axis.x, axis.y, axis.z);
  
  
  /*  ofPoint modelMin;
    ofPoint modelMax;
  
    model.getBounds(&modelMin, &modelMax);
  
    float modelLength = modelMax.y - modelMin.y;
    float jointLength = endJoint.y - startJoint.y;
  
    ofScale(1, jointLength/modelLength, 1 );
   */
    model.draw();
  ofPopMatrix();
}
Esempio n. 18
0
void ParticleSystem::update(){

  steps=(steps>=1.0f)?steps-1:0.0f;
  cout<<steps<<endl;
	for(int i = 0; i < particles.size(); i++){
    particles[i].resetForce();

    particles[i].addForce(sourcePoints[particles[i].id], 1000.0f, -10.0f);
    //particles[i].addForce(ofxVec3f(1000, 1000), 10000.0f, -10.0f);
    //particles[i].addForce(ofxVec3f(width/2.0f, height/2.0f), 10000.0f, -4.0f);
    float noiseAngle   = noise->Get(particles[i].position.x*0.001, particles[i].position.y*0.001) * TWO_PI;
		float noiseAngle2  = noise->Get(particles[i].position.x*0.001, particles[i].position.y*0.001) * TWO_PI;
		particles[i].accel += ofxVec3f(cos(noiseAngle), -sin(noiseAngle2), 0) * ((particles[i].position - sourcePoints[particles[i].id]).length()/-100.0f);

    particles[i].addDamping(0.9);

		particles[i].update();
    //particles[i].noise +=
		/* particles[i].velocity *= 0.9;
		float noiseAngle   = noise->Get(particles[i].position.x*0.001, particles[i].position.y*0.001) * TWO_PI;
		float noiseAngle2  = noise->Get(particles[i].position.x*0.001, particles[i].position.y*0.001) * TWO_PI;
    //particles[i].noise += ofxVec3f(noiseAngle, noiseAngle2, 0);
    ofxVec3f noiseForce = ofxVec3f(cos(noiseAngle), -sin(noiseAngle), 0);
		particles[i].noise = noiseForce;
		particles[i].update();*/
	}
}
Esempio n. 19
0
ofxVec3f IKTagger::getTagArmTarget()
{
	ofxVec3f target_relative = character.getTarget( tag_arm );
	ofxVec3f target = ofxVec3f( root_pos.x, root_pos.y, root_pos.z )+target_relative-target_offset;
	return target;

}
Esempio n. 20
0
void ofxCamera::setViewByMouse(int x, int y)
{
    ofxVec2f mouseDelta;
    float MouseSensitivity = 10.0f;
    float MiddleX = ofGetWidth()/2;
    float MiddleY = ofGetHeight()/2;

    if((x == MiddleX) && (y == MiddleY))
        return;

    // otherwise move the mouse back to the middle of the screen
    glutWarpPointer(MiddleX, MiddleY);

    mouseDelta.x = (MiddleX - x)/MouseSensitivity;
    mouseDelta.y = (MiddleY - y)/MouseSensitivity;

    // get the axis to rotate around the x-axis.
    ofxVec3f axis = eyeCoord - posCoord;
    axis.cross(upVec);
    // To be able to use the quaternion conjugate, the axis to
    // rotate around must be normalized.
    axis.normalize();

    // Rotate around the x axis
    qrotate(axis,mouseDelta.y);
    // Rotate around the y axis
    qrotate(ofxVec3f(0, 1, 0),mouseDelta.x);
}
Esempio n. 21
0
void YesNoObjectSoft::onEndSpikeGlow(int & z) {

    fillMeshInput();

    cout << "-----------------------------------------------" << endl;
    cout << "floatVertices size = " + ofToString((int)floatVertices.size()) << endl;
    cout << "faceIndices size = " + ofToString((int)faceIndices.size()) << endl;
    cout << "numFace = " + ofToString(numFace) << endl;

    yesORno->remove(bullet->getSoftDynamicsWorld());
    delete yesORno;
    yesORno = bullet->createSoftTriMesh(ofxVec3f(0, 0, 0), &floatVertices[0], &faceIndices[0], numFace);

    cout << "-----------------------------------------------" << endl;
    btSoftBody::tFaceArray& faces(yesORno->getSoftBody()->m_faces);
    cout << "generated face size = " + ofToString((int)faces.size()) << endl;
    cout << "generated verts size = " + ofToString((int)faces.size()*3) << endl;
//	for(int i = 0; i < faces.size(); i++) {
//		btSoftBody::Node* node_0 = faces[i].m_n[0];
//		btSoftBody::Node* node_1 = faces[i].m_n[1];
//		btSoftBody::Node* node_2 = faces[i].m_n[2];
//		ofxVec3f a = ofxVec3f(node_0->m_x.getX(), node_0->m_x.getY(), node_0->m_x.getZ());
//		ofxVec3f b = ofxVec3f(node_1->m_x.getX(), node_1->m_x.getY(), node_1->m_x.getZ());
//		ofxVec3f c = ofxVec3f(node_2->m_x.getX(), node_2->m_x.getY(), node_2->m_x.getZ());
//		cout << "a = "+ofToString(a.x)+" "+ofToString(a.y)+" "+ofToString(a.z) << endl;
//		cout << "b = "+ofToString(b.x)+" "+ofToString(b.y)+" "+ofToString(b.z) << endl;
//		cout << "c = "+ofToString(c.x)+" "+ofToString(c.y)+" "+ofToString(c.z) << endl;
//	}
    cout << " " << endl;

    addedSMSFaces.clear();
    suddenMotion = true;

}
Esempio n. 22
0
//--------------------------------------------------------------
void testApp::update() {
	cam.setMaxLen(panel.getValueF("maxLen"));
	cam.setStepSize(panel.getValueF("stepSize"));
	cam.setClipping(panel.getValueF("nearClipping"), panel.getValueF("farClipping"));
	cam.setOrthoScale(panel.getValueF("orthoScale"));
	cam.setPosition(ofxVec3f(panel.getValueF("camx"), panel.getValueF("camy"), panel.getValueF("camz")));
	cam.setRotation(ofxVec3f(panel.getValueF("camrx"), panel.getValueF("camry"), panel.getValueF("camrz")));
 
	int blurAmount = panel.getValueI("blurAmount");
	int threshLevel = panel.getValueI("threshLevel");
	int minArea = panel.getValueI("minArea");
	int maxArea = panel.getValueI("maxArea");
	int nConsidered = panel.getValueI("nConsidered");
 
	cam.update();
	if(cam.isFrameNew()) {
		float alpha = panel.getValueF("alpha");
		float beta = 1 - alpha;
		IplImage* camIpl = toCv(cam.getPixels(), cam.getWidth(), cam.getHeight(), OF_IMAGE_GRAYSCALE);
		cvAddWeighted(camIpl, alpha, blur.getCvImage(), beta, 0, blur.getCvImage());
		blur.flagImageChanged();
		blur.blur(blurAmount * 2 + 1);
 
		thresh = blur;
		thresh.threshold(threshLevel);
		finder.findContours(thresh, minArea, maxArea, nConsidered, false, false);
 
		// make the average the centroid
		// should be more stable than the moments
		vector<ofxCvBlob>& blobs = finder.blobs;
		for(int i = 0; i < blobs.size(); i++) {
			ofxCvBlob& cur = blobs[i];
			vector<ofPoint>& pts = cur.pts;
			
			pts = ofGetSmoothed(pts, 8);
			
			ofPoint& centroid = cur.centroid;
			centroid.set(0, 0);
			for(int j = 0; j < pts.size(); j++) {
				centroid += pts[j];
			}
			centroid /= pts.size();
		}
 
		updateOsc();
	}
}
Esempio n. 23
0
void particleSystem::moveToCenter()
{
	particleIter = particles.begin();
	while (particleIter!=particles.end()){
		(*particleIter)->goToTarget(ofxVec3f((*particleIter)->posCurr.x+ofRandom(-abs((*particleIter)->posInit.x)/amount,abs((*particleIter)->posInit.x)/amount), ofGetScreenHeight()/2,0)+ofRandom(abs(ofGetScreenHeight()/2-(*particleIter)->posCurr.y), -abs(ofGetScreenHeight()/2-(*particleIter)->posCurr.y)));
		++particleIter;
	}
}
Esempio n. 24
0
void particleSystem::moveRandom()
{
	particleIter = particles.begin();
	while (particleIter!=particles.end()){
		(*particleIter)->goToTarget((*particleIter)->posCurr + ofxVec3f(ofRandom(-mouseX/amount, +mouseX/amount), ofRandom(-mouseY/amount, mouseY/amount),0));
		++particleIter;
	}
}
Esempio n. 25
0
void ParticleSystem::addParticle(){
  int index = ofRandom(0, sourcePoints.size() - 1);

  Particle p = Particle(ofxVec3f(ofRandom(width-10, width+10), ofRandom(0, height)), timeStep);

  p.id = index;
  particles.push_back(p);
}
Esempio n. 26
0
void YesNoObjectSoft::setup(int _yesOrNo, ofxBullet* _bullet, ofxVec3f _forcePoint, ofxVec3f scale, int _sizeLevel) {

    YesOrNo = _yesOrNo;
    bullet = _bullet;
    forcePoint = _forcePoint;
    sizeLevel = _sizeLevel;

    ofxVec3f gravity(0, 0, 0);
    ofxVec3f center(forcePoint);
    radius = scale;
    //radius *= 2.5;
    resolusion = ofMap(sizeLevel, YNSOFTMINSIZELEV, YNSOFTMAXSIZELEV, minRes, maxRes);

    float size = 30;
    float verts[12] =  {size,size,size, -size,-size,size, -size,size,-size, size,-size,-size};
    int faces[12] = {0,2,1, 1,3,0, 2,3,1, 0,3,2};
    yesORno = bullet->createSoftTriMesh(ofxVec3f(0, 0, 0), &verts[0], &faces[0], 4);
    float dist = ofxVec3f(size,size,size).distance(ofxVec3f(-size,-size,size));
    edgeLen = dist;
    height = sqrt(6)/3*dist;
    float x = (size-size-size+size)/4;
    float y = (size-size+size-size)/4;
    float z = (size+size-size-size)/4;
    smsPosition = ofxVec3f(x,y,z);

    col.setColorRadius(1.0);
    col.setColorScale(0.2);
    col.setColorAngle((_yesOrNo == YES) ? -0.34 : -0.02);
    defaultColAng = col.getColorAngle();

    incomingSMSFaceID = 0;
    changeColBySMSRecievedFace(incomingSMSFaceID);

    currColorPointer = destColorPointer;
    prevFaceAngle = 0;
    previousColAng = 0.0;
    suddenMotion = true;

    prevFacingAxis = ofxVec3f(0.5635459, -0.7932258, -0.2306707);
    prevFaceAngle = 115.9340439;

    sound.loadSound((YesOrNo==0)?"key_omin_a.aif":"A_kick.aif");

}
Esempio n. 27
0
void Ribbon :: addVelocity( float x, float y, float z )
{
	velocity[ 0 ] = x;
	velocity[ 1 ] = y;
	velocity[ 2 ] = z;
	
	position[ 0 ] += velocity[ 0 ];
	position[ 1 ] += velocity[ 1 ];
	position[ 2 ] += velocity[ 2 ];
	
	memmove( trailPosition + 3, trailPosition, 3 * trailCount * sizeof(float) );
	
	trailPosition[ 0 ] = position[ 0 ];
	trailPosition[ 1 ] = position[ 1 ];
	trailPosition[ 2 ] = position[ 2 ];
	
	memmove( trailDirection + 3, trailDirection, 3 * trailCount * sizeof(float) );
	memmove( trailVerticies + 6, trailVerticies, 6 * trailCount * sizeof(float) );
	
	int m = 0;
	int n = 1;
	
	float t0x = trailPosition[ m * 3 + 0 ];		// xyz position of 1st trail point.
	float t0y = trailPosition[ m * 3 + 1 ];
	float t0z = trailPosition[ m * 3 + 2 ];
	
	float t1x = trailPosition[ n * 3 + 0 ];		// xyz position of 2nd trail point.
	float t1y = trailPosition[ n * 3 + 1 ];
	float t1z = trailPosition[ n * 3 + 2 ];
	
	ofxVec3f t0 = ofxVec3f( t0x, t0y, t0z );	// position vector of 1st trail point.
	ofxVec3f t1 = ofxVec3f( t1x, t1y, t1z );	// position vector of 2nd trail point.
	
	ofxVec3f v1 = t0 - t1;
	v1.normalize();
	ofxVec3f ya = ofxVec3f( upAxis );
	ofxVec3f v2 = ya.cross( v1 );
	ofxVec3f v3 = v1.cross( v2 ).normalize();
	
	trailDirection[ 0 ] = v3.x;
	trailDirection[ 1 ] = v3.y;
	trailDirection[ 2 ] = v3.z;
}
Esempio n. 28
0
int YesNoObjectSoft::genShapeProgramatically() {

    suddenMotion = false;

    ofxVec3f cen = yesORno->getBodyCentroid();
    vector<int> sortedFaces = yesORno->sortFaceByPosition(cen);
    int fid = sortedFaces[ofRandom(0, sortedFaces.size()-1*0.3)];
    incomingSMSFaceID = fid;

    vector<ofxVec3f> face = yesORno->getFaceAsVerts(fid);
    ofxVec3f fa = face[0];
    ofxVec3f fb = face[1];
    ofxVec3f fc = face[2];
    ofxVec3f normc = yesORno->getFaceNormal(fid);
    normc *= height;
    ofxVec3f cenc = yesORno->getFaceCentroid(fid);
    cenc += normc;
    smsPosition = ofxVec3f(cenc.x, cenc.y, cenc.z);
    addedSMSFaces.clear();
    addedSMSFaces.push_back(fb);
    addedSMSFaces.push_back(cenc);
    addedSMSFaces.push_back(fa);
    addedSMSFaces.push_back(fc);
    addedSMSFaces.push_back(cenc);
    addedSMSFaces.push_back(fb);
    addedSMSFaces.push_back(fa);
    addedSMSFaces.push_back(cenc);
    addedSMSFaces.push_back(fc);

    fillMeshInput();

    yesORno->remove(bullet->getSoftDynamicsWorld());
    delete yesORno;
    yesORno = bullet->createSoftTriMesh(ofxVec3f(0, 0, 0), &floatVertices[0], &faceIndices[0], numFace);

    addedSMSFaces.clear();

    objCentroid = yesORno->getBodyCentroid();

    btSoftBody::tFaceArray& faces(yesORno->getSoftBody()->m_faces);
    return (int)faces.size();
}
Esempio n. 29
0
particle::particle( ofxVec3f _pos, int _id, float _size, ofTexture _tex ) {
	
    ofSetCircleResolution(22);				// reduce circle res for performance
    
    texture = _tex;
	pos = _pos;								// get birth place from pixels
	pId = _id;
    size = _size;
    
    life = (int)ofRandom(10, 50);           // set particle life span
	initLife = life;

    vel = ofxVec3f(0,0,0);					// initiate velocity	
	acc = ofxVec3f(0,0,0);					// initiate acceleration
	damping = 1; //2; //0.05;
    
    myMask.loadImage("mask.tif");
	myMask.resize(size*2,size*2);

}
Esempio n. 30
0
Particle::Particle(float x, float y, int nhmin, int nhmax){

  this->position = ofxVec3f(x,y); 
  this->velocity = ofxVec3f(0, 0);
  this->accel   = ofxVec3f(0, 0); 
  ttl = PARTICLE_TTL; 
  vDamping = 0.01f;
  aDamping = 0.0f;
  fuzz = 0.0;
  
  numH = ofRandom(nhmin,nhmax); 

  velocityMultiplier = VELOCITY_MULTIPLIER;
  r = 0.0f; 
  g = 0.0f;
  b = 0.0f; 

  alpha = 0;


}