Пример #1
0
//--------------------------------------------------------------
void testApp::draw(){
	
	cam.draw();

	ofxSphere(ofGetWidth()/2, ofGetHeight()/2, 0, 40, 10, 29);
	
}
Пример #2
0
//--------------------------------------------------------------
void testApp::drawScene() {
	glEnable(GL_DEPTH_TEST);
	
	for (int i = 0; i < numObj; i++) {
		ofxVec3f pos = objPos[i];
		ofxVec4f col = objCol[i];
		int size = objSize[i];
		ofSetColor(col.x, col.y, col.z);
		ofxQuaternion qua = objRot[i];
		float rad = 0.0; ofxVec3f rvec;
		qua.getRotate(rad, rvec);
		ofPushMatrix();
		ofTranslate(pos.x, pos.y, pos.z);
		ofRotate(ofRadToDeg(rad), rvec.x, rvec.y, rvec.z);
		int typ = objType[i];
		if (typ == 1) { 
			ofxSphere(0,0,0, size);
		}else {
			ofxBox(0,0,0, size);
		}
		ofPopMatrix();
	}
	
	ofSetColor(255, 255, 255);
}
Пример #3
0
//--------------------------------------------------------------
void testApp::drawScene() {
	
	ofPushMatrix();
	for (int i = 0; i < numObj; i++) {
		ofxVec3f pos = objPos[i];
		ofxVec4f col = objCol[i];
		int size = objSize[i];
		ofSetColor(col.x, col.y, col.z);
		ofxSphere(pos.x, pos.y, pos.z, size);
	}
	ofPopMatrix();
}
Пример #4
0
//--------------------------------------------------------------
void testApp::drawScene() {
	glEnable(GL_DEPTH_TEST);

	for (int i = 0; i < numObj; i++) {
		ofxVec3f pos = objPos[i];
		ofxVec4f col = objCol[i];
		int size = objSize[i];
		ofSetColor(col.x, col.y, col.z);
		ofxSphere(pos.x, pos.y, pos.z, size);
//		ofxBox(pos.x, pos.y, pos.z, size);
//		ofPushMatrix();
//		ofTranslate(pos.x, pos.y, pos.z);
//		ofCircle(0, 0, size);
//		ofPopMatrix();
	}

	ofSetColor(255, 255, 255);
}
Пример #5
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();
}
Пример #7
0
//----------------------------------------
void ofxSphere(const ofPoint& position, float radius) {
	ofPushMatrix();
	ofTranslate(position);
	ofxSphere(radius);
	ofPopMatrix();
}
Пример #8
0
//----------------------------------------
void ofxSphere(float x, float y, float radius) {
	ofxSphere(x, y, 0, radius);
}
Пример #9
0
//----------------------------------------
void ofxSphere(float x, float y, float z, float radius) {
	ofxSphere(ofPoint(x, y, z), radius);
}
void ofxIndustrialRobotVisualizer::drawGeneric(){
	
	//Base
	ofSetColor(0, 255, 255);	
	glTranslated(0, -25, 0);
	//ofxBox(ofxVec3f(0,25,0), ofxVec3f(200, 50, 200));	
	
	//model.draw();
	ofSetColor(255, 0, 0);
	glPushMatrix();
	glScaled(1.0, -1.0, 1.0);
	ofSetColor(255, 255, 255);

//	model.draw();
	glPopMatrix();
	//	ofxSphere(ofxVec3f(0,0,0), ofxVec3f(200, 200, 200));
	
	glRotated(180, 0.0, 0.0, -1.0); 
	glPushMatrix();
		glScaled(1.0, 1.0, -1.0);
	//	glScaled(0.1, 0.1, 0.1);
	drawArm0();
	drawArm1();
	drawArm2();
	drawArm3();
	drawArm4();
	//Draw tool
	ofSetColor(255, 0, 0);
	float l = helper->getTool()->l; //The length of the tool
	ofxVec3f rotation = helper->getTool()->getRotation();
	glRotated(rotation.z, 0.0, 0.0, 1.0);
	ofxBox(ofxVec3f(helper->getTool()->h/2.0,l/2,0), ofxVec3f(helper->getTool()->h, l, helper->getTool()->w), ofxVec3f(0.0, 0.0, 0.0));
	//	ofxVec3f axis = helper->getAxis(i); //The axis the arm rotates around
	//	ofxVec3f offset = helper->getOffset(i);
	//	glRotated(helper->getRotationAngle(i), axis.x, axis.y, axis.z); // Rotate it around the axis
	//	glTranslated(0, l, 0);
	//	ofxBox(ofxVec3f(0,-l/2.0,0), ofxVec3f(60, l, 60), ofxVec3f(0.0, 0.0, 0.0));
	//	glTranslated(-offset.y, offset.x, offset.z);	
	
	glPopMatrix();
	glScaled(1.0, 1.0, -1.0);

	//Target
	glRotated(180, 0.0, 1.0, 0.0); 
	ofSetColor(255, 0, 0);
	ofxSphere(controller->targetPosition, ofxVec3f(20, 20, 20));
	glBegin(GL_LINE_STRIP);
	glVertex3d(controller->targetPosition.x, controller->targetPosition.y, controller->targetPosition.z);
	ofxVec3f temp = controller->targetPosition+ controller->targetDir*500.0;
	glVertex3d(temp.x,temp.y, temp.z);
	glEnd();
	
	glPushMatrix();
	ofSetColor(0, 255, 0);
	for(int i=0;i<timeline->numberPositionCues(); i++){
		ofxVec3f vec = timeline->getPositionCue(i)->position;
		ofxSphere(vec, ofxVec3f(10, 10, 10));	
	}
	timeline->spline.drawRaw(10, 5);
	ofSetColor(255, 255, 0, 100);
	timeline->spline.drawSmooth(50, 0, 10);
	glLineWidth(1);
	ofSetColor(255, 255, 255, 255);
	ofFill();
	//	glDisable(GL_DEPTH_TEST);
	
/*	glBegin(GL_POLYGON);
	for(int i=0;i<3;i++){
		glVertex3f(plotter->spaceDefinition[i].x,plotter->spaceDefinition[i].y,plotter->spaceDefinition[i].z);
	}
	glVertex3f(plotter->fourthCorner().x,plotter->fourthCorner().y,plotter->fourthCorner().z);
	glEnd();
*/
	for(int i=0;i<plotter->lines.size();i++){
		glBegin(GL_LINE_STRIP);
		ofxVec3f x = (plotter->spaceDefinition[1]-plotter->spaceDefinition[0]).normalized();
		ofxVec3f y = (plotter->spaceDefinition[2]-plotter->spaceDefinition[1]).normalized();
		for(int u=0;u<plotter->lines[i].size();u++){
			ofxVec3f point = x * plotter->lines[i][u].x + y * plotter->lines[i][u].y + plotter->spaceDefinition[0];
			glVertex3f(point.x,point.y,point.z);
		}

		glEnd();
	}
	
	glPopMatrix();
	
	
}
Пример #11
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();

}
void Particle::draw() {
    
    ofSetColor(r, g, b);
    ofxSphere(x, y, z, sphereRadius, sphereRadius, sphereRadius, 0, 0, 0);
}