Ejemplo n.º 1
0
void MotorsAndSensors::draw(){
	
	ofBackground(bgColor.r, bgColor.g, bgColor.b);
	
	// update camera
	camera.lerpPosition(cameraPos, 0.1);
	camera.lerpEye(cameraEye, 0.1);
	
	// enter 3D
	glEnable(GL_DEPTH_TEST); //lights look weird if depth test is not enabled
	camera.place();
	ofxLightsOn();
	
	ofPushMatrix();
	ofRotate(cylinderRotation, 0, 1, 0);
	//ofxBaseContainer::draw();
	Singleton<SensorCtrl>::instance()->draw3d();
	Singleton<MotorCtrl>::instance()->draw3d();
	Singleton<SceneCtrl>::instance()->draw3d();
	Singleton<CvCtrl>::instance()->draw3d();
	ofPopMatrix();
	
	// exit 3D
	ofxLightsOff();
	camera.remove();
	glDisable(GL_DEPTH_TEST);
	
	ofxBaseContainer::draw();
}
Ejemplo n.º 2
0
//--------------------------------------------------------------
void testApp::draw(){
	
	camera.place();//this MUST be inside the draw function, and actually places the camera in position
	
	ofxLightsOn(); //turn lights on
	ofSetColor(255, 255, 255);
	
	ofxSphere(centerX - 150, centerY - 150, 0, 50, 100, 100, rotX, rotY, 0);
	
	ofxBox(centerX + 150, centerY - 150, 0, 100, 200, 20, rotX, rotY, 0);
	
	ofxCone(centerX - 150, centerY + 150, 0, 50, 100, 50, rotX, rotY, 0);
	
	ofxCapsule(centerX + 150, centerY + 150, 0, 100, 100, 50, rotX, rotY, 0);
	
	ofxLightsOff(); //turn lights off to draw text
	string info = "PRESSING MOUSE WILL TURN SMOOTH LIGHTS OFF";
	ofSetColor(0, 0, 0);
	ofDrawBitmapString(info, 20, 20);


}
void ofxIndustrialRobotVisualizer::draw3d(int x, int y, int w, int h){	
	//	camera.orbitAround(ofxVec3f(ofGetWidth()/2.0,ofGetHeight()/2.0,0), ofxVec3f(0.0,1.0,0.0), rotationSpeed);
	light1.directionalLight(255, 255, 255, 0.0, 0.3, 1.0);
	glPushMatrix();
	glDisable(GL_DEPTH_TEST);
	glTranslated(x, y, 0);
	ofEnableAlphaBlending();
	ofFill();
	ofSetColor(255, 255, 255, 20);
	ofRect(0, 0, w, h);
	glPushMatrix();
	glViewport(x, ofGetHeight()-h-y, w, h);
	glEnable(GL_DEPTH_TEST);
	glTranslated(0, 1000, -2500);
	
	ofxLightsOn();
	ofFill();
	ofSetColor(0, 255, 0);	
	ofxSphere(ofGetWidth()/2.0, ofGetHeight()/2.0, 0, 500, 10, 500);
	ofSetColor(0, 255, 255);	
	glTranslated(ofGetWidth()/2.0, ofGetHeight()/2.0, 0);
	
	drawGeneric();
	
	glColor3f(255, 255, 255);	
	
	glViewport(0, 0, ofGetWidth(), ofGetHeight());
	ofSetupScreen();
	glDisable(GL_DEPTH_TEST);
	
	ofNoFill();
	ofSetColor(255, 255, 255,255);
	ofxLightsOff();
	glPopMatrix();
	ofRect(0, 0, w, h);
	ofDrawBitmapString("Robot Visualizer", x+10, y+15);
	glPopMatrix();
}
Ejemplo n.º 4
0
//--------------------------------------------------------------
void testApp::draw(){

	ofBackground(200,200,250);

	

    // kinect draw
    if (debug == true) {
#ifdef KINECT
        ofSetLineWidth(1);
        ofSetColor(255, 255, 255);
        
        ofSetRectMode(OF_RECTMODE_CORNER);
        rgb.draw(0, 0, miniWidth, miniHeight);
        
        
        //glEnable(GL_BLEND);
        //glBlendFunc(GL_DST_COLOR, GL_ZERO);
        
        // user.drawUserMasks(0, 0);
        //eeglDisable(GL_BLEND);
        user.draw();
        
        ofSetColor(255, 0, 0, 255);
        ofCircle(leftHand.x, leftHand.y, 10);
        ofCircle(rightHand.x, rightHand.y, 10);
        ofCircle(theHead.x, theHead.y, 10);
        
        ofSetColor(0, leftHandDist * 4, rightHandDist * 4);
        
#endif  
    }  
    else {
        ofSetColor(255, 0, 0);
//        ofDrawBitmapString("keypressed: " + info, 20, 30);
//		ofCircle(current.location.x, current.location.y-20, current.location.z-300);
//        ofDrawBitmapString("category: " + category, youPos.x, youPos.y);
//        ofDrawBitmapString("year: " + ofToString(year), 20, 50);
//        ofDrawBitmapString("height: " + ofToString(height/multiplier) + " million", 20, 70);
//        ofDrawBitmapString("boxIndexI: " + ofToString(boxIndexI) + "; boxIndexJ: " + ofToString(boxIndexJ), 20, 110);
//        ofDrawBitmapString("youPosZ: " + ofToString(youPos.z), 20, 130);
//        ofDrawBitmapString("youPosY: " + ofToString(youPos.y), 20, 150);
//        ofDrawBitmapString("youPosX: " + ofToString(youPos.z), 20, 170);
                           
        camera.place();//this MUST be inside the draw function, and actually places the camera in position

		
		
        ofxLightsOn(); //turn lights on
		

        
        //draw the ground
        ofSetColor(10, 10, 10);
        ofxQuad(g1, g2, g3, g4);
		
		//draw the sky
		ofSetColor(100, 100, 200, 50);
		//ofxQuad(s1, s2, s3, s4);
        
		//ofxSphere(centerX, centerY, 0, 10000);
		
        //ofSetColor(255, 255, 255);
        
        // draw budgetBoxes
        for (int i=0; i<18; i++)
        {
            for (int j=0; j<27; j++)
            {
                if (i==boxIndexI && j==boxIndexJ)
                    myBoxes[i][j].draw(240);
                else
                    myBoxes[i][j].draw();
            }
        }
        
        ofSetColor(0, 0, 0);
        

		

        ofxLightsOff(); //turn lights off to draw text

        
#ifdef KINECT
        // draw skeleton
        ofPushMatrix();
			if (ontop==1)
				ofTranslate(youPos.x-25 , youPos.y-45, youPos.z+20);
			if (ontop==-1)
				ofTranslate(youPos.x-25 , youPos.y, youPos.z+20);
					
        ofScale(.08, .08, .08);
		if (!nouserfound)
		{	user.draw();
			ofSetColor(255, 255, 255);
			
			ofxSphere(theHead.x, 130, 0, 100);
			
			ofSetRectMode(OF_RECTMODE_CENTER);
			hat.draw(theHead.x, -40);
			
			//ofxSphere(leftHand.x/10, leftHand.y/10, 0,30);
				//ofxSphere(rightHand.x/10, rightHand.y/10, 0,30);
				//ofxSphere(theHead.x/10, theHead.y/10, 0, 30);
		}
        ofPopMatrix();
#else        
        // draw sphere
        ofxSphere(youPos.x, youPos.y, youPos.z, 10);
		ofSetColor(255, 255, 255);

		hat.draw(youPos.x-30, youPos.y-50, 50, 50);
#endif
	
    }
	
	
	ofPushMatrix();
		ofTranslate(0,0,youPos.z);
		ofSetColor(255,255,255);
		ofRotateY(180);
		string curHeightString = "$" + ofToString((int) abs(youPos.y/multiplier)) + ",000,000";
		if (abs(youPos.y) < 10*multiplier)
			curHeightString = "";
        if (ontop == 1)
            verdana.drawString(curHeightString, -youPos.x-verdana.stringWidth(curHeightString)/2, youPos.y-65);
        else
            verdana.drawString(curHeightString, -youPos.x-verdana.stringWidth(curHeightString)/2, youPos.y-20);

		
//		verdana.drawString(curHeightString, -youPos.x-verdana.stringWidth(curHeightString)/2, youPos.y-20);
//		string yearString = ofToString(year);
//		string heightString = ofToString(height/multiplier)  + " million";
//		verdana.drawString(yearString, -youPos.x-verdana.stringWidth(yearString)/2, youPos.y);
//		verdana.drawString(category, -youPos.x-verdana.stringWidth(category)/2, youPos.y+10);
//		verdana.drawString(heightString, -youPos.x-verdana.stringWidth(heightString)/2, youPos.y+20);
	ofPopMatrix();

	ofPushMatrix();
		ofTranslate(0,0,youPos.z);
        ofRotateY(180);
		string yearString = ofToString(year);
		string heightString = "$" + ofToString(height/multiplier)  + " million";
		verdana.drawString(heightString, -youPos.x-verdana.stringWidth(heightString)/2, -40);
		verdana.drawString(yearString, -youPos.x-verdana.stringWidth(yearString)/2, -30);
		if (category == "Education, Training, Employment, and Social Services") {
				verdana.drawString("Education, Training, Employment", -youPos.x-verdana.stringWidth("Education, Training, Employment")/2, -20);
				verdana.drawString(" and Social Services", -youPos.x-verdana.stringWidth(" and Social Services")/2, -10);
		}
		else 
			verdana.drawString(category, -youPos.x-verdana.stringWidth(category)/2, -20);
	ofPopMatrix();

}