Ejemplo n.º 1
0
//--------------------------------------------------------------
void JiveScreen::updateChoreoPosition(vector< vector<int> > choreo, int step, bool bdisplayPrevious, bool bdisplayIcon, bool bcloser, bool bbox)
{
    // CURRENT POSITION ------------------------
    char side;
    if(choreo[step][3] == 5)
    {
        
    }
    if(choreo[step][2] == 0)
    {
        positionCurr.x = choreo[step][0]-config.distanceFeet;
        side = 'l';
    }
    else
    {
        positionCurr.x = choreo[step][0]+config.distanceFeet;
        side = 'r';
    }
    //if(step == 0) positionCurr.x = choreo[step][0]-config.distanceFeet;
    positionCurr.y = choreo[step][1];
    
    
    // TWEEN ---------------------------------
    // determine previous position (origin of the transition)
    previousSideStep = step-2;
    if(previousSideStep == -2) previousSideStep = 6;
    if(previousSideStep == -1) previousSideStep = 7;
    
    // get position of previous step
    if(choreo[previousStep][2] == 0)
    {
        positionPrev.x = choreo[previousSideStep][0]-config.distanceFeet;
    }else{
        positionPrev.x = choreo[previousSideStep][0]+config.distanceFeet;
    }
    positionPrev.y = choreo[previousSideStep][1];
    
    // get distance
    int d=0;
    if(bcloser) d=config.distanceMoveJive;
    
    // init master
    tweenPositionMaster(footPositions, positionUpdate, positionPrev, positionCurr, choreo, step, side, 'm', bdisplayIcon, false, bdisplayPrevious, false, bcloser);
    
    int alphaBox = 170;
    // leader 1
    ofPushMatrix();
    ofTranslate(cX1+d, cY1);
    ofRotateZ(config.rotateZ);
    if(bbox)
    {
        ofSetColor(255, alphaBox);
        ofNoFill();
        ofSetLineWidth(3);
        ofRect(0, 0, boxWidth, boxHeight);
        ofFill();
    }
    tweenPositionSlave(footPositions, positionUpdate, positionCurr, choreo, step, side, 'm', bdisplayIcon, bdisplayPrevious, false, bcloser);
    ofPopMatrix();
    
    // follower 1
    ofPushMatrix();
    ofTranslate(cX2-d, cY1);
    ofRotateZ(config.rotateZ);
    if(bbox)
    {
        ofSetColor(255, alphaBox);
        ofNoFill();
        ofSetLineWidth(3);
        ofRect(0, 0, boxWidth, boxHeight);
        ofFill();
    }
    tweenPositionSlave(footPositions, positionUpdate, positionCurr, choreo, step, side, 'f', bdisplayIcon, bdisplayPrevious, false, bcloser);
    ofPopMatrix();
    
    // leader 2
    ofPushMatrix();
    ofTranslate(cX3-d, cY2);
    ofRotateZ(config.rotateZ-180);
    if(bbox)
    {
        ofSetColor(255, alphaBox);
        ofNoFill();
        ofSetLineWidth(3);
        ofRect(0, 0, boxWidth, boxHeight);
        ofFill();
    }
    tweenPositionSlave(footPositions, positionUpdate, positionCurr, choreo, step, side, 'm', bdisplayIcon, bdisplayPrevious, false, bcloser);
    ofPopMatrix();
    
    // follower 2
    ofPushMatrix();
    ofTranslate(cX4+d, cY2);
    ofRotateZ(config.rotateZ-180);
    if(bbox)
    {
        ofSetColor(255, alphaBox);
        ofNoFill();
        ofSetLineWidth(3);
        ofRect(0, 0, boxWidth, boxHeight);
        ofFill();
    }
    tweenPositionSlave(footPositions, positionUpdate, positionCurr, choreo, step, side, 'f', bdisplayIcon, bdisplayPrevious, false, bcloser);
    ofPopMatrix();
}
Ejemplo n.º 2
0
void UR5KinematicModel::draw(bool bDrawDebug){
    
    if(bDrawDebug) {
        ofPushStyle(); {
            ofDrawAxis(1000);
            ofSetColor(255, 255, 0);
            ofDrawSphere(tool.position*ofVec3f(1000, 1000, 1000), 4);
            ofSetColor(225, 225, 225);
        } ofPopStyle();
    }
    
    if(bDrawModel){
        ofQuaternion q;
        ofVec3f offset;
        
        ofMatrix4x4 gmat;
        gmat.makeIdentityMatrix();
        gmat.makeScaleMatrix( 1, 1, 1 );
        
        ofPushMatrix();
        {
            ofPushMatrix();
            {
                for(int i = 0; i < joints.size(); i++)
                {
                    float x;
                    ofVec3f axis;
                    q = joints[i].rotation;
                    q.getRotate(x, axis);
                    ofTranslate(joints[i].offset*1000);
                    gmat.translate( joints[i].offset*1000 );
                    
                    if(bDrawDebug) {
                        ofDrawAxis(10);
                    }
                    ofMatrix4x4 tmat;
                    if(i >= 3){
                        ofPushMatrix();
                        {
                            ofRotateZ(-180);
                            ofRotateX(-180);
                            ofScale(100, 100, 100);
                            meshs[i].draw();
                        }
                        ofPopMatrix();
                    }
                    ofRotate(x, axis.x, axis.y, axis.z);
                    if(i < 3){
                        ofPushMatrix(); {
                            ofRotateZ(-180);
                            ofRotateX(-180);
                            ofScale(100, 100, 100);
                            
                            meshs[i].draw();
                        } ofPopMatrix();
                    }
                }
                toolMesh.draw();
            }
            ofPopMatrix();
        }
        ofPopMatrix();
        
        if (bDrawDebug) {
            ofPushMatrix();
            {
                //            ofRotate(180, 0, 0, 1);
                for(int i = 0; i < nodes.size(); i++){
                    nodes[i].draw();
                }
                tcpNode.draw();
            }
            ofPopMatrix();
        }
    }
}
Ejemplo n.º 3
0
/// \brief Callback de dessin
///
/// \return void
///
///
void Danseur::draw()
{
    if(Dessinable())
    {
        if(toBeDrawn)
        {
            ofPushStyle();
            ofEnableAlphaBlending();
            ofSetColor(255, 255, 255, Alpha() * 255);
            ofTrueTypeFont * text = _ttfText;

            if(bHugeText)
            {
                text = _ttfTextHuge;
            }

            float angleStep(0);
            float angle(0);

            if(Animable())
            {
                angleStep = 360 / 5.0f;
                angle = ofRadToDeg(_coteAngle.getCurrentValue()) + _coteAngleOffset;
            }

            ofPushStyle();
            ofPushMatrix();
            ofTranslate(x, y);

            if(toBeDrawn & DANSEUR_TIME)
            {
                angle += angleStep;
                ofPushMatrix();
                ofRotateZ(angle);
                text->drawString(_cote, offset(), 0);
                ofPopMatrix();
            }

            if(Animable())
            {
                if(toBeDrawn & DANSEUR_XPOS)
                {
                    angle += angleStep;
                    ofPushMatrix();
                    ofRotateZ(angle);
                    text->drawString("x=" + ofToString(x), offset(), 0);
                    ofPopMatrix();
                }

                if(toBeDrawn & DANSEUR_YPOS)
                {
                    angle += angleStep;
                    ofPushMatrix();
                    ofRotateZ(angle);
                    text->drawString("y=" + ofToString(y), offset(), 0);
                    ofPopMatrix();
                }

                if(toBeDrawn & DANSEUR_ANGLE)
                {
                    angle += angleStep;
                    ofPushMatrix();
                    ofRotateZ(angle);
                    ofVec2f O(ofGetWidth() / 2.0f, ofGetHeight() / 2.0f);
                    std::stringstream valeurAngle;
                    valeurAngle << std::fixed << std::setprecision(2) << Tools::getAngle((*this), O);
                    text->drawString("T=" + valeurAngle.str() + "°", offset(), 0);
                    ofPopMatrix();
                }

                if(toBeDrawn & DANSEUR_CONSTANTE)
                {
                    angle += angleStep;
                    ofPushMatrix();
                    ofRotateZ(angle);
                    text->drawString("a=" + ofToString(M_PI), offset(), 0);
                    ofPopMatrix();
                }
            }

            ofPopMatrix();
            ofDisableAlphaBlending();
            ofPopStyle();
        }
    }
}
Ejemplo n.º 4
0
//--------------------------------------------------------------
void testApp::draw(){
    
    // draw the bug holes
    for(unsigned int i=0; i<holes.size(); i++) {
        ofSetColor(100);
        ofCircle(holes[i], 10);
        ofSetColor(40);
        ofCircle(holes[i], 7);
    }
    
    for(unsigned int i=0; i<bugs.size(); i++) {
        bugs[i].draw();
    }
    
    // draw the bullets
    for(unsigned int i=0; i<bullets.size(); i++) {
        bullets[i].draw();
    }
    
    
    
    // game stats
    ofSetColor(10);
    ofDrawBitmapString("Bullets "+ofToString(bullets.size())+"\nBugs Killed: "+ofToString(bugsKilled), 20, 20);
    
    
    // gun
    ofVec2f gunPos(ofGetWidth()/2, ofGetHeight()-20);
    ofVec2f mousePos(ofGetMouseX(), ofGetMouseY());
    
    // get the vector from the mouse to gun
    ofVec2f vec = mousePos - gunPos;
    vec.normalize();
    vec *= 100;
    
    // get the angle of the vector for rotating the rect
    float angle = ofRadToDeg(atan2(vec.y, vec.x)) - 90;
    
    ofPushMatrix();
    ofTranslate(gunPos.x, gunPos.y);    
    ofRotateZ(angle);
    
    ofFill();
    ofSetColor(10);
    ofRect(-10, 0, 20, 100);
    
    float bulletPct = ofMap(bullets.size(), 0, maxBullets, 0.0, 100.0);
    ofSetColor(100);
    ofRect(-10, 0, 20, bulletPct);
    
    ofSetColor(100);
    ofRect(-10, 90, 20, 10);
    
    if(bFire) {
        ofSetColor(220, 0, 0);
        ofRect(-10, 97, 20, 3);
    }
    ofPopMatrix();
    
    ofSetColor(255);
    ofCircle(gunPos.x, gunPos.y, 2);
    
}
Ejemplo n.º 5
0
void DomeData :: draw() {
	editable = gui.getVisible();
	
	if(!editable) return;

	//level1.draw();
	
	
	ofPushStyle();
	ofPushMatrix();
	ofTranslate(940,480);
	
	level1Handle.render();
	level2Handle.render();
	level3Handle.render();
	level4Handle.render();
	startHandle.render();
	c1Handle.render();
	c2Handle.render();
	endHandle.render();
	
	
	ofSetLineWidth(3);
	ofSetColor(255,0,255);
	ofBezier(start, c1, c2, end);
	ofLine(start, c1);
	ofLine(end,c2);
	
	ofSetColor(0,255,255);
	
	ofTranslate(-300,0);
	
	ofPopMatrix();
	ofPushMatrix();
	
	ofTranslate(pos);
	
	ofRotateX(rotation->x);
	ofRotateY(rotation->y);
	ofRotateZ(rotation->z);
	ofScale(scale, scale, scale);

	
	ofSetColor(255, 100);
	ofSetLineWidth(0.5);

	ofPushMatrix();
	ofScale(scaleXY->x, scaleXY->y, scaleXY->z);
	for(float x = level4->x; x <= -level4->x; x+= level4->x / -5.0f) {
		ofLine(x, level4->y, x, end->y);
	}
	for(float y = level4->y; y >= end->y; y+= (end->y - level4->y)/10.0f) {
		
		ofLine(level4->x, y, -level4->x, y);
	}
	
	
	ofPopMatrix();
	
	ofSetColor(0,255,0);
	ofPoint scalarXY = scaleXY.get(); 
	
	for(float angle = 0; angle>= -90; angle-=divAngle) {
			ofPushMatrix();
			ofRotateY( angle);
			ofScale(scaleXY->x, scaleXY->y, scaleXY->z);
			ofSetLineWidth(0.5);

			ofBezier(start, c1, c2, end);
			ofSetLineWidth(3);
			
			ofCircle(level1, 1);
			ofCircle(level2, 1);
			ofCircle(level3, 1);
			ofCircle(level4, 1);

			ofPopMatrix();
			
			ofPushMatrix();
			ofRotateY( -180 - angle);
			ofScale(scaleXY->x, scaleXY->y, scaleXY->z);
			ofSetLineWidth(0.5);
			
			//ofBezier(start, c1, c2, end);
			ofSetLineWidth(3);
			
			ofCircle(level1, 1);
			ofCircle(level2, 1);
			ofCircle(level3, 1);
			ofCircle(level4, 1);
			
			ofPopMatrix();
			
	}

	ofPopStyle();
	ofPopMatrix();
	
	
	//gui.draw();
	
}
Ejemplo n.º 6
0
//--------------------------------------------------------------
void testApp::draw(){
	
	ofClear(255, 255, 255, 0);
	ofSetColor(255, 255, 255,255);
	
	//Draw Flying Videos
	drawBoids();
	
	//Clear Background
	ofClear(255, 255, 255, 0); //Tranparent Background)
	ofBackground(255, 255, 255, 0); //Tranparent Background
	
	//Text 
	ofFill();
	
    if (cvImgDisp) {
         ofSetColor(255, 0, 0); // RED FOR DEBUG
    }else{
        ofSetColor(255, 255, 255,255); // White for display color
    }
   
	drawText();
	
	
	
	ofSetColor(210, 229, 247, 255);  //BACKGROUND FOR FLYERS
	ofRect(0,0, ofGetWidth(), ofGetHeight());     
	ofSetColor(255, 255, 255,255);
	////COVER TEXT
	
	
	//Cutout
	
    ofSetColor(255, 255, 255,255); //ofSetColor can change the tint of an image, this resets is
	cutoutTex.draw(0-videoPos,(ofGetHeight()/2)-(camHeightScale/2) , camWidthScale, camHeightScale);  // correct proportions
	
    
    
        
	//Show the 'End Record Sequence'
	if (endRecordSequence == true) {
		
		string goodbye = "Tu voles maintenant sur la Carte Blanche!";
		ofPushStyle();
		ofSetColor(28, 20, 255);
		ofPushMatrix();
		
		ofTranslate(900, (ofGetHeight()/2)+350);
		
		ofRotateZ(-90);
		
		shimmer.drawString(goodbye, 0, 0);
		ofPopMatrix();
		ofPopStyle();
		
	}
    
	//Tell people that the buffer is full if that is true
    if (bufferFull && !endRecordSequence) {
        
        string full = "La carte est plein! Jouer, mais le system t'enrigistre pas";
		ofPushStyle();
		ofSetColor(28, 20, 255);
		
		ofPushMatrix();
		ofTranslate(900, (ofGetHeight()/2)+480);
		ofRotateZ(-90);
		shimmer.drawString(full, 0, 0);
		ofPopMatrix();
		ofPopStyle();
        
    }
	
	//Progress bar for recording
	ofRect(800,(ofGetHeight()/2), 20, (100-index)*2); 
	ofRect(800,(ofGetHeight()/2), 20, -(100-index)*2);
	
	
	//Debug Functions
	shimmer.drawString(ofToString(showState), ofGetWidth()-50, ofGetHeight()-50);
	
	if (cvImgDisp) {
		cvImages();
	}
    
	//get the last playIndex before the program loops back 
    lastPlayIndex = playIndex; 
	
	 
}
Ejemplo n.º 7
0
//--------------------------------------------------------------
void osxVoiceOverApp::draw(){
	
	int i;
	int l;
	
	// Draw Gradient Background
	glBegin(GL_QUAD_STRIP);  
    glColor3f(250, 250, 250);  
    glVertex3f(0, 0, 0);  
    glVertex3f(windowWidth, 0, 0);  
	
	glColor3f(243, 243, 243);  
    glVertex3f( 0, windowHeight,0);  
    glVertex3f( windowWidth, windowHeight, 0);  
	glEnd(); 
	
	// Draw Play message text
	l = controlsVector[0].size();
	for (i = 0; i < l; i++) {
		
		string controls = controlsVector[0][i];
		
		if(strcmp(controlsVector[0][i].c_str(), currentControl.c_str())==0){
			ofSetColor(97, 160, 249);
		} else {
			ofSetColor(153, 153, 153);	
		}
		
		myraidFont.drawString(controls, (i * windowWidth/4)+25, windowHeight-25);
	}
	
	// Draw voices text
	int angle = 0;
	ofPoint vPoint;
	ofPoint lPoint;
	
	for (i =0; i < NUM_VOICES; i++) {
		
		angle = i * (360/NUM_VOICES);
				
		vPoint.x = windowCenterX + cos(ofDegToRad(angle)) * 140;
		vPoint.y = windowCenterY + sin(ofDegToRad(angle)) * 140;
		
		lPoint.x = windowCenterX + cos(ofDegToRad(angle)) * 120;
		lPoint.y = windowCenterY + sin(ofDegToRad(angle)) * 120;
		
		if(i == voiceIncrementer){
			ofSetColor(97, 160, 249);
		} else {
			ofSetColor(153, 153, 153);
		}
		
		ofLine(windowCenterX, windowCenterY, lPoint.x, lPoint.y);
		ofPushMatrix();
		ofTranslate(vPoint.x,vPoint.y,0);
		ofRotateZ(angle);
		myraidFont.drawString(voiceArray[i].c_str(), 0, 0);
		ofPopMatrix();
	}
	
	// Draw the Universal Access icon
	ofSetColor(255, 255, 255);
	ofEnableAlphaBlending();
	universalAccessIcon.draw(windowCenterX-(universalAccessIcon.width/2), windowCenterY-(universalAccessIcon.height/2));
	ofDisableAlphaBlending();
}
Ejemplo n.º 8
0
//--------------------------------------------------------------
void testApp::draw(){

	ofSetColor(245, 58, 135);
	verdana14.drawString("anti aliased", 145, 92);
	verdana14.drawString("anti aliased", 145, 195);
	verdana14A.drawString("aliased", 525, 92);
	
	ofSetColor(225);
	verdana14.drawString("verdana 14pt - ", 30, 92);
	verdana14.drawString(typeStr, 30, 111);

	verdana14A.drawString("verdana 14pt - ", 422, 92);
	ofRect(420, 97, 292, 62);
	ofSetColor(54, 54, 54);	
	verdana14A.drawString(typeStr, 422, 111);
	

	ofSetColor(29,29,29);
	ofLine(30, 169, ofGetWidth()-4, 169);

	ofSetColor(225);
	verdana14.drawString("verdana 30pt - ", 30, 195);
	verdana30.drawString(typeStr, 30, 229);

	ofSetColor(29,29,29);
	ofLine(30, 312, ofGetWidth()-4, 312);

	ofSetColor(245, 58, 135);
	franklinBook14.drawString("anti aliased", 162, 338);
	franklinBook14A.drawString("aliased", 555, 338);
	
	ofSetColor(225);
	franklinBook14.drawString("franklin book 14pt - ", 30, 338);
	franklinBook14.drawString(typeStr, 30, 358);

	franklinBook14A.drawString("franklin book 14pt - ", 422, 338);
	ofRect(420, 345, 292, 62);
	ofSetColor(54, 54, 54);	
	franklinBook14A.drawString(typeStr, 422, 358);

	ofSetColor(29,29,29);
	ofLine(30, 418, ofGetWidth()-4, 418);

	ofSetColor(225);	
	verdana14.drawString("ROTATION", 30, 445);
	verdana14.drawString("SCALE", 422, 445);
	
	ofPushMatrix();
		string rotZ = "Rotate Z";
		ofRectangle bounds = verdana30.getStringBoundingBox(rotZ, 0, 0);
		
		ofTranslate(110 + bounds.width/2, 500 + bounds.height / 2, 0);
		ofRotateZ(ofGetElapsedTimef() * -30.0);
				
		verdana30.drawString(rotZ, -bounds.width/2, bounds.height/2 );
	ofPopMatrix();

	ofPushMatrix();
		string scaleAA = "SCALE AA";
		bounds = verdana14.getStringBoundingBox(scaleAA, 0, 0);
		
		ofTranslate(500 + bounds.width/2, 480 + bounds.height / 2, 0);
		ofScale(2.0 + sin(ofGetElapsedTimef()), 2.0 + sin(ofGetElapsedTimef()), 1.0);
				
		verdana14.drawString(scaleAA, -bounds.width/2, bounds.height/2 );
	ofPopMatrix();	

	ofPushMatrix();
		string scaleA = "SCALE ALIASED";
		bounds = verdana14A.getStringBoundingBox(scaleA, 0, 0);
		
		ofTranslate(500 + bounds.width/2, 530 + bounds.height / 2, 0);
		ofScale(2.0 + cos(ofGetElapsedTimef()), 2.0 + cos(ofGetElapsedTimef()), 1.0);
				
		verdana14A.drawString(scaleA, -bounds.width/2, bounds.height/2 );
	ofPopMatrix();	
	
}
Ejemplo n.º 9
0
//--------------------------------------------------------------
void testApp::draw(){
    
    //DRAW TEXTURE
    baseFbo.begin();
    ofClear(0,0,0,0);
    ofBackground(backR, backG, backB);
    ofPushMatrix();
    ofTranslate(w/2, h/2);
    ofRotateZ(barRot);
    
    barw = w/barsInt;
    barh = h;
    
    for(int i = 0; i<barsInt;i++) {
        if(i%2 == 1) {
            cout<<"EVEN STEVEN"<<endl;
            ofSetColor(bariR, bariG, bariB);
            ofRect(i*barw-w/2, 0-h/2, barw, barh);
            cout<<barw<<endl;
        } else {
            ofSetColor(barjR, barjG, barjB);
            ofRect(i*barw-w/2, 0-h/2, barw, barh);
            cout<<"ODD TODD"<<endl;
        }
    }
    ofPopMatrix();
    baseFbo.end();
	
    tex1 = baseFbo.getTextureReference();
    
    ofEnableNormalizedTexCoords(); //This lets you do 0-1 range instead of 0-640 (in pixels)
    
    ///ChromaAb FBO-------------------------------------
    //This is not drawn anywhere...it is just drawn into an FBO which is then used by the bloom+brcosa shader
    chromaFbo.begin();
    ofClear(0,0,0,0);
    tex1.bind();
    chromaShader.begin();
    chromaShader.setUniformTexture("tex", tex1, 0);
    chromaShader.setUniform2f("windowSize", w, h);
    chromaShader.setUniform1f("offsetALL", chromaShift);
    
    glBegin(GL_QUADS);
    glTexCoord2f(0,0); glVertex3f(0,0,0);
    glTexCoord2f(1,0); glVertex3f(w,0,0);
    glTexCoord2f(1,1); glVertex3f(w,h,0);
    glTexCoord2f(0,1); glVertex3f(0,h,0);
    glEnd();
    chromaShader.end();
    tex1.unbind();
    chromaFbo.end();
    
    ///ChromaAb mixed with Wobble-------------------------------------
    //ofTexture fboTex2;
    tex2 = chromaFbo.getTextureReference(); //I did it this way because using it as brcosaFbo.getTextureReference().bind() wasnt working correctly
    
    //Mix chromaab with wobble
    comboFbo.begin();
    tex2.bind();
    wobbleShader.begin();
    wobbleShader.setUniformTexture("image", tex2, 0);
    wobbleShader.setUniform2f("amp", wobbleAmpx, wobbleAmpy); //These settings are finicky. Be careful with your ranges
    wobbleShader.setUniform2f("freq", .2+(.5*cos(wobbleFreqx)),.2+(.2*cos(wobbleFreqy)));
    wobbleShader.setUniform1f("radius", 15+(80*sin(wobbleRad)));
    
    ofPushMatrix();
    ofTranslate(0, 00);
    glBegin(GL_QUADS);
    glTexCoord2f(0,0); glVertex3f(0,0,0);
    glTexCoord2f(1,0); glVertex3f(w,0,0);
    glTexCoord2f(1,1); glVertex3f(w,h,0);
    glTexCoord2f(0,1); glVertex3f(0,h,0);
    glEnd();
    ofPopMatrix();
    wobbleShader.end();
    tex2.unbind();
    comboFbo.end();
    
    
    tex3=comboFbo.getTextureReference();
    finalFbo.begin();
    tex3.bind();
    fishShader.begin();
    fishShader.setUniformTexture("tex0", tex3, 0);
    fishShader.setUniform1f("signcurvature", 3+1.5*sin(PI));
    fishShader.setUniform1f("lensradius", fishRad);
    
    ofPushMatrix();
    ofTranslate(0, 0);
    glBegin(GL_QUADS);
    glTexCoord2f(0,0); glVertex3f(0,0,0);
    glTexCoord2f(1,0); glVertex3f(w,0,0);
    glTexCoord2f(1,1); glVertex3f(w,h,0);
    glTexCoord2f(0,1); glVertex3f(0,h,0);
    glEnd();
    ofPopMatrix();
    fishShader.end();
    tex3.unbind();
    finalFbo.end();
    
    tex4=finalFbo.getTextureReference();
    
    tex4.bind();
    glitchShader.begin();
    glitchShader.setUniformTexture("tex0", tex4, 0); //Base input
    glitchShader.setUniformTexture("tex1", tex3, 1); //Distortion + color map based on greyscale values
    glitchShader.setUniform1f("barsamount", glitchBars); //Color displacement
    glitchShader.setUniform1f("distortion", glitchDist); //Distortion
    glitchShader.setUniform1i("resolution", glitchRes); //scanline resolution
    glitchShader.setUniform1f("vsync", glitchVs); //Vertical offset
    glitchShader.setUniform1f("hsync", glitchHs); //Horizontal offset
    
    ofPushMatrix();
    ofTranslate(0, 0);
    glBegin(GL_QUADS);
    glTexCoord2f(0,0); glVertex3f(0,0,0);
    glTexCoord2f(1,0); glVertex3f(w,0,0);
    glTexCoord2f(1,1); glVertex3f(w,h,0);
    glTexCoord2f(0,1); glVertex3f(0,h,0);
    glEnd();
    ofPopMatrix();
    glitchShader.end();
    tex4.unbind();

	if( bHide ){
		gui.draw();
	}
}
void GiorgiaStars2::update(const string childName, const string fontName)  {
    ofLog() << "giorgia stars  2 update, load font " << fontName;
    font.load(fontName, 400);
    _childName = childName;
    _drawFontFbo.clear();
    _drawFontFbo.allocate(quadWarper.getWidth(), quadWarper.getHeight(), GL_RGB);
    _drawFontFbo.begin();
    sdfPixels.setColor(ofColor(0));
    ofClear(0, 0, 0);
    ofPushMatrix();
    ofTranslate(400, 1500);//THIS IS JUST A GUESS REALLY
    ofRotateY(40);
    ofRotateZ(-10);
    ofSetColor(255, 255, 255);
    ofSetBackgroundColor(255, 0, 0);
    ofScale(1 / SCREEN_SCALE_FACTOR, 1 / SCREEN_SCALE_FACTOR);
    //TODO -rotate scale, warp etc
    font.drawString(_childName, 0, 100);//TODO - position this properly
    ofPopMatrix();
    _drawFontFbo.end();
    ofxCvGrayscaleImage grayScaleCvImg;
    ofPixels pixels;
    pixels.allocate(_drawFontFbo.getWidth(), _drawFontFbo.getHeight(), OF_PIXELS_RGB);
    _drawFontFbo.readToPixels(pixels);
    ofxCvColorImage colorCvImage;
    colorCvImage.setFromPixels(pixels);
    grayScaleCvImg = colorCvImage;
    
    grayScaleCvImg.threshold(80);
    int minBlobArea = 50 * 50;
    int maxBlobArea = grayScaleCvImg.width * grayScaleCvImg.height;
    int t1 = ofGetUnixTime();
    int result = contourFinder.findContours(grayScaleCvImg, minBlobArea, maxBlobArea, childName.size() * 4, true);
    
    auto iter = contourFinder.blobs.begin();
    int bCount = 0;
    float mDist = 70;
    while(iter != contourFinder.blobs.end())
    {
        ofxCvBlob blob = *iter;
        
        ofRectangle rect = blob.boundingRect;
                
        if(!blob.hole)
        {
            int l = (int)rect.getLeft();
            int r = (int)rect.getRight();
            int t = (int)rect.getTop();
            int b = (int)rect.getBottom();
            ofPoint p;
            ofPolyline polyLine;
            polyLine.addVertices(blob.pts);
            polyLine.close();
            for(int col = l; col<=r; col++)
            {
                for(int row = t; row<=b; row++)
                {
                    if(pixels.getColor(col, row).r > 0)
                    {
                        float minDist = mDist;
                        p.set(col, row);
                        auto closestPoint = polyLine.getClosestPoint(p);
                        minDist = min(p.distance(closestPoint), minDist);
                        
                        int r = (int)(255 * (mDist - minDist) / mDist);
                        ofColor color = sdfPixels.getColor(col, row) + ofColor(r, 0, 255);
                        
                        sdfPixels.setColor(col, row, color);
                    }
                }
            }
        }
        else{
            //TODO : do the same thing for the outside ring of the blob bounding rect
            rect.setFromCenter(blob.centroid.x, blob.centroid.y, rect.width * 2, rect.height * 2);
            ofPoint p;
            ofPolyline polyLine;
            polyLine.addVertices(blob.pts);
            polyLine.close();
            int l = (int)rect.getLeft();
            int r = (int)rect.getRight();
            int t = (int)rect.getTop();
            int b = (int)rect.getBottom();
            
            for(int col = l; col<=r; col++)
            {
                for(int row = t; row<=b; row++)
                {
                    if(pixels.getColor(col, row).r > 0)
                    {
                        float minDist = mDist;
                        p.set(col, row);
                        auto closestPoint = polyLine.getClosestPoint(p);
                        minDist = min(p.distance(closestPoint), minDist);
                        
                        int r = (int)(255 * (mDist - minDist) / mDist);
                        ofColor color = sdfPixels.getColor(col, row) + ofColor(r, 0, 255);
                        sdfPixels.setColor(col, row, color);
                    }
                }
            }
        }
            
        bCount++;
        
        iter++;
    }
    
    ofLog() << " blobs sorted out in " << (ofGetUnixTime() - t1);
    sdfImage.setFromPixels(sdfPixels);
    pixels.clear();
    
}
Ejemplo n.º 11
0
void olegVeraV::draw(){
    curveHeight=pow(abs(sin(ofGetElapsedTimef())),0.3)*30+14;
    
    ofBackground(0);
    ofSetColor(255);
    ofFill();
    ofPath circ;
    
    int shapes_amount=elementsAmount;
    float _thickness = thickness;
    float step=10;
    float min_w=10;
    
    
    ofPushMatrix();
    ofTranslate(dimensions.width/4*3,0);
    ofRotateZ(-45);
    
    
    for (int k=0; k<shapes_amount; k++)
    {
        
        
        
        _thickness*=thicknessMultiplier;
        step=_thickness;
        
        int _w = min_w+(k+1)*(_thickness+step)*2;
        float _h = 100;
        float y_offset=_w/2;
        
        float curve_max_h=curveHeight/100*_w/2;
        
        _h=curve_max_h*k/shapes_amount;
        
        ofPoint p1=  ofPoint(-_w/2,y_offset,0);
        ofPoint p2=  ofPoint(0,_h+y_offset,0);
        ofPoint p3= ofPoint(_w/2,y_offset,0);
        circ.setCurveResolution(20);
        circ.quadBezierTo(p1,p2,p3);
        
        p1.y+=_thickness;
        p1.x-=_thickness;
        p2.y+=_thickness;
        p3.y+=_thickness;
        p3.x+=_thickness;
        
        circ.lineTo(p3);
        circ.quadBezierTo(p3,p2,p1);
        
        p1.y-=_thickness;
        circ.lineTo(p1);
        
        
        p1=  ofPoint(-_w/2,y_offset,0);
        p2=  ofPoint(-_w/2-_h, y_offset-_w/2,0);
        p3= ofPoint(-_w/2,y_offset-_w,0);
        circ.setCurveResolution(20);
        circ.quadBezierTo(p1,p2,p3);
        p1.y+=_thickness;
        p1.x-=_thickness;
        p2.x-=_thickness;
        p3.x-=_thickness;
        p3.y-=_thickness;
        circ.lineTo(p3);
        circ.quadBezierTo(p3,p2,p1);
        
        p1.y-=_thickness;
        
        circ.lineTo(p1);
        circ.draw();
        circ.close();
        
        
        
    }
    ofPopMatrix();
}
Ejemplo n.º 12
0
void testApp::drawBola4(ofVec2f pos, float radius, float rot) {
	ofVec2f vx = ofVec2f(1,0);
	ofVec2f centroScreen = ofVec2f(ofGetWidth()/2, ofGetHeight()/2);
	ofVec2f posCentro =  pos-centroScreen;
	float angulo = vx.angle(posCentro);
	while(angulo<0) {angulo+=360.0;}
	
	ofPushMatrix();
	ofPushStyle();
	ofFill();
	ofTranslate(pos.x,pos.y,0);
	if(angulo>=0 && angulo<90) {
		float rr = 2*radius;
		ofSetColor(ofColor::royalBlue, 200);
		bola.draw(-rr,-rr,2*rr,2*rr);
		ofTranslate(-posCentro.x,-posCentro.y,0);
		ofSetColor(ofColor::royalBlue, 80);
		ofSetLineWidth(0.2);
		ofLine(0,0,  posCentro.length()*cos(angulo*DEG_TO_RAD), posCentro.length()*sin(angulo*DEG_TO_RAD));
		ofPolyline arco;
		arco.arc(ofPoint(0,0), posCentro.length(), posCentro.length(),0, 90);
		arco.draw();
		
	}
	
	else if(angulo>=90 && angulo<180) {
		float rr = 6*radius;
		ofSetColor(ofColor::green, 200);
		bola.draw(-rr,-rr,2*rr,2*rr);
	}
	else if(angulo>=180 && angulo<270) {
		//			ofSetColor(ofColor::deepPink, 200);
		//			bola.draw(-rr,-rr,2*rr,2*rr);
		ofSetColor(150 + ofRandom(155));
		ofCircle(0,0,radius/8);
	}
	else if(angulo>=270 && angulo<360) {
		ofEnableBlendMode(OF_BLENDMODE_ADD);

		if(fRed) {
			float rr = 2*radius;
			ofSetColor(ofColor::red, 150);
	//		ofSetColor(ofColor::darkBlue  , 150);
			bola.draw(-rr,-rr,2*rr,2*rr);
			
			ofPushMatrix();
			ofTranslate(-pos.x, -pos.y, 0);
			ofTranslate(ofGetWidth()/2, ofGetHeight()/2, 0);
			float rot = 2*(315-angulo);
			ofRotate(rot);
			ofTranslate(posCentro.x, posCentro.y,0);
			ofSetColor(ofColor::darkRed  , 150);
			rr = 2*radius;
			bola.draw(-rr,-rr,2*rr,2*rr);
			ofPopMatrix();
		}
		else {
			float rr = 0.7*radius;
			ofRotate(rot);
			ofSetColor(ofColor::red, 150);
			//		ofSetColor(ofColor::darkBlue  , 150);
			ofPushMatrix();
			ofTranslate(radius,0,0);
			bola.draw(-rr,-rr,2*rr,2*rr);
			ofPopMatrix();
			
			ofSetColor(ofColor::blue, 150);
			ofPushMatrix();
			ofRotateZ(120);
			ofTranslate(radius,0,0);
			bola.draw(-rr,-rr,2*rr,2*rr);
			ofPopMatrix();
			
			ofSetColor(ofColor::green, 150);
			ofPushMatrix();
			ofRotateZ(240);
			ofTranslate(radius,0,0);
			bola.draw(-rr,-rr,2*rr,2*rr);
			ofPopMatrix();
			
		}
		ofDisableBlendMode();
	}
	
	ofPopStyle();
	ofPopMatrix();	
}
Ejemplo n.º 13
0
//--------------------------------------------------------------
void JiveScreen::draw()
{
    currentPlayerPos = player.getPositionMS();
    
    if(player.getPosition() < 1.0)
    {
        currentPlayerPos = roundUp(currentPlayerPos/100);
        cout << currentPlayerPos << endl;
        
        // INDIVIDUAL PRACTICE ------------------------------------
        if(currentPlayerPos >= startPlayerPos_R1
           && currentPlayerPos <= stopPlayerPos_R1)
        {
            updateChoreoPosition(role, currentStep, true, true, false, false);
            
            if(role[currentStep][4] == 1){
                intervall = intervall1/2;
            }else{
                intervall = intervall1;
            }
            
            if(prevPlayerPos+intervall >= currentPlayerPos-4
               && prevPlayerPos+intervall <= currentPlayerPos)
            {
                currentStep++;
                if(currentStep > 7) currentStep = 0;
                isStart = false;
                
                prevPlayerPos = currentPlayerPos;
                
                // reset history
                footPositions.clear();
            }

        // WAIT FOR NEXT PART -------------------------------------
        }else if (currentPlayerPos >= stopPlayerPos_R1
                  && currentPlayerPos <= startPlayerPos_R2)
        {
            standardPosition(role, 7, cX1, cY1, cX2, cY2);
            
        }

        // MOVE FORWARDS ------------------------------------------
        else if (currentPlayerPos >= startPlayerPos_R2
                 && currentPlayerPos <= stopPlayerPos_R2)
        {
            if(currentPlayerPos >= startPlayerPos_R2
               && currentPlayerPos <= startPlayerPos_R2+4)
            {
                standardPosition(role, 7, cX1, cY1, cX2, cY2);
                
                footPositions.clear();
            }
            
            // recalculate intervall
            if(role[currentStep][4] == 1){
                intervall = intervall1/2;
            }else{
                intervall = intervall1;
            }
            
            // FOOT 1
            // animate 1st
            if(currentPlayerPos >= startPlayerPos_R2
               && currentPlayerPos < startPlayerPos_R2+intervall)
            {
                mStepA = 7;
                mStepB = 6;
                
                // leader 1
                ofPushMatrix();
                ofTranslate(cX1, cY1);
                ofRotateZ(config.rotateZ);
                mFootA = moveForwardsMaster(role, mStepA, 'm');
                ofPopMatrix();
                
                // follower 1
                ofPushMatrix();
                ofTranslate(cX2, cY1);
                ofRotateZ(config.rotateZ);
                moveForwardsSlave(mFootA, role, mStepA, 'f');
                ofPopMatrix();
                
                // leader 2
                ofPushMatrix();
                ofTranslate(cX3, cY2);
                ofRotateZ(config.rotateZ-180);
                moveForwardsSlave(mFootA, role, mStepA, 'm');
                ofPopMatrix();
                
                // follower 2
                ofPushMatrix();
                ofTranslate(cX4, cY2);
                ofRotateZ(config.rotateZ-180);
                moveForwardsSlave(mFootA, role, mStepA, 'f');
                ofPopMatrix();
            }
            
            // FOOT 2
            // reset for next foot
            if(currentPlayerPos >= startPlayerPos_R2+intervall
               && currentPlayerPos <= startPlayerPos_R2+intervall+4)
            {
                footPositions.clear();
            }
            // display 1st and animate 2nd
            if(currentPlayerPos >= startPlayerPos_R2+intervall
               && currentPlayerPos < startPlayerPos_R2+intervall+intervall)
            {
                // leader 1
                ofPushMatrix();
                ofTranslate(cX1, cY1);
                ofRotateZ(config.rotateZ);
                Foot(mFootA.x, mFootA.y, getStepSide(role, mStepA), 'm', config.iconSize);  // right foot
                ofTranslate(-boxWidth*2/7, 0);
                mFootB = moveForwardsMaster(role, mStepB, 'm');                             // left foot
                ofPopMatrix();
                
                // follower 1
                ofPushMatrix();
                ofTranslate(cX2, cY1);
                ofRotateZ(config.rotateZ);
                Foot(mFootA.x, mFootA.y-2*config.distanceMoveJive, getStepSide(role, mStepA), 'f', config.iconSize); // left
                ofTranslate(-boxWidth*2/7, 0);
                moveForwardsSlave(mFootB, role, mStepB, 'f');                                                    // right
                ofPopMatrix();
                
                // leader 2
                ofPushMatrix();
                ofTranslate(cX3, cY2);
                ofRotateZ(config.rotateZ-180);
                Foot(mFootA.x, mFootA.y, getStepSide(role, mStepA), 'm', config.iconSize);  // right foot
                ofTranslate(-boxWidth*2/7, 0);
                moveForwardsSlave(mFootB, role, mStepB, 'm');                               // left foot
                ofPopMatrix();
                
                // follower 2
                ofPushMatrix();
                ofTranslate(cX4, cY2);
                ofRotateZ(config.rotateZ-180);
                Foot(mFootA.x, mFootA.y-2*config.distanceMoveJive, getStepSide(role, mStepA), 'f', config.iconSize); // left
                ofTranslate(-boxWidth*2/7, 0);
                moveForwardsSlave(mFootB, role, mStepB, 'f');                                                    // right
                ofPopMatrix();
            }
            
            // FINAL MOVE FORWARD FEET
            // display
            if(currentPlayerPos >= startPlayerPos_R2+intervall+intervall)
            {
                // leader 1
                ofPushMatrix();
                ofTranslate(cX1, cY1);
                ofRotateZ(config.rotateZ);
                mGender = 'm';
                Foot(mFootA.x, mFootA.y, getStepSide(role, mStepA), mGender, config.iconSize);
                Hand(mFootA.x+180, mFootA.y+65, 'r', mGender, config.iconSize);
                ofTranslate(-boxWidth*2/7, 0);
                Foot(mFootB.x, mFootB.y, getStepSide(role, mStepB), mGender, config.iconSize);
                Hand(mFootB.x-160, mFootB.y+50, 'l', mGender, config.iconSize);
                ofPopMatrix();
                
                // follower 1
                ofPushMatrix();
                ofTranslate(cX2, cY1);
                ofRotateZ(config.rotateZ);
                mGender = 'f';
                Foot(mFootA.x, mFootA.y-2*config.distanceMoveJive, getStepSide(role, mStepA), mGender, config.iconSize);
                Hand(mFootA.x+180, mFootA.y-2*config.distanceMoveJive-55, 'r', mGender, config.iconSize);
                ofTranslate(-boxWidth*2/7, 0);
                Foot(mFootB.x, mFootB.y-2*config.distanceMoveJive, getStepSide(role, mStepB), mGender, config.iconSize);
                Hand(mFootB.x-130, mFootB.y-2*config.distanceMoveJive-80, 'l', mGender, config.iconSize);
                ofPopMatrix();
                
                // leader 2
                ofPushMatrix();
                ofTranslate(cX3, cY2);
                ofRotateZ(config.rotateZ-180);
                mGender = 'm';
                Foot(mFootA.x, mFootA.y, getStepSide(role, mStepA), mGender, config.iconSize);
                Hand(mFootA.x+180, mFootA.y+70, 'r', mGender, config.iconSize);
                ofTranslate(-boxWidth*2/7, 0);
                Foot(mFootB.x, mFootB.y, getStepSide(role, mStepB), mGender, config.iconSize);
                Hand(mFootB.x-160, mFootB.y+50, 'l', mGender, config.iconSize);
                ofPopMatrix();
                
                // follower 2
                ofPushMatrix();
                ofTranslate(cX4, cY2);
                ofRotateZ(config.rotateZ-180);
                mGender = 'f';
                Foot(mFootA.x, mFootA.y-2*config.distanceMoveJive, getStepSide(role, mStepA), mGender, config.iconSize);
                Hand(mFootA.x+180, mFootA.y-2*config.distanceMoveJive-55, 'r', mGender, config.iconSize);
                ofTranslate(-boxWidth*2/7, 0);
                Foot(mFootB.x, mFootB.y-2*config.distanceMoveJive, getStepSide(role, mStepB), mGender, config.iconSize);
                Hand(mFootB.x-130, mFootB.y-2*config.distanceMoveJive-80, 'l', mGender, config.iconSize);
                ofPopMatrix();
            }
        }
        
        // PARTNER PRACTICE ---------------------------------------
        else if(currentPlayerPos >= startPlayerPos_R3
                && currentPlayerPos <= stopPlayerPos_R3)
        {
            if(currentPlayerPos >= startPlayerPos_R3
               && currentPlayerPos <= startPlayerPos_R3+4)
            {
                prevPlayerPos = currentPlayerPos;
                currentStep = 0;
                footPositions.clear();
            }
            
            if(role[currentStep][4] == 1){
                intervall = intervall2/2 - 1;
            }else{
                intervall = intervall2;
            }
            
            //cout << currentPlayerPos << " -> do " << currentStep << " :: prev " << positionPrev << " - curr " << positionCurr << " :: prevStep of side: " << previousSideStep << endl;
            
            updateChoreoPosition(role, currentStep, true, false, true, false);
            
            //cout << prevPlayerPos << " + " << intervall << " >=< " << currentPlayerPos << endl;
            if(prevPlayerPos+intervall >= currentPlayerPos-4
               && prevPlayerPos+intervall <= currentPlayerPos)
            {
                
                currentStep++;
                if(currentStep > 7) currentStep = 0;
                isStart = false;
                
                prevPlayerPos = currentPlayerPos;
                
                // reset history
                footPositions.clear();
            }
        
        // BRIDGE TO FAST PART ------------------------------------
        }else if (currentPlayerPos >= stopPlayerPos_R3
                  && currentPlayerPos <= startPlayerPos_R4)
        {
            
            // leader 1
            ofPushMatrix();
            ofTranslate(cX1, cY1);
            ofRotateZ(config.rotateZ);
            mGender = 'm';
            Foot(mFootA.x, mFootA.y, getStepSide(role, mStepA), mGender, config.iconSize);
            Hand(mFootA.x+180, mFootA.y+65, 'r', mGender, config.iconSize);
            ofTranslate(-boxWidth*2/7, 0);
            Foot(mFootB.x, mFootB.y, getStepSide(role, mStepB), mGender, config.iconSize);
            Hand(mFootB.x-160, mFootB.y+50, 'l', mGender, config.iconSize);
            ofPopMatrix();
            
            // follower 1
            ofPushMatrix();
            ofTranslate(cX2, cY1);
            ofRotateZ(config.rotateZ);
            mGender = 'f';
            Foot(mFootA.x, mFootA.y-2*config.distanceMoveJive, getStepSide(role, mStepA), mGender, config.iconSize);
            Hand(mFootA.x+180, mFootA.y-2*config.distanceMoveJive-55, 'r', mGender, config.iconSize);
            ofTranslate(-boxWidth*2/7, 0);
            Foot(mFootB.x, mFootB.y-2*config.distanceMoveJive, getStepSide(role, mStepB), mGender, config.iconSize);
            Hand(mFootB.x-130, mFootB.y-2*config.distanceMoveJive-80, 'l', mGender, config.iconSize);
            ofPopMatrix();
            
            // leader 2
            ofPushMatrix();
            ofTranslate(cX3, cY2);
            ofRotateZ(config.rotateZ-180);
            mGender = 'm';
            Foot(mFootA.x, mFootA.y, getStepSide(role, mStepA), mGender, config.iconSize);
            Hand(mFootA.x+180, mFootA.y+70, 'r', mGender, config.iconSize);
            ofTranslate(-boxWidth*2/7, 0);
            Foot(mFootB.x, mFootB.y, getStepSide(role, mStepB), mGender, config.iconSize);
            Hand(mFootB.x-160, mFootB.y+50, 'l', mGender, config.iconSize);
            ofPopMatrix();
            
            // follower 2
            ofPushMatrix();
            ofTranslate(cX4, cY2);
            ofRotateZ(config.rotateZ-180);
            mGender = 'f';
            Foot(mFootA.x, mFootA.y-2*config.distanceMoveJive, getStepSide(role, mStepA), mGender, config.iconSize);
            Hand(mFootA.x+180, mFootA.y-2*config.distanceMoveJive-55, 'r', mGender, config.iconSize);
            ofTranslate(-boxWidth*2/7, 0);
            Foot(mFootB.x, mFootB.y-2*config.distanceMoveJive, getStepSide(role, mStepB), mGender, config.iconSize);
            Hand(mFootB.x-130, mFootB.y-2*config.distanceMoveJive-80, 'l', mGender, config.iconSize);
            ofPopMatrix();
        }
        // PARTNER PRACTICE - FAST --------------------------------
        else if(currentPlayerPos >= startPlayerPos_R4
                && currentPlayerPos <= stopPlayerPos_R4)
        {
            if(currentPlayerPos >= startPlayerPos_R4
               && currentPlayerPos <= startPlayerPos_R4+4)
            {
                prevPlayerPos = currentPlayerPos;
                currentStep = 0;
                footPositions.clear();
            }
            
            if(role[currentStep][4] == 1){
                intervall = intervall3/2;
            }else{
                intervall = intervall3;
            }
            
            //cout << currentPlayerPos << " -> do " << currentStep << " :: prev " << positionPrev << " - curr " << positionCurr << " :: prevStep of side: " << previousSideStep << endl;
            
            updateChoreoPosition(role, currentStep, true, false, true, false);
            
            //cout << prevPlayerPos << " + " << intervall << " >=< " << currentPlayerPos << endl;
            if(prevPlayerPos+intervall >= currentPlayerPos-4
               && prevPlayerPos+intervall <= currentPlayerPos)
            {
                
                currentStep++;
                if(currentStep > 7) currentStep = 0;
                isStart = false;
                
                prevPlayerPos = currentPlayerPos;
                
                // reset history
                footPositions.clear();
            }
        }
        
        // WAIT FOR NEXT PART -------------------------------------
        else if(currentPlayerPos <= stopPlayerPos_R4
                && currentPlayerPos != 0)
        {
            standardPosition(role, 7, cX1, cY1, cX2, cY2);
        }
    }
}
Ejemplo n.º 14
0
//--------------------------------------------------------------
void JiveScreen::tweenPositionSlave(vector<ofVec2f> fP, ofVec2f posUpdate, ofVec2f positionCurr, vector< vector<int> > choreo, int step, char side, char gender, bool bdisplayIcon, bool bdisplayPrevious, bool bmoveForward, bool bcloser)
{
    // if lift
    if(choreo[step][3] == 5 && !bmoveForward)
    {
        fP.at(fP.size()-1) = positionCurr;
        posUpdate          = positionCurr;
        positionPrev       = positionCurr;
    }
    //cout << step << " - prev: " << positionPrev << " - curr: " << positionCurr << " --> update: " << posUpdate << "     out: " << fP.at(fP.size()-1) << endl;
    
    if (posUpdate != positionCurr)
    {
        int last = fP.size()-1;
        
        ofSetColor(255, 255, 255, 255);
        
        /*int distTotal = ofDist(positionPrev.x, positionPrev.y, positionCurr.x, positionCurr.y);
         int distUpdate = ofDist(fP.at(last).x, fP.at(last).y, positionCurr.x, positionCurr.y);
         //int alpha = ofMap(distUpdate, 0, distTotal, 75, 255);
         //int alpha = 255-255*distUpdate/distTotal;
         //ofSetColor(255, 255, 255, alpha);*/
        
        if(bmoveForward && gender == 'f')
        {
            Foot(fP.at(last).x, -fP.at(last).y, side, gender, config.iconSize);
        }else if(step == 0)
        {
            ofPushMatrix();
            if(gender == 'm'){
                ofRotateZ(360-rotateDegree);
                Foot(fP.at(last).x, -fP.at(last).y, side, gender, config.iconSize);
            }else{
                ofRotateZ(rotateDegree);
                Foot(fP.at(last).x, fP.at(last).y, side, gender, config.iconSize);
            }
            ofPopMatrix();
        }
        else{
            if(gender == 'm'){
                Foot(fP.at(last).x, -fP.at(last).y, side, gender, config.iconSize);
            }else{
                Foot(fP.at(last).x, fP.at(last).y, side, gender, config.iconSize);
            }
        }
        
        //alpha = 255;
        //if(distUpdate < distTotal/4) alpha = 0;
        if(bdisplayIcon) createIcon(fP, choreo, step, gender);
        //ofSetColor(255, 255, 255, 255);
    }
    else
    {
        int last = fP.size()-1;
        
        if(bmoveForward && gender == 'f')
        {
            Foot(fP.at(last).x, -fP.at(last).y, side, gender, config.iconSize);
        }
        else
        {
            // if lift
            if(choreo[step][3] == 5 && !bmoveForward)
            {
                if(bdisplayIcon) createIcon(fP, choreo, step, gender);
                
                if(!biconWasBig && newIconSize  < config.iconSize+5) newIconSize += 1;
                if(                newIconSize == config.iconSize+5) biconWasBig = true;
                if( biconWasBig && newIconSize >= config.iconSize)   newIconSize -= 1;
            }else{
                // reset
                biconWasBig = false;
                newIconSize = config.iconSize;
            }
            
            if(step == 0)
            {
                ofPushMatrix();
                if(gender == 'm'){
                    ofRotateZ(360-rotateDegree);
                    Foot(fP.at(last).x, -fP.at(last).y, side, gender, newIconSize);
                }else{
                    ofRotateZ(rotateDegree);
                    Foot(fP.at(last).x, fP.at(last).y, side, gender, newIconSize);
                }
                ofPopMatrix();
            }
            else
            {
                if(gender == 'm'){
                    Foot(fP.at(last).x, -fP.at(last).y, side, gender, newIconSize);
                }else{
                    Foot(fP.at(last).x, fP.at(last).y, side, gender, newIconSize);
                }
            }
        }
        
        //if(bdisplayIcon) createIcon(fP, choreo, step, gender);
    }
    
    if(bdisplayPrevious)
    {
        // PREVIOUS STEP --------------------------------------------
        previousStep = step-1;
        if(previousStep == -1) previousStep = 7;
        
        // get position
        ofVec2f previousStepPos;
        if(choreo[previousStep][2] == 0)
        {
            previousStepPos.x = choreo[previousStep][0]-config.distanceFeet;
            side = 'l';
        }
        else
        {
            previousStepPos.x = choreo[previousStep][0]+config.distanceFeet;
            side = 'r';
        }
        //if(previousStep == 0) previousStepPos.x = choreo[previousStep][0]-config.distanceFeet;
        previousStepPos.y = choreo[previousStep][1];
        
        // display step
        ofSetColor(255, 127);
        if(previousStep == 0)
        {
            ofPushMatrix();
            if(gender == 'm'){
                ofRotateZ(360-rotateDegree);
                Foot(previousStepPos.x, -previousStepPos.y, side, gender, config.iconSize);
            }else{
                ofRotateZ(rotateDegree);
                Foot(previousStepPos.x, previousStepPos.y, side, gender, config.iconSize);
            }
            ofPopMatrix();
        }
        else
        {
            if(gender == 'm'){
                Foot(previousStepPos.x, -previousStepPos.y, side, gender, config.iconSize);
            }else{
                Foot(previousStepPos.x, previousStepPos.y, side, gender, config.iconSize);
            }
        }

        int futureStep = previousStep+2;
        if(futureStep == 8) futureStep = 0;
        if(futureStep == 9) futureStep = 1;
        if(bdisplayIcon) createIcon(previousStepPos, choreo, futureStep, gender);
        ofSetColor(255, 255);
    }
}
Ejemplo n.º 15
0
void BrainWrinkleScene::draw(){
    
    ofBackground(0,0,0);
    
    ofEnableLighting();
    light.enable();
    
    ofPushMatrix();
    
    ofTranslate(OUTWIDTH/2, OUTHEIGHT/2);
    
    //ofRotateX(ofGetElapsedTimef());
    //ofRotateY(ofGetElapsedTimef());
    ofRotateZ(ofGetElapsedTimef());
    
    //brainModel.setPosition(OUTWIDTH/2, OUTHEIGHT/2, 0);
    brainModel.drawFaces();
    
    ofPopMatrix();
    
    light.disable();
    
    ofDisableLighting();

    
    /*ofPushStyle();
    glPushMatrix();
    ofEnableLighting();
    light.enable();
    
    
    
    ofSetColor(255,255,255);
    
    
    ofPushMatrix();
    
    ofRotateX(ofGetElapsedTimef());
    ofRotateY(ofGetElapsedTimef());
    ofRotateZ(ofGetElapsedTimef());

    
    //brainModel.setScale(10, 10, 10);
    //brainModel.setPosition(OUTWIDTH/2, OUTHEIGHT/2, 0);
    //brainModel.drawFaces();
    
    
    ofPopMatrix();
    
    ofSetColor(100,100,100);
    
    //brainModel.drawWireframe();
    
    ofSetColor(255,0,0);
    ofCircle(center, 10);
    
    light.draw();
    
    light.disable();
    
    ofDisableLighting();
    
    glPopMatrix();
    ofPopStyle();*/
    
}
Ejemplo n.º 16
0
void Scene::draw(vector<SkeletonDataObject> skeletons)
{
	ofEnableAlphaBlending();
    glEnable(GL_DEPTH_TEST);

	if (isMouseCam)
		easyCam.begin(viewport);
	else
		cam.begin(viewport);

	if (isGridVisible)
	{
		ofSetColor(255, 100);
		ofPushMatrix();
		ofRotateZ(90);
		ofDrawGridPlane(400);
		ofPopMatrix();
	}

    ofEnableLighting();
    light.enable();
    
	//printf("skeletons.size() = %i \n", skeletons.size());
	
	if (skeletons.size() > 0)
	{
		ofSetColor(255, modelAlpha);


		ofVec3f legOrigin = ofVec3f(skeletons[0].skeletonPositions[KINECT_SDK_HIP_CENTRE].x, 0, skeletons[0].skeletonPositions[KINECT_SDK_HIP_CENTRE].z);
		// set origins for head and torso to shoulder centre
		legs.originPoint = &legOrigin;
		abdomen.originPoint = &legs.connectingPointsAbsolute[0];
		torso.originPoint = &abdomen.connectingPointsAbsolute[0];
		head.originPoint = &torso.connectingPointsAbsolute[2];
		upperArmL.originPoint = &torso.connectingPointsAbsolute[0];
		upperArmR.originPoint = &torso.connectingPointsAbsolute[1];
		forearmL.originPoint = &upperArmL.connectingPointsAbsolute[0];
		forearmR.originPoint = &upperArmR.connectingPointsAbsolute[0];
		handL.originPoint = &forearmL.connectingPointsAbsolute[0];
		handR.originPoint = &forearmR.connectingPointsAbsolute[0];


		if (BodyPart::isDrawModel)
		{
			if (isDrawFaces)
			{
				torso.drawFaces();
				head.drawFaces();
				abdomen.drawFaces();
				legs.drawFaces();
				upperArmL.drawFaces();
				upperArmR.drawFaces();
				forearmL.drawFaces();
				forearmR.drawFaces();
				handL.drawFaces();
				handR.drawFaces();

				//mixer.drawFaces();
			}
			else
			{
				torso.drawWireframe();
				head.drawWireframe();
				abdomen.drawWireframe();
				legs.drawWireframe();
				upperArmL.drawWireframe();
				upperArmR.drawWireframe();
				forearmL.drawWireframe();
				forearmR.drawWireframe();
				handL.drawWireframe();
				handR.drawWireframe();
			}
		}
    
		if (BodyPart::isDrawDebug)
		{
			torso.drawDebug(ofColor(255, 0, 255));
			head.drawDebug(ofColor(255, 255, 0));
			abdomen.drawDebug(ofColor(255, 255, 0));
			legs.drawDebug(ofColor(255, 255, 0));
			upperArmL.drawDebug(ofColor(255, 255, 0));
			upperArmR.drawDebug(ofColor(255, 255, 0));
			forearmL.drawDebug(ofColor(255, 255, 0));
			forearmR.drawDebug(ofColor(255, 255, 0));
			handL.drawDebug(ofColor(255, 255, 0));
			handR.drawDebug(ofColor(255, 255, 0));
		}

		
		if (isEquipmentVisible)
		{
			ofSetColor(255, 255);
			ofPushMatrix();
			ofTranslate(decks1Pos.x, decks1Pos.y, decks1Pos.z);
			decksImg.getTextureReference().bind();
			decks.drawFaces();
			decksImg.getTextureReference().unbind();
			ofPopMatrix();
			
			ofPushMatrix();
			ofTranslate(decks2Pos.x, decks2Pos.y, decks2Pos.z);
			decksImg.getTextureReference().bind();
			decks.drawFaces();
			decksImg.getTextureReference().unbind();
			ofPopMatrix();
			
			ofPushMatrix();
			ofTranslate(mixerPos.x, mixerPos.y, mixerPos.z);
			ofSetColor(100, 255);
			mixer.drawFaces();
			ofPopMatrix();
		}

		if (isDebugSkeletonVIsible)
		{
			ofPushMatrix();
			ofTranslate(80, 0);
			drawLineSkeleton(skeletons[0]);
			ofPopMatrix();
		}
	}


    light.disable();
    ofDisableLighting();
    
	if (isMouseCam)
		easyCam.end();
	else
		cam.end();
    
	glDisable(GL_DEPTH_TEST);
	
	ofDisableAlphaBlending();
}
Ejemplo n.º 17
0
void View::DrawStrikeIndicator(const Model &model) const {
  ofPushMatrix();
  ofTranslate(model.strike_position.x, model.strike_position.y);
  ofScale(model.strike_alpha * model.strike_alpha * kPlayerRadius,
          model.strike_alpha * model.strike_alpha * kPlayerRadius);
  ofSetColor(model.last_hit_player == 1 ? color_p1 : model.last_hit_player == 2 ? color_p2 : ofColor::white,
             model.strike_alpha * model.strike_alpha * 255.0);
  ofCircle(ofPoint(), 1.0);
  ofPopMatrix();
  if (model.counter_clockwise_alpha) { //green triangle
    const float alpha = -10.0 * (1.0 - model.counter_clockwise_alpha);
    ofPushMatrix();
    ofTranslate(-kCourtWidth / 4.0, kCourtHeight / 4.0);
    ofSetColor(color_p2, model.counter_clockwise_alpha * 255.0);
    ofTranslate(0, alpha);
    ofTriangle(-0.5, 0.5, 0.5, 0.5, 0, -1);
    ofPopMatrix();
    
    ofPushMatrix();
    ofTranslate(-kCourtWidth / 4.0, -kCourtHeight / 4.0);
    ofRotateZ(90);
    ofSetColor(color_p2, model.counter_clockwise_alpha * 255.0);
    ofTranslate(0, 2*alpha);
    ofTriangle(-0.5, 0.5, 0.5, 0.5, 0, -1);
    ofPopMatrix();
    
    ofPushMatrix();
    ofTranslate(kCourtWidth / 4.0, -kCourtHeight / 4.0);
    ofRotateZ(180);
    ofSetColor(color_p2, model.counter_clockwise_alpha * 255.0);
    ofTranslate(0, alpha);
    ofTriangle(-0.5, 0.5, 0.5, 0.5, 0, -1);
    ofPopMatrix();
    
    ofPushMatrix();
    ofTranslate(kCourtWidth / 4.0, kCourtHeight / 4.0);
    ofRotateZ(270);
    ofSetColor(color_p2, model.counter_clockwise_alpha * 255.0);
    ofTranslate(0, 2*alpha);
    ofTriangle(-0.5, 0.5, 0.5, 0.5, 0, -1);
    ofPopMatrix();
  }
  if (model.clockwise_alpha) { //pink triangle
    const float alpha = 10.0 * (1.0 - model.clockwise_alpha);
    ofPushMatrix();
    ofTranslate(-kCourtWidth / 4.0, kCourtHeight / 4.0);
    ofRotateZ(-90);
    ofSetColor(color_p1, model.clockwise_alpha * 255.0);
    ofTranslate(0, 2*alpha);
    ofTriangle(-0.5, -0.5, 0.5, -0.5, 0, 1);
    ofPopMatrix();
    
    ofPushMatrix();
    ofTranslate(-kCourtWidth / 4.0, -kCourtHeight / 4.0);
    ofRotateZ(0);
    ofSetColor(color_p1, model.clockwise_alpha * 255.0);
    ofTranslate(0, alpha);
    ofTriangle(-0.5, -0.5, 0.5, -0.5, 0, 1);
    ofPopMatrix();
    
    ofPushMatrix();
    ofTranslate(kCourtWidth / 4.0, -kCourtHeight / 4.0);
    ofRotateZ(90);
    ofSetColor(color_p1, model.clockwise_alpha * 255.0);
    ofTranslate(0, 2*alpha);
    ofTriangle(-0.5, -0.5, 0.5, -0.5, 0, 1);
    ofPopMatrix();
    
    ofPushMatrix();
    ofTranslate(kCourtWidth / 4.0, kCourtHeight / 4.0);
    ofRotateZ(180);
    ofSetColor(color_p1, model.clockwise_alpha * 255.0);
    ofTranslate(0, alpha);
    ofTriangle(-0.5, -0.5, 0.5, -0.5, 0, 1);
    ofPopMatrix();
  }
}
Ejemplo n.º 18
0
//--------------------------------------------------------------
void ofApp::drawFboTest_00(){
    
    float movementSpeed = .3;
    float cloudSize = ofGetWidth();
    float minBoxSize = 50;
    float spacing = 50;
    int boxCount = 30;
    
    
    ofEnableAlphaBlending();
    ofClear(255, 255, 255, 0);
    ofBackgroundGradient(ofColor(0,0,255), ofColor(85, 78, 68), OF_GRADIENT_LINEAR);
    
    
    for (int i=0; i<kNumCameras; i++) {
        if (lookatIndex[i] >= 0) {
            cam[i].lookAt(testNodes[lookatIndex[i]]);
        }
    }
    
    cam[0].begin();
    
//  grids
    for(int i = -3; i < 3; i++) {
        ofPushMatrix();
        
        ofTranslate(i*300, 0, 0);
        ofSetColor(0,255,200);
        ofDrawGridPlane(1000);
        
        ofPopMatrix();
        
        
        ofPushMatrix();
        
        ofTranslate(0, i*300, 0);
        ofRotate(90, 0, 0, -1);
        ofSetColor(0,255,200);
        ofDrawGridPlane(1000);
        
        ofRotate(90, 0, 0, -1);
        
        ofPopMatrix();
    }
    
//  boxes
    for(int i = 0; i < boxCount; i++) {
        ofPushMatrix();
        float t = (ofGetElapsedTimef() + i * spacing) * movementSpeed;
        ofVec3f pos(
                    ofSignedNoise(t, 0, 0),
                    ofSignedNoise(0, t, 0),
                    ofSignedNoise(0, 0, t));
        
        float boxSize = minBoxSize + magnitude[i]*10;
        
        pos *= cloudSize;
        ofTranslate(pos);
        ofRotateX(pos.x*.8);
        ofRotateY(pos.y*.8);
        ofRotateZ(pos.z*.8);
        
        ofFill();
        ofSetColor(255);
        ofDrawBox(boxSize);
        ofPopMatrix();
    }

    cam[0].end();
    
    
// waves
    //FFT解析した結果をもとに、グラフを生成
    float w = (float)ofGetWidth()/ (float)fft_size / 2.0f;
    for (int i = 0; i < fft_size; i++) {
        
        //塗りのアルファ値でFFT解析結果を表現
//        ofColor col;
//        col.setHsb(i * 255.0f / (float)fft_size, 255, 255, 255);
//        ofSetColor(col);
        float h = magnitude[i] * ofGetHeight();
        ofRect(ofGetWidth()/2 - w * i, ofGetHeight()/2, w, h);
        ofRect(ofGetWidth()/2 + w * i, ofGetHeight()/2, w, -h);
    }
}
Ejemplo n.º 19
0
void Map::draw()
{
    // If we're in between zoom levels, we need to choose the nearest.
	int baseZoom = CLAMP(static_cast<int>(round(_centerTileCoordinate.getZoom())),
                         _provider->getMinZoom(),
                         _provider->getMaxZoom());

	// TODO: sort by zoom so we draw small zoom levels (big tiles) first:
	// can this be done with a different comparison function on the visibleKeys set?

	// Collections.sort(visibleKeys, zoomComparator);

    ofPushMatrix();
    ofRotateZ(_rotation * RAD_TO_DEG);

	_numDrawnImages = 0;

	std::set<TileCoordinate>::iterator coordinateIter = _visibleCoordinates.begin();

	while (coordinateIter != _visibleCoordinates.end())
    {
		TileCoordinate coord = *coordinateIter;

		double scale = pow(2.0, _centerTileCoordinate.getZoom() - coord.getZoom());

        ofVec2d tileSize = _provider->getTileSize() * scale;
		ofVec2d center = _size * 0.5;

		TileCoordinate theCoord = _centerTileCoordinate.zoomTo(coord.getZoom());

		double tx = center.x + (coord.getColumn() - theCoord.getColumn()) * tileSize.x;
		double ty = center.y + (coord.getRow() - theCoord.getRow()) * tileSize.y;

        if (_images.count(coord) > 0)
        {
            std::shared_ptr<ofImage> tile = _images[coord];

            // TODO: must be a cleaner C++ way to do this?
            // we want this image to be at the end of recentImages, if it's already there we'll remove it and then add it again
            std::vector<std::shared_ptr<ofImage> >::iterator result = find(_recentImages.begin(),
                                                                           _recentImages.end(),
                                                                           tile);

            if (result != _recentImages.end())
            {
                _recentImages.erase(result);
            }
            else
            {
                // if it's not in recent images it must be brand new?
                tile->setUseTexture(true);
                tile->update();
            }


            ofPushStyle();
            ofSetColor(255);
            
            tile->draw(tx,
                       ty,
                       tileSize.x,
                       tileSize.y);

//            ofEnableAlphaBlending();
//            ofNoFill();
//            ofSetColor(255,0,0,50);
//            ofRect(tx,
//                   ty,
//                   tileSize.x,
//                   tileSize.y);

            ofPopStyle();

            _numDrawnImages++;

            _recentImages.push_back(tile);
        }

        ++coordinateIter;
    }

    ofPopMatrix();
	
}
Ejemplo n.º 20
0
//--------------------------------------------------------------
void ofApp::drawFboTest_02(){

    ofEnableAlphaBlending();
    ofClear(255, 255, 255, 0);
    ofBackgroundGradient(ofColor(190,50,200), ofColor(85, 78, 68), OF_GRADIENT_LINEAR);
    
    cam[2].begin();
    
//  trail
        ofSetLineWidth(2);
        ofSetColor(255);
        pathLines.draw();

//  box
        string str = ofToString(current, 2);
        ofDrawBitmapString(str, current);
        ofTranslate(current);
        ofRotateX(current.x*.5);
        ofRotateY(current.y*.5);
        ofRotateZ(current.z*.5);
        bx.set(10+magnitude[20]*80);
        if (xFlag == true) {
            bx.draw();
        }else{
            bx.drawWireframe();
        }
    
//  frames
    ofNoFill();
    ofSetLineWidth(8);
    ofRect(-15, -15, 30, 30);
    ofRotateZ(10);
    ofSetLineWidth(5);
    ofRect(-25, -25, 50, 50);
    
//  triangles
    if (r > 100 && g > 100 && b > 100) {
        for(int i = 0; i < 100; i++) {
            ofPushMatrix();
            float t = (ofGetElapsedTimef() + i * 50) * .5;
            ofVec3f pos(
                        ofSignedNoise(t, 0, 0),
                        ofSignedNoise(0, t, 0),
                        ofSignedNoise(0, 0, t));
            
            pos *= ofGetWidth();
            ofTranslate(pos);
            ofRotateX(pos.x*.8);
            ofRotateY(pos.y*.8);
            ofRotateZ(pos.z*.8);
            
            ofFill();
            ofSetColor(255);
            ofTriangle(0, 0, 0, 50, 50, 50);
            ofPopMatrix();
        }
    }

    cam[2].end();
    
}
Ejemplo n.º 21
0
void effectFive::draw(float sound,bool defromPerlin,float left[256]){
	offcetTime++;
	if(offcetTime > period){
	
		builtNextBranch();
			offcetTime = 0;
	}
	
	
	
	//ofSetLineWidth(1);
	ofNoFill();
	ofSetColor(255, 255, 255);
	int index = 0;
	
	//Applique l'effet sur toutes les lignes
	
	for(int i=0; i<lines.size(); i++){
		
		int div = 10;
		int posx1 = lines[i].x1;
		int posy1 = lines[i].y1;
		int posx2 = lines[i].x2;
		int posy2 = lines[i].y2;
		
		if(defromPerlin){
			
			float simplexNoiseX1 = (noise->noise3((512.0-(float)posx1)/div,(float)posy1/div,ofGetFrameNum()/3))*sound*15000;
			float simplexNoiseY1 = (noise->noise3((350-(float)posy1)/div,(float)posx1/div,ofGetFrameNum()/3))*sound*15000;
			float simplexNoiseX2 = (noise->noise3((512-(float)posx2)/div,(float)posy2/div,ofGetFrameNum()/3))*sound*15000;
			float simplexNoiseY2 = (noise->noise3((350-(float)posy2)/div,(float)posx2/div,ofGetFrameNum()/3))*sound*15000;
			
			posx1Voulu = posx1 + simplexNoiseX1;
			posy1Voulu = posy1 + simplexNoiseY1;
			posx2Voulu = posx2 + simplexNoiseX2;
			posy2Voulu = posy2 + simplexNoiseY2;
			
			float diffx1 =  posx1Voulu - posx1;
			float diffy1 =  posy1Voulu - posy1;
			float diffx2 =  posx2Voulu - posx2;
			float diffy2 =  posy2Voulu - posy2;
			
			posx1 += diffx1/150;
			posy1 += diffy1/150;
			posx2 += diffx2/150;
			posy2 += diffy2/150;
			
		}
		
		float dist = sqrt(ofDistSquared(posx1, posy1, posx2, posy2 ));
		float coeff = 256.0 / dist;
		float hight = 200.0 / coeff;
		float angle = atan2(double(posy2-posy1) , double(posx2-posx1));
		float mydegreangle = ofRadToDeg(angle);			
		
		glPushMatrix();
		ofTranslate(posx1, posy1,0);
		ofRotateZ(mydegreangle);
	//	glBegin(GL_LINES);

		for(int x = 1; x < dist; x +=20) {
			if(branches.size()>index){
			branches[index].draw();
			index++;
			}
			//ofCircle(x,0, 10);
		
		}
		
		glPopMatrix();
	}
}
Ejemplo n.º 22
0
//--------------------------------------------------------------
void ofxPlane::draw(int iWidth, int iHeight, float fScale)
{
	if(this->m_stElementBase.bIsVisible)
	{
		ofPushStyle();
		//Translate
		ofPushMatrix();
		ofTranslate(this->m_stElementBase.oPos);
		
		//Rotate
		ofPoint oCenterPoint(this->m_stElementBase.iWidth/2, this->m_stElementBase.iHeight/2);
		ofTranslate(oCenterPoint);
		ofRotateZ(this->m_stElementBase.fDegree);
		ofTranslate(-oCenterPoint);

		//Scale
		int iTmpWidth_  = this->m_stElementBase.iWidth * this->m_stElementBase.fScale;
		int iTmpHeight_ = this->m_stElementBase.iHeight * this->m_stElementBase.fScale;

		////Check ragne
		//if(this->m_stElementBase.oPos.x + iTmpWidth_ > iWidth)
		//{
		//	this->m_stElementBase.oPos.x = iWidth - iTmpWidth_;
		//}

		//if(this->m_stElementBase.oPos.y + iTmpHeight_ > iHeight)
		//{
		//	this->m_stElementBase.oPos.y = iHeight - iTmpHeight_;
		//}
		
		//Show plane range
		if(this->m_bShowRange)
		{
			ofSetHexColor(0xff0000);
			ofNoFill();
			ofRect(0, 0, iTmpWidth_, iTmpHeight_);
			ofSetHexColor(0xffffff);
		}
		
		if(this->m_stElementBase.bFadeIn || this->m_stElementBase.bFadeOut)
		{
			ofEnableAlphaBlending();
			ofSetColor(255,255,255,(int)this->m_stElementBase.fAlpah);
		}
		else
		{
			ofSetColor(255);
		}
		
		//execute draw for each element
		for(int idx_ = 0; idx_ < MAX_LEVEL; ++idx_)
		{
			if(this->m_oElementManager[idx_].size() > 0)
			{
				ELEMENT_LEVEL_ITER oIter_ = this->m_oElementManager[idx_].begin();
				for(;oIter_ != this->m_oElementManager[idx_].end();++oIter_)
				{
					oIter_->second->draw(this->m_stElementBase.iWidth, this->m_stElementBase.iHeight, this->m_stElementBase.fScale);
				}
			}
		}
		
		if(this->m_stElementBase.bFadeIn || this->m_stElementBase.bFadeOut)
		{
			ofDisableAlphaBlending();
			ofSetColor(255,255,255);
		}

		ofPopMatrix();
		ofPopStyle();
	}
}
Ejemplo n.º 23
0
//--------------------------------------------------------------
void testApp::update(){
    // splashscreen
    if (ofGetFrameNum() == 1) {
		this->setup2();
	}
    
	// comprueba si la peli ya se acabo para volver a empezar
	// solo usar para debug luego comentar
	if(videoPanorama.videoplayer.getIsMovieDone()){
		 // reseteamos al inicio
        videoPanorama.resetPanorama();
        datosTelemetria.resetTelemetria();
	}

    // video panorama
    videoPanorama.update(datosTelemetria.getMotorData());
    
    
    // plataforma
    // vienen mapeados de la clase telemetria
    plataforma.setData(datosTelemetria.getPlatFormData().x, datosTelemetria.getPlatFormData().y);
    
    
    // telemetry
    if(videoPanorama.mustUpdate()){

		

        // nuevo frame del video, actualiza la telemetria
        datosTelemetria.update();

			overlay.begin();
			ofClear(0);
			//ofDisableDepthTest();
			//giramos 90 contrareloj
			ofPushMatrix();
			// video panorama
			camTv.begin(ofRectangle(0,0,1920,1080));
			ofRotateZ(90);
			videoPanorama.draw();


			camTv.end();
			ofPopMatrix();
		
			//ofPushStyle();
			// telemetry
			ofDisableDepthTest();
			datosTelemetria.drawOverlay();
			//ofEnableDepthTest();
			//ofPopStyle();
		
		
			ofEnableBlendMode(OF_BLENDMODE_MULTIPLY);
			ofSetColor(255,255,255,255);
			luto.draw(0,0);
			ofEnableBlendMode(OF_BLENDMODE_ALPHA);

			overlay.end();

    }

}
Ejemplo n.º 24
0
void testApp::draw(){ //どろーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

    float bxRandom = ofRandom(0, ofGetWidth());
	float byRandom = ofRandom(0, ofGetHeight());
    
    //キック音を取得後、twitterインスタンスを一つ追加する
	if(bd.isKick() && kick_timer > 5){
		ofxB new_instance;
		new_instance.setup(bxRandom, byRandom);
		ofxBMath.push_back(new_instance);
		kick_timer = 0;
	}
    
    //影を残す処理
	if (shadow_show) {
        ofNoFill();
    } else {
        //背景黒塗り
        ofSetColor(0, 0, 0);
        ofRect(0, 0, ofGetWidth(), ofGetHeight());
    }
    
    //画面を音に同期させて白くする処理
    if (bd.isKick() || bd.isSnare() || bd.isHat()) {
        ofSetColor(255, 255, 255);
        ofRect(0, 0, ofGetWidth(), ofGetHeight());
    }
    
    //謎の変数たち
	int hogehogecounter = 0;
    int count_delay = 0;
    
    //モーションレックの描画
    if (delay_move) kinectVJ.kinectDelayDraw();
    
    //kinectの実写映像の描画 現在は、kinectDelayDraw を描画するためにコメントアウト中
    //kinect.draw(0, 0, 640, 480);
    
    //kinectの円形のエフェクトの描画
    kinectVJ.kinectCircleDraw(color_sec, kinectCircle);

    //kinectの矩形のエフェクトの描画と変数をofxVJKinectクラスへ投げる
	for (int x=0; x < ofGetWidth(); x+=step) {
		for (int y=0; y < ofGetHeight(); y+=step) {
			hogehogecounter++;
			count_delay++;
			if (kinectShow) kinectVJ.kinectRectDraw(kinect.getDistanceAt(x,y), x, y, step, ofGetFrameNum() % 200, hogehogecounter, delay_rec);
		} 
	}

    //モーションレックのプログレスバー描画 //現在されてない
	if (delay_move) {
		ofSetColor(255, 0, 0, 100);	
	} else {
		ofSetColor(0, 0, 255, 100);
	}
	
	if (delay_rec) {
		ofSetColor(0, 255, 0, 100);
	}
	
	if (delay_move && delay_rec) {
		ofSetHexColor(0x9400D3);
	}
	float delay_frame = ofMap(ofGetFrameNum() % 200, 0, 200, 0, ofGetWidth());
	ofFill();

    //なにここ?
	for (int i=0; i < str_alpha.size(); i++) {
		str_alpha[i] -= 10;
		if (str_alpha[i] < 0) {
			str_alpha[i] = 255;
		}
	}
	
    //twitter timeline の描画
	for (int i=1; i < ofxBMath.size(); i++) {
		ofPushMatrix();
        
		ofTranslate(ofxBMath[i].x, ofxBMath[i].y, ofxBMath[i].z);
        ofRotateZ(ofxBMath[i].angle);
		float hogeAngle = ofMap(ofGetFrameNum() % 360, 0, 10, 0, 180);
		if (stringShow) {
            stringDrawPoetry(i);
		}
		ofPopMatrix();
	}
    
    //ランダムな走査線の描画
	for (int i=0; i < 4; i++) {
		float hogeY = ofRandom(0, ofGetHeight());
		ofLine(0, hogeY, ofGetWidth(), hogeY);
	}
	
    //サーチワードの描画
    if (strline.size() != 0) {
        ofSetColor(255,255,255, 150);
        if (showSearch) {
            font_title.drawString(wSearch, searchX, searchY);
        }
    }

    //デバッグページの描画
	if (debugOn) {
		debug_page();
	}
	
    //グリッチの描画
	if (glitch_on) {
		ofSetColor(255);
		img.draw(0, 0, ofGetWidth(), ofGetHeight());
	}   
}
Ejemplo n.º 25
0
  void draw() {
    ofTranslate(ofGetWidth()/2,ofGetHeight()/2);

    string txt = "地球公转的中心恒星"; //Hallo ik ben een zin
    ofRectangle bounds = font.getStringBoundingBox(txt,0,0);


    vector<unsigned int> charIDs = font.getCharacterIDs(txt);
    vector<ofMesh> charMeshes = font.getCharacterQuads(txt,0,0);

    if (charIDs.size()!=charMeshes.size()) {
      cout << "charIDs.size()!=charMeshes.size(): " << charIDs.size() << " vs " << charMeshes.size() << endl;
      std::exit(1);
    }

    float radius = 200;
    float antiAliasingScale = 2;
    float fontScale = 1;

    ofScale(fontScale,fontScale);

    ofScale(1/antiAliasingScale,1/antiAliasingScale);
    float scaledRadius = (1/fontScale) * radius * antiAliasingScale;

    enum Alignment { LEFT, CENTER, RIGHT } align = CENTER;
    float angle = 0;
    float px=0;
//    float scaledRadius = 200;

    for (int i=0; i<charIDs.size(); i++) {
      ofMesh &mesh = charMeshes.at(i);

      ofVec3f &a = mesh.getVertices().at(0);
      ofVec3f &b = mesh.getVertices().at(1);
      ofVec3f &c = mesh.getVertices().at(2);
      ofVec3f &d = mesh.getVertices().at(3);

      float x = b.x;
      float w = x-px;
      float z = i;
      angle += atan(w/scaledRadius);
      px = x;

      ofxTranslate(mesh,ofVec3f(-b.x,0,z));
      ofxTranslate(mesh,ofVec3f(0,scaledRadius,0));
      ofxRotate(mesh,-ofRadToDeg(angle),ofVec3f(0,0,1));
    }

    switch (align) {
      case LEFT: break;
      case CENTER: ofRotateZ(ofRadToDeg(angle/2)); break;
      case RIGHT: ofRotateZ(ofRadToDeg(angle)); break;
    }

    int nCopies = 3;

    for (int j=0; j<nCopies; j++) {
      ofPushMatrix();
      ofRotateZ(float(j)/nCopies*360);
      ofTranslate(0,0,j); //float(i)/nCopies*1);

      for (int i=0; i<charIDs.size(); i++) {
        font.bind(charIDs.at(i));
        charMeshes.at(i).draw();
      }

      ofPopMatrix();
    }

  }
//------------------------------------------------------------------
void demoParticle::drawp(){

	ofNoFill ();
	ofSetColor(103, 160, 237);
	//ofEllipse (ofGetMouseX(), ofGetMouseY(), 40, 40);
	ofVec2f Xaxix; Xaxix.set(1,0);
	float heading = -vel.angle(ofVec2f(1,0));
	heading = heading - PI/2;
	//float theta = vel.angle(Xaxix)-PI/2;
    ofFill();
	ofSetColor(103, 160, 237);

    ofPushMatrix();
    ofTranslate(pos.x,pos.y);
    ofRotateZ(heading);
    ofScale(2,2);

	ofSetColor(0);
    ofFill();
	ofSetColor(103, 160, 237);

    ofRect( -14, 0, 28, 14);

    ofSetColor(0);
    ofFill();
	ofSetColor(0, 128, 0);

    ofEllipse( -14, 0, 10, 10 );  // left wheel
    ofEllipse( -14, 14, 10, 10 ); // right wheel

    /** Experimental Feature */

//    ofFill();
//	ofSetColor(255,0,0);
//
//	if(blink>-90&&blink<=90)
//		ofEllipse( -14, 0, 10, 10 );  // left wheel
//	else  ofEllipse( -14, 14, 10, 10 ); // right wheel

	///


    // show the sensor/wheel connections
    ofNoFill();
	if (mode == aggressive || mode == fear) ofSetColor(0, 128, 0);
	else ofSetColor(128, 0, 0);
    if (mode == templove|| mode == fear) ofBezier(-7*2, 0,  0, 3*2, 0, 3*2, 7*2, 0);
    else ofBezier(-7*2, 0,  0, 5*2, 0, 5*2, 7*2, 7*2);
    
    
    if (mode == templove || mode == fear) ofBezier(-7*2, 7*2,  0, 4*2, 0, 4*2, 7*2, 7*2);
    else ofBezier(-7*2, 7*2, 0, 2*2, 0, 2*2, 7*2, 0);

	ofSetColor(255, 255, 255);
    ofBezier(7*2+7,5,  7*2, 0, 7*2, 0, 7*2+7, -5);
	ofBezier(7*2+7,5+7*2,  7*2, 7*2, 7*2,7*2,  7*2+7, 7*2 -5);
	path.arc(7, 0,  5, 5, PI/2, PI/2+PI);
    path.arc(7, 7, 5, 5, PI/2, PI/2+PI);  


    ofPopMatrix();
}
Ejemplo n.º 27
0
void faces::draw(){
    ofRestoreTextureWrap();
    ofRestoreMinMagFilters();
    ofBackground(0);
    backgroundImg.draw(0,0,1280,720);

    ofPushMatrix();
    ofTranslate(100,100);
        ofFill();
        ofSetColor(85,98,112);
        ofSetRectMode(OF_RECTMODE_CORNER);
        ofRect(0,0,SCREEN_W,SCREEN_H);
    ofDisableAlphaBlending();

    ofDisableDepthTest();
	float scaleX = ofMap(ofGetMouseX(), 0,ofGetWidth(), 0.0, 10.0);
	float scaleY = ofMap(ofGetMouseY(), 0,ofGetHeight(), 0.0, 10.0);
	float scaleZ = 2.0;
	
	int nCaras = caras.size();
	float zz = -600;
    for(int i=0; i<=currentFace; i++){
    ofPushMatrix();
//             ofTranslate(ofGetMouseX(),ofGetMouseY(),0);
        ofTranslate(141,83);
        // ofRotateY(360.0/nCaras*i);
        ofTranslate( (SCREEN_W/4.5) * (i%4), floor(i/4)*(SCREEN_H/2), 50);
        
        ofScale(2.4,2.4,1.0);//scaleY);//1);
        ofSetColor(255);
        ofNoFill();
        /*if(swTexture) {
            caras[i].img.bind();
            caras[i].meanObjMesh.drawFaces();
            caras[i].img.unbind();
        }*/
        if(i==currentFace && status==LOADINGFACE){
            ofRotateY(ofMap(ofGetElapsedTimeMillis()-timeStatusChanged , 0,LOADINGFACE_TIME, 0, 3*360.0));
                        glLineWidth(2);
            int time1=ofClamp(ofGetElapsedTimeMillis()-timeStatusChanged, 0, LOADINGFACE_TIME);
            caras[i].objVbo.draw(GL_LINE_STRIP,
                                 0, ofMap(time1,0,LOADINGFACE_TIME,
                                          0,caras[i].objVbo.getNumVertices()
                                          )
                                 );
        } else if(i==currentFace && status==FACE_FINISHED) {
            glLineWidth(2);
            ofRotateY(ofMap(ofGetElapsedTimeMillis()-timeStatusChanged , 0,LOADEDFACE_TIME, 0, 1*360));
            caras[i].img.bind();
            caras[i].meanObjMesh.drawFaces();
            caras[i].img.unbind();
            //caras[i].objMesh.drawWireframe();
            caras[i].objVbo.draw(GL_LINE_STRIP,0,caras[i].objVbo.getNumVertices());
        }
        else if(i!=currentFace || status==ALL_FACES_LOADED){
            ofPushMatrix();
            
            glLineWidth(2);
            if(i%2==0){
                ofRotateX( ((ofGetElapsedTimeMillis()-timeStatusChanged)/(30+i*3)) %15);
            }else{
                ofRotateZ( ((ofGetElapsedTimeMillis()-timeStatusChanged)/(30+i*3)) %15);
            }
            caras[i].img.bind();
            caras[i].meanObjMesh.drawFaces();
            caras[i].img.unbind();
            //caras[i].objMesh.drawWireframe();
            caras[i].objVbo.draw(GL_LINE_STRIP,0,caras[i].objVbo.getNumVertices());
            ofPopMatrix();
        }
        ofPopMatrix();
        fuente.drawString("visitante #" + ofToString( (time_init_scene/1000) %1000 +i*7) , (SCREEN_W/4) * (i%4)+(SCREEN_W/16), -30+(1+floor(i/4))*(SCREEN_H/2));
        
    }//fin for que dibuja las caras
    if(currentFace<4) {
        ofPushMatrix();
        ofTranslate( (SCREEN_W/4),
                    3*(SCREEN_H/4) );
        ofRect(0,0,SCREEN_W/2,20);
        ofFill();
        ofSetColor(251,184,41);
        ofRect(1,
               1,
               ofMap(ofGetElapsedTimeMillis()-time_init_scene, 0, (LOADINGFACE_TIME+LOADEDFACE_TIME)*4, 0, SCREEN_W/2-2),
               18 );
                ofSetColor(255);
        fuente.drawString("Cargando patrones desde memoria", 40,15);
        ofPopMatrix();
    }


    
	
	ofSetColor(255);
    ofPopMatrix();//fin del translate al punto de pantalla

	ofDrawBitmapString("'m' para cambiar modo de presentación", 20, 20);
	ofDrawBitmapString("'w' para dibujar wireframe", 20, 35);
	ofDrawBitmapString("'t' para dibujar texturas", 20, 50);
    
    ofDrawBitmapString(ofToString(ofGetMouseX()) +" Y: " + ofToString(ofGetMouseY()) , 20, 55);
    /*for(int i=0; i<nCaras; i++){
        caras[i].img.draw(i*300,100);
    }*/
}
Ejemplo n.º 28
0
void Maho::draw( float x, float y){
    if (!drawing) return;
    //phase0
//    if (lastMaho) {
//        float lastMahoLineNum = line1Num *2;
//        int lastMahoBlobPointNum = blobPointNum * 3;
//        float lastMahoSparkRangeMax = 180.0f;
//        float lastMahoLine2MinLength = 180.0f;//2.0f - 300.0f
//        float lastMahoLine2MaxLength = 500.0f;
//        float mahoLine2MaxLength = 110.5f;//
//        ofPushStyle();
//        ofPushMatrix();
//        ofTranslate(x, y);
//        
//        
//        for (int i = 0; i < lines2.size(); i++) {
//            lines2[i].draw();
//        }
//        ofFill();
//        b.draw();
//        b2.draw();
//        for (int i = 0; i < bunshis.size(); i++) {
//            bunshis[i].draw();
//        }
//        ofNoFill();
//        ofSetLineWidth(4.0f);
//        for (int i = 0; i < lines.size(); i++) {
//            ofPushMatrix();
//            ofRotateZ(lines[i].angle);
//            lines[i].draw();
//            ofPopMatrix();
//        }
//        ofPopMatrix();
//        ofPopStyle();
//        ofPushStyle();
//        lastparticles.draw();
//        ofPopStyle();
//        
//        return;
//    }
    if (mahoPhase == 0){
        ofPushStyle();
        ofPushMatrix();
        ofTranslate(x, y);
        for (int i = 0; i < lines2.size(); i++) {
            lines2[i].draw();
        }
        ofFill();
        b.draw();
        b2.draw();
        for (int i = 0; i < bunshis.size(); i++) {
            bunshis[i].draw();
        }
        ofNoFill();
        ofSetLineWidth(4.0f);
        for (int i = 0; i < lines.size(); i++) {
            ofPushMatrix();
            ofRotateZ(lines[i].angle);
            lines[i].draw();
            ofPopMatrix();
        }
        ofPopMatrix();
        ofPopStyle();
        ofPushStyle();
        lastparticles.draw();
        ofPopStyle();
        
    } else if (mahoPhase == 1){
        if ( currentMahoTime < keenTime) {//Keen
            ofPushStyle();
            ofPushMatrix();
            ofNoFill();
            ofSetColor(mainPink);
            ofSetLineWidth(keenWidth);
            ofPoint v = mahoPos[1] - mahoPos[0];
            ofLine(mahoPos[0], mahoPos[1]);
            ofPopMatrix();
            ofPopStyle();
        } else if ( currentMahoTime > keenTime && currentMahoTime < mahoPhase2Time[0]) {//本棚がグニャグニャ hondana
            //fade
            if (mahoIndex == 1) {
                //gunya1
                ofPushStyle();
                ofPushMatrix();
                ofFill();
                ofSetColor(color);
                ofBeginShape();
                for (int i = 0; i < HONDANA_INDEX_NUM; i++) {
                    ofVertex(hondanaPoints[i]);
                    hondanaPoints[i] += ofRandomf() * hondanaNoiseAmt;
                }
                ofEndShape();
                ofBeginShape();
                for (int i = HONDANA_INDEX_NUM - 1; i >= 0; i--) {
                    ofVertex(hondanaPoints[i]);
                    hondanaPoints[i] += ofSignedNoise(ofGetElapsedTimeMillis()) * hondanaNoiseAmt;
                }
                ofEndShape();
                ofPopMatrix();
                ofPopStyle();
            } 
        }
        
        
        //sera
        if (currentMahoTime > keenTime && mahoIndex == 2) {//sera
            if (!seraDid) {
                if (choicedXtion == 0) {
                    bDrawSeraBlob = true;
                } else {
                    for (int i = 1; i <= XTION_NUM; i++) {
                        if (choicedXtion - 1 == i){
                            bDraw[i] = true;
                        }else bDraw[i] = false;
                    }
                    bOpenCv = true;
                }
                seraDid = true;
            }
            if (bSera) {
                if (bDrawSeraBlob){
                    ofPushStyle();
                    ofFill();
                    if (toggleCvFadeOut) {
                        if (openCvDrawColor.r > 2)openCvDrawColor.r -= 3;
                        if (openCvDrawColor.g > 2)openCvDrawColor.g -= 3;
                        if (openCvDrawColor.b > 2)openCvDrawColor.b -= 3;
                        if (openCvDrawColor.r < 3) {
                            bDrawSeraBlob = false;
                        }
                    }
                    ofSetColor(openCvDrawColor);
                    
//                    ofBeginShape();
//                    for (int i = 0; i < 6; i++) {
//                        ofVertex(seraBlob[i].x + ofRandomf() * 10.0f, seraBlob[i].y + ofRandomf() * 10.0f);
//                    }
//                    ofEndShape();
                    
//                    ofBeginShape();
//                    for (int i = 0; i < 6; i++) {
//                        ofVertex(seraBlob[i].x + ofRandomf() * 10.0f, seraBlob[i].y + ofRandomf() * 10.0f);
//                    }
//                    ofEndShape();
//                    ofPoint centerOfSera(0.0f, 0.0f);
//                    for (int i = 0; i < 6; i++) {
//                        centerOfSera.x += seraBlob[i].x;
//                        centerOfSera.y += seraBlob[i].y;
//                    }
//                    centerOfSera /= 6.0f;
//                    for (int i = 0; i < 100; i++) {
//                        float length = ofRandom(0.0f, 100.0f);
//                        float angle = ofRandom(0.0f, 360.0f);
//                        float xx = length * cos(angle);
//                        float yy = length * sin(angle);
//                        if (sin(angle) < 0) yy *= 0.5f;
//                        
//                        ofRect(2.0f + centerOfSera.x + xx, 2.0f + centerOfSera.y + yy, 8.0f, 8.0f);
//                    }
                    
                    for (int i = 0; i < 100; i++) {
                        float length = ofRandom(0.0f, 100.0f);
                        float angle = ofRandom(0.0f, 360.0f);
                        float xx = length * cos(angle) * 0.4;
                        float yy = length * sin(angle);
                        if (sin(angle) < 0) yy *= 0.5f;
                        
                        ofRect(4.0f + seraHeadPos[0].x + xx, 4.0f + seraHeadPos[0].y + yy, 8.0f, 8.0f);
                    }
                    
                    for (int i = 0; i < 100; i++) {
                        float length = ofRandom(0.0f, 100.0f);
                        float angle = ofRandom(0.0f, 360.0f);
                        float xx = length * cos(angle) * 0.4;
                        float yy = length * sin(angle);
                        if (sin(angle) < 0) yy *= 0.5f;
                        
                        ofCircle(seraHeadPos[0].x + xx, seraHeadPos[0].y + yy, 8.0f);
                    }

//                    float noiseLineLength = 30.0f;
//                    ofNoFill();
//                    ofSetColor(openCvDrawColor);
//                    ofSetLineWidth(2.0f);
//                    ofEnableBlendMode(OF_BLENDMODE_SUBTRACT);
//                    for (int i = 0; i < 50; i++) {
//                        ofLine(centerOfSera.x - noiseLineLength /2.0f, centerOfSera.y + ofNoise(ofGetElapsedTimef() * 100 * i)*noiseLineLength,  centerOfSera.x + noiseLineLength /2.0f, centerOfSera.y + ofNoise(ofGetElapsedTimef() * 100 * i)*noiseLineLength);
//                    }
//                    ofDisableBlendMode();
                    
                }
                sera.draw();
            } else {
                sera.toggleGo();
                bSera = true;
            }
        }
        //harada door
        if (currentMahoTime > keenTime && mahoIndex == 3) {
            //gunya1
            ofPushStyle();
            ofFill();
            ofSetColor(color);
            ofBeginShape();
            for (int i = 0; i < 6; i++) {
                ofVertex(doorPos[i]);
            }
            ofEndShape();
            ofBeginShape();
            for (int i = 0; i < 6; i++) {
                ofVertex(doorPosDamy[i]);
                doorPosDamy[i].x += ofRandomf() * doorGunyaAmt;
            }
            ofEndShape();
            ofBeginShape();
            for (int i = 4 - 1; i >= 0; i--) {
                ofVertex(doorPosDamy[i]);
                doorPosDamy[i].x += ofRandomf() * doorGunyaAmt;
            }
            ofEndShape();
            ofPopStyle();
        }
        //harada fire
        if (currentMahoTime > keenTime && mahoIndex == 6) {
            bHaradaFire = true;
            haradaFire.setup();
            haradaFire.toggleGo();
            mahoIndex = 0;
        }
        //sushi
        if (currentMahoTime > keenTime && mahoIndex == 7) {
            //rokka-
            ofPushStyle();
            ofPushMatrix();
            ofFill();
            ofSetColor(color);
            ofBeginShape();
            for (int i = 0; i < 4; i++) {
                ofVertex(rokkaPos[i]);
            }
            ofEndShape();
            ofBeginShape();
            for (int i = 0; i < 4; i++) {
                ofVertex(rokkaPosDamy[i].x + ofRandomf() * hondanaNoiseAmt, rokkaPosDamy[i].y + ofRandomf() * hondanaNoiseAmt);
            }
            ofEndShape();
            ofBeginShape();
            for (int i = 3; i >= 0; i--) {
                ofVertex(rokkaPosDamy[i].x + ofSignedNoise(ofGetElapsedTimeMillis()) * hondanaNoiseAmt, rokkaPosDamy[i].y + ofSignedNoise(ofGetElapsedTimeMillis()) * hondanaNoiseAmt);
            }
            ofEndShape();
            ofPopMatrix();
            ofPopStyle();
        }
        //gomory
        if (currentMahoTime > keenTime && mahoIndex == 8) {
            ofPushStyle();
            ofPushMatrix();
            ofFill();
            ofSetColor(color);
            ofBeginShape();
            for (int i = 0; i < 6; i++) {
                ofVertex(doorPos[i]);
            }
            ofEndShape();
            ofBeginShape();
            for (int i = 0; i < 6; i++) {
                ofVertex(doorPosDamy[i]);
                doorPosDamy[i].x += ofRandomf() * doorGunyaAmt;
            }
            ofEndShape();
            ofBeginShape();
            for (int i = 4 - 1; i >= 0; i--) {
                ofVertex(doorPosDamy[i]);
                doorPosDamy[i].x += ofRandomf() * doorGunyaAmt;
            }
            ofEndShape();
            ofPopMatrix();
            ofPopStyle();
        }

        
    }
    
}
Ejemplo n.º 29
0
//--------------------------------------------------------------
void testApp::draw() {
	
	    ofBackground(255, 255, 255);
		
		back.draw(0,0,ofGetWidth(),ofGetHeight());
	    
		
		//cbot01.draw(0, 0);
		
		
		if (b02==true) {
			back002.draw(0,0, ofGetWidth(),ofGetHeight());
			
			
			svg02.load("bot04.svg");
			
			ofPath path02;
			path02 = svg02.getPathAt(0);
			
			ofPolyline line02 = path02.getOutline()[0];
			polyLine.clear();
			
			cout << line02.getVertices().size() << endl;
			for (int i = 0; i < line02.getVertices().size(); i++){
				polyLine.addVertex(line02.getVertices()[i]);
			}
			
			polyLine.setPhysics(0.0, 0.5, 0.5);
			polyLine.create(box2d.getWorld());
			
			
		}
		
		if (b03==true) {
			back003.draw(0,0, ofGetWidth(),ofGetHeight());
			
			
			svg03.load("bot02.svg");
			
			
			ofPath path03;
			path03 = svg03.getPathAt(0);
			
			ofPolyline line03 = path03.getOutline()[0];
			polyLine.clear();
			
			cout << line03.getVertices().size() << endl;
			for (int i = 0; i < line03.getVertices().size(); i++){
				polyLine.addVertex(line03.getVertices()[i]);
			}
			
			polyLine.setPhysics(0.0, 0.5, 0.5);
			polyLine.create(box2d.getWorld());
			
			
		}
		
		if (b04==true) {
			back004.draw(0,0, ofGetWidth(),ofGetHeight());
			
			
			svg04.load("bot03.svg");
			
			
			ofPath path04;
			path04 = svg04.getPathAt(0);
			
			ofPolyline line04 = path04.getOutline()[0];
			polyLine.clear();
			
			cout << line04.getVertices().size() << endl;
			for (int i = 0; i < line04.getVertices().size(); i++){
				polyLine.addVertex(line04.getVertices()[i]);
			}
			
			polyLine.setPhysics(0.0, 0.5, 0.5);
			polyLine.create(box2d.getWorld());
			
			
		} 
		
		if (b05==true) {
			ofSetColor(255);
			back.draw(0,0, ofGetWidth(),ofGetHeight());
			
			
			svg.load("bot01.svg");
			
			
			ofPath path;
			path = svg.getPathAt(0);
			
			ofPolyline line = path.getOutline()[0];
			polyLine.clear();
			
			cout << line.getVertices().size() << endl;
			for (int i = 0; i < line.getVertices().size(); i++){
				polyLine.addVertex(line.getVertices()[i]);
			}
			
			polyLine.setPhysics(0.0, 0.5, 0.5);
			polyLine.create(box2d.getWorld());
			
			
		} 
		
		
		
		
		
		
		// circle with animals
		for(int i=0; i<circles.size(); i++) {
			ofNoFill();
			circles[i].draw(); 
			
		}
		
		
		// testing boxes
		
		/*for(int i=0; i<boxes.size(); i++) {
		 ofFill();
		 
		 SoundData * data = (SoundData*)boxes[i].getData();
		 if(data && data->bHit) ofSetHexColor(0xff0000);
		 else ofSetHexColor(0x4ccae9);
		 //ofEnableAlphaBlending();
		 //ofSetColor(255,0,0,0);
		 //ofSetHexColor(0xe63b8b);
		 //	boxes[i].draw();
		 
		 }*/
		
		
		// animal boxes
		/*for(int i=0; i<boxes.size(); i++) {
		 //ofFill();
		 SoundData * data = (SoundData*)boxes[i].getData();
		 //ofEnableAlphaBlending();
		 //ofSetColor(R,G,B);
		 //ofSetHexColor(0xe63b8b);
		 //	boxes[i].draw();
		 
		 }*/
		
		
		for(int i=0; i<images.size(); i++) {
			
		    
			ofSetColor(circles[i].color.r, circles[i].color.g, circles[i].color.b);
			ofSetRectMode(OF_RECTMODE_CENTER);
			
		    ofPushMatrix();
	        
			ofTranslate(circles[i].getPosition().x, circles[i].getPosition().y);
			ofRotateZ(circles[i].getRotation());
		    images[i].draw(0,0);
			
		    ofSetRectMode(OF_RECTMODE_CORNER);
		    
		    ofPopMatrix();
			
			
		}
		
		
		
		/*for(int i=0; i<circles.size(); i++) {
		 ofFill();
		 SoundData * data = (SoundData*)circles[i].getData();
		 
		 if(data && data->bHit) ofSetHexColor(0xff0000);
		 else ofSetHexColor(0x4ccae9);
		 
		 
		 circles[i].draw();
		 }*/
		
		//ofSetColor(255,255,130);
		//	
		//	ofDrawBitmapString("drawing mode: inward", 50, 90);
		//		
		//	ofDrawBitmapString("drawing mode: outward", 50, 120);
		//	
		//	ofDrawBitmapString("drawing mode: clockwise", 50, 150);
		//	
		//	ofDrawBitmapString("drawing mode: counter-clockwise", 50, 170);
		//		
		//		
		//			
		//			
		//	
		//	string info = "";
		//	info += "FPS: "+ofToString(ofGetFrameRate(), 1)+"\n";
		//	info += "FPS: "+ofToString(R, 1)+"\n";
		//	info += "FPS: "+ofToString(G, 1)+"\n";
		//	info += "FPS: "+ofToString(B, 1)+"\n";
		//	ofSetHexColor(0x444342);
		//	ofDrawBitmapString(info, 30, 30);
		//		
		
		
		/*for(int i=0; i<customParticles.size(); i++) {
		 customParticles[i].draw();
		 }*/
		
		ofNoFill();
		//ofSetHexColor(0x444342);
		ofEnableAlphaBlending();
		ofSetColor(255, 0, 255,0);
		ofEnableAlphaBlending();
		//if(drawing.size()==0) 
		polyLine.draw();
		//else drawing.draw();
		
		
		
		//text
		//ofSetColor(80);
		
		//ofRect(20,20, 300, 800);
		
		
		
		ofSetColor(0, 0, 0);
	ofPushMatrix();
	ofTranslate(1005,550);
	ofRotateZ(-12);
	//font.drawString(typeStr, 0,0);
	
	ofDrawBitmapString(typeStr, 0,0);
	ofPopMatrix();	
		
		
		
	
	ofSetColor(255, 255, 255);//****important
		
	
		
	if (startscreen) {
		frontPage.draw(0, 0, ofGetWidth(),ofGetHeight());
	}
	
	
	
	
}
Ejemplo n.º 30
0
void testApp::drawAnotherPointCloud() {
    if(kinect2.isFrameNew()){
        if(meditationLevel >= 80 && meditationLevel< 95){
            ofMesh mesh;
            mesh.setMode(OF_PRIMITIVE_POINTS);
            int w = 640;
            int h = 480;
            vector<target> targets;
            for(int y=0;y<h;y+=step){
                for(int x=0;x<w;x+=step){
                    if(kinect2.getDistanceAt(x, y)>0&&kinect2.getDistanceAt(x, y)<1500){
                        mesh.addVertex(ofVec3f(kinect2.getWorldCoordinateAt(x, y)));
                    }
                }
            }
            ofPushMatrix();
            ofSetColor(0,0,0);
            //point two flip function...
            ofScale(-1,-1,1);
            glPointSize(1);
            ofRotateY(y2angle);
            ofRotateZ(z2angle);
            ofRotateX(x2angle);
            ofTranslate(anotherPointCloudPos);
            ofScale(kinectImageScale, kinectImageScale, kinectImageScale);
            
            mesh.draw();
            ofPopMatrix();
        }else{
            ofMesh mesh;
            ofMesh kinectData;
            kinectData.setMode(OF_PRIMITIVE_POINTS);
            mesh.setMode(OF_PRIMITIVE_POINTS);
            int w = 640;
            int h = 480;
            vector<target> targets;
            for(int y=0;y<h;y+=step){
                for(int x=0;x<w;x+=step){
                    if(kinect2.getDistanceAt(x, y)>0 && kinect2.getDistanceAt(x, y)<1500){
                        targets.push_back(ofVec3f(kinect2.getWorldCoordinateAt(x, y)));
                        if(firstRun2 == false){
                            ps2.push_back(ofVec3f(kinect2.getWorldCoordinateAt(x, y)));
                        }
                        
                    }
                }
            }
            firstRun2 = true;
            
            
            //compare the amount between our Particle Vector and all kinect particles
            while(targets.size() > ps2.size()){
                ps2.push_back(ofVec3f(ofRandom(-300,300), ofRandom(-300,300),800));
            }
            //===============SET TARGETS===============
            for(int i=0;i<ps2.size();i++){
                float minDistance = 100000;
                float index = 0;
                
                for(int b=0;b<targets.size();b++){
                    if(targets[b].choosen==false){
                        float distance;
                        distance = ps2[i].location.distance(targets[b].location);
                        if(distance < minDistance){
                            minDistance = distance;
                            index = b;
                        }
                    }
                }
                // cout<<"the "<<i<<"'th particle's"<<" minimum distance is "<<minDistance<<" .......his index in [targets] is: "<<index<<endl;
                ps2[i].seek(targets[index].location);
                ps2[i].target_assigned = true;
                targets[index].choosen = true;
                ps2[i].update();
                //adjust movement parameter based on Meditation Level
                ps2[i].maxforce = ofMap(meditationLevel, 0, 85, 0.01, 5);
                ps2[i].maxspeed = ofMap(meditationLevel, 0, 85, 20, 5);
                mesh.addVertex(ps2[i].getPosition());
                
            }
            //==================JUST DRAW===============
            ofPushMatrix();
            ofPushStyle();
            ofSetColor(0,0,0);
            ofScale(-1,-1,1);
            glPointSize(1);
            ofRotateY(y2angle);
            ofRotateZ(z2angle);
            ofRotateX(x2angle);
            ofTranslate(anotherPointCloudPos);
            ofScale(kinectImageScale, kinectImageScale, kinectImageScale);
            mesh.draw();
            ofPopStyle();
            ofPopMatrix();
            
            
            //        for (int i = 0; i<ps.size(); i++){
            //            ps[i].target_assigned = false;
            //        }
            //
            
        }//end [meditationlevel < 80] if_statment
    }//end the [kinect.frameNew] if_statement
    
}