Пример #1
0
//--------------------------------------------------------------
void testApp::draw(){
	ofColor cyan = ofColor::fromHex(0x00abec);
	ofColor magenta = ofColor::fromHex(0xec008c);
	ofColor yellow = ofColor::fromHex(0xffee00);
	
	ofBackgroundGradient(magenta * .6, magenta * .4);
	ofNoFill();
	
	easyCam.begin();
	ofRotateX(15);

	ofSetColor(0);
	ofDrawGrid(500, 10, false, false, true, false);
	
	// draw the path of the box
	ofSetLineWidth(2);
	ofSetColor(cyan);
	pathLines.draw();
	
	// draw a line connecting the box to the grid
	ofSetColor(yellow);
	ofLine(current.x, current.y, current.z, current.x, 0, current.z);
	
	// translate and rotate to the current position and orientation
	ofTranslate(current.x, current.y, current.z);
	rotateToNormal(current - previous);
	ofSetColor(255);
	ofDrawBox(32);
	ofDrawAxis(32);
	
	easyCam.end();
}
Пример #2
0
//--------------------------------------------------------------
void testApp::draw(){
	
	ofBackground(0);


	cam.begin();	
	ofFill();
	ofDrawAxis(1000);
	ofPushMatrix();
	    
	ofRotateY(receivedRotation.y);
	ofRotateX(receivedRotation.x);	
	ofTranslate(-model.getPosition().x,-model.getPosition().y-model.getPosition().y/4,model.getPosition().z/2);
    //ofTranslate( receivedPosition.y*y_conversion,receivedPosition.x*x_conversion, 0);
	

	model.drawFaces();
		
		
		model.setScale(scaling_factor,scaling_factor,scaling_factor);

    ofPopMatrix();
	cam.end();
	



	
}
Пример #3
0
//--------------------------------------------------------------
void ofApp::draw(){
    ofClear(0);
    
    //gr.getRegisteredTexture(process_occlusion).draw(0, 0, 1024, 848);
    
    
    //return;
    
    if (depthTex0.isAllocated()) {
        ofPushStyle();
        glPointSize(2);
        ecam.begin();
        ofDrawAxis(100);
        ofPushMatrix();
        ofTranslate(0, 0, -100);
        
        shader.begin();
        //shader.setUniform2f("resolution", gr.getRegisteredTexture(process_occlusion).getWidth(), gr.getRegisteredTexture(process_occlusion).getHeight());
        //shader.setUniformTexture("colorTex", gr.getRegisteredTexture(process_occlusion), 0);
        
        mesh.draw();
        shader.end();
        
        ofPopMatrix();
        ecam.end();
        ofPopStyle();
    }
    
    ofDrawBitmapStringHighlight(ofToString(ofGetFrameRate()), 10, 20);
    ofDrawBitmapStringHighlight("Device Count : " + ofToString(ofxMultiKinectV2::getDeviceCount()), 10, 40);

}
Пример #4
0
//--------------------------------------------------------------
void ofApp::draw(){
    
    camera.begin();
    
#ifdef debug
    ofDrawAxis(100);
#endif
    
    for(int i=0;i<leaves.size();i++)
        leaves[i].draw();
    
    
    // {{ LOGO
    if(cameraPositionNo == 4){
        ofPushMatrix();
        ofTranslate(ofGetWidth()/2.*-1, ofGetHeight()/2.);
        ofRotate(90, 1.0, 0.0, 0.0);
        ofTranslate(svgPos);
        //ofScale(1.0, -1.0);
        for(int i=0;i<origamiLogo.points.size();i++){
            ofSetColor(255, 255, 255);
            leafImages[logoImageNo[i]].draw(origamiLogo.points[i]);
        }
//        debugImage.draw(0, 0);
        ofPopMatrix();
    }
    // }}
    
    camera.end();

#ifdef debug
    gui.draw();
#endif
}
 void World::drawModel(bool showCameraFrustrums, bool rightEye, bool showOrigin, bool showPlaneOutlines) {
     
     for(std::pair<string, shared_ptr<Plane>> p : planes){
         ofPushStyle();
         ofEnableBlendMode(OF_BLENDMODE_ALPHA);
         ofSetColor(127*0.9, 127, 127*0.9, 255);
         p.second->drawPlaneModel(!rightEye, false);
         
         ofDisableDepthTest();
         ofSetColor(255, 255*0.9, 255, 127);
         ofEnableBlendMode(OF_BLENDMODE_ADD);
         p.second->drawPlaneModel(rightEye, showPlaneOutlines);
         ofPopStyle();
     }
     
     if(showCameraFrustrums){
         for(std::pair<string, shared_ptr<Plane>> p : planes){
             p.second->drawCamerasModel();
         }
     }
     if(showOrigin){
         ofDisableDepthTest();
         ofDrawAxis(100);
         ofDrawBitmapString("+X", 100, 0, 0);
         ofDrawBitmapString("+Y", 0, 100, 0);
         ofDrawBitmapString("+Z", 0, 0, 100);
     }
     //ofDrawSphere(audienceFrontLeft, 10);
     //ofDrawSphere(audienceBackRight, 10);
     //audiencePlane.draw();
 }
	void draw()
	{
		ofDrawAxis(scale);
		
		glLineWidth(8);
		
		if (current_axis == AXIS_X)
		{
			glBegin(GL_LINES);
			glVertex3f(0, 0, 0);
			glVertex3f(scale, 0, 0);
			glEnd();
		}
		else if (current_axis == AXIS_Y)
		{
			glBegin(GL_LINES);
			glVertex3f(0, 0, 0);
			glVertex3f(0, scale, 0);
			glEnd();
		}
		else if (current_axis == AXIS_Z)
		{
			glBegin(GL_LINES);
			glVertex3f(0, 0, 0);
			glVertex3f(0, 0, scale);
			glEnd();
		}
	}
Пример #7
0
//--------------------------------------------------------------
void testApp::draw() {
	
	simpleCam.begin(); // ofRectangle(ofGetWidth(), ofGetHeight(), 10000, -10000)
	
	if(bdrawdebug){
        ofDrawAxis(100);
    }
	
	ofPushView();
	
	ofTranslate(-(colsmesh*distsmesh)*0.5, -(rowsmesh*distsmesh)*0.5, 0);
	
	blackmesh.draw();
	myhand.draw(true);
	
	ofPopView();
	
	simpleCam.end();
	
	// finally, a report:
	//ofSetHexColor(0xff0000);
	ofSetColor(255,0,0);
	char reportStr[1024];
	sprintf(reportStr, "deformable mesh\nKEY 'o' to select ID particles --\nKEY 'p' to select ID particles ++\nKEY 'm' for move particles\nKEY 'f' for apply vector forces to strings\nfps: %f", ofGetFrameRate());
	
	if(bdrawdebug){
        ofDrawBitmapString(reportStr, 20, 600);
    }

}
Пример #8
0
//--------------------------------------------------------------
void ofApp::draw(){
	ofColor cyan = ofColor::fromHex(0x00abec);
	ofColor magenta = ofColor::fromHex(0xec008c);
	ofColor yellow = ofColor::fromHex(0xffee00);

	ofBackgroundGradient(magenta * .6, magenta * .4);
	ofNoFill();

	easyCam.begin();
	ofRotateXDeg(15);

	ofSetColor(0);
	ofDrawGrid(500, 10, false, false, true, false);

	// draw the path of the box
	ofSetLineWidth(2);
	ofSetColor(cyan);
	pathLines.draw();

	// draw a line connecting the box to the grid
	ofSetColor(yellow);
	ofDrawLine(current.x, current.y, current.z, current.x, 0, current.z);

	ofTranslate(current.x, current.y, current.z);
    if( (current - previous ).length() > 0.0 ){
        // translate and rotate every 3D object after this line to the current position and orientation of our line, but only if the line is longer than 0 or has a length
        rotateToNormal(current - previous);
    }
	ofSetColor(255);
	ofDrawBox(32);
	ofDrawAxis(32);

	easyCam.end();
}
Пример #9
0
//--------------------------------------------------------------
void ofApp::draw(){
    float gridsize = 500;
    
    cam.begin();
    
    ofDrawGrid(gridsize/2.0, 8.0f, false, false, false, true);
    
    ofPushMatrix();
   
    ofMultMatrix(tabmtx);
    
    ofDrawAxis(30);
    
    ofEnableLighting();
    light.enable();
    
    ofPushMatrix();
    ofRotateX(90);
    ofDrawCylinder(0,52,0,3,100);
    ofPopMatrix();
    
    // you can also get global tablet data at any time
    TabletData& data = ofxTablet::tabletData;
    float p= data.pressure*25;
    if (p<10) p = 10;
    
    ofDrawArrow(ofVec3f(0,0,100), ofVec3f(0,0,0), p);

    ofDisableLighting();

    ofPopMatrix();
    
    cam.end();
    
}
Пример #10
0
//--------------------------------------------------------------
void testApp::draw(){
	lightsOn ? glEnable(GL_LIGHTING) : glDisable(GL_LIGHTING);
	ofBackground(50, 50, 50, 0);
    
    glPushMatrix();

	glScalef(30,30,30);
	glTranslatef(17,20,0);
	glRotatef(180,0,0,1);
	glRotatef(ofGetWidth()*.5 - mouseX,0,1,0);		

	ofSetColor(255,255,255);
	model.drawFaces();

	glPointSize(20);
	glDisable(GL_LIGHTING);
	ofFill();
	
	for (int i =0; i < model.meshNodes.size();i++){
		model.meshNodes.at(i).transformGL();
		ofDrawAxis(0.1);
		model.meshNodes.at(i).restoreTransformGL();
	}

    glPopMatrix();
    
	ofSetColor(255, 255, 255, 255);
    ofDrawBitmapString("fps: "+ofToString(ofGetFrameRate(), 2), 10, 15,0);
}
Пример #11
0
void Path3D::draw(){

    // show the current orientation plane
    ofSetColor(ofColor::lightYellow);
    ofSetLineWidth(3);
    ofPushMatrix();
    ofMultMatrix(orientation);
    profile.draw();
    ofDrawAxis(.010);
    ofPopMatrix();
    
    // show all the frames
    ofSetColor(ofColor::aqua,80);
    for (auto frame : ptf.getFrames()){
        ofPushMatrix();
        ofMultMatrix(frame);
        profile.draw();
//        ofDrawAxis(.010);
        ofPopMatrix();
    }
    
    // show the target point
    ofSetColor(ofColor::yellow);
    if (path.size() > 0){
//        ofDrawSphere(path.getVertices()[ptIndex], .003);
        ofDrawSphere(getPoseAt(ptIndex).getTranslation(), .003);
    }
    
    // show the 3D path
    ofSetLineWidth(3);
    ofSetColor(ofColor::aqua);
    //path.draw();
    
}
Пример #12
0
//--------------------------------------------------------------
void testApp::draw(){
	ofBackground(0);
	ofNoFill();
	
	easyCam.begin();

	ofDrawAxis(32);
	pathLines.draw(); // draw the path of the box
	
	// translate and rotate to the current position and orientation
	ofTranslate(current.x, current.y, current.z);
	rotateToNormal(current - previous);
	ofBox(32);
	ofDrawAxis(32);
	
	easyCam.end();
}
Пример #13
0
 void draw()
 {
     ofClear(0);
     cam.begin();
     neuron.debugDraw();
     ofDrawAxis(100);
     cam.end();
 }
Пример #14
0
void drawBoundingBox()
{
    ofFill();
    ofSetColor(127);
    ofDrawAxis(100);
    ofNoFill();
    ofDrawBox(0, 0, 0, boxSize.x, boxSize.y, boxSize.z);
}
Пример #15
0
void ofApp::drawMocap(){
    
    ofPushMatrix();
    ofScale(1000);
    
    // show path
    ofPolyline tp;
    for (auto &path: recordedPath){
        ofSetColor(ofColor::azure);
        tp.addVertex(path.getMatrix().getTranslation());
    }
    tp.draw();

    // show rigid body
    ofPolyline bodies;
    float alpha = 255;
    float step = 255 / (recordedPath.size()+1);
    for (auto &rb: recordedPath){
        ofSetColor(ofColor::navajoWhite, alpha);
        for (int i = 0; i < rb.markers.size(); i++)
            bodies.addVertex(rb.markers[i]);
        alpha -= step;
    }
    bodies.draw();
    
    
    
    // draw rigidbodies

    const ofxNatNet::RigidBody &RB = currentRB;
    
    if (RB.isActive())
        ofSetColor(0, 255, 0);
    else
        ofSetColor(255, 0, 0);
    
    //        cout << "rigidBody: " << RB.id << ", pos: " << RB.matrix.getTranslation().operator*=(10) << ", orientation: "<< RB.getMatrix().getRotate() << endl;
    
    ofPushMatrix();
    glMultMatrixf(RB.getMatrix().getPtr());
    ofDrawAxis(.030);
    ofPopMatrix();
    
    glBegin(GL_LINE_LOOP);
    for (int n = 0; n < RB.markers.size(); n++) {
        glVertex3fv(RB.markers[n].getPtr());
    }
    glEnd();
    
    for (int n = 0; n < RB.markers.size(); n++) {
        ofDrawBox(RB.markers[n], .005);
    }
    

    ofPopMatrix();
}
void CameraNode::customDraw() {
	ofPushMatrix();
	ofScale(0.07f, 0.04f, 0.02f);
	ofBox(1.0f);
	ofPopMatrix();
	
	ofDrawAxis(0.1f);
	
	ofLine(ofPoint(), getLookAtDir());
}
Пример #17
0
//--------------------------------------------------------------
void ofApp::draw(){
    
    
    ofNoFill();
    ofSetColor(255,255,255,102);
        
    ofPushMatrix();
    ofTranslate( ofGetWidth() * 0.5, ofGetHeight() * 0.5 );
    
    ofRotateX(count * 0.1 );
    ofRotateY(count * 0.1 );
    
    mesh.draw();
    
    ofSetColor(255,0,0,255);
    ofSpherePrimitive sphere;
    sphere.set(200,8);
    sphere.drawWireframe();
    
    ofSetColor(0,255,0,255);
    ofBoxPrimitive box;
    box.set( 200, 200, 200, 2, 2, 2 );
    box.drawWireframe();
    
    ofSetColor(0,0,255,255);
    ofCylinderPrimitive cylinder;
    cylinder.set( 100, 250, 8, 2 );
    cylinder.drawWireframe();
    
    ofSetColor(255,0,255,255);
    ofConePrimitive cone;
    cone.set( 100,300, 5, 3 );
    cone.drawWireframe();
    
    ofSetColor(0,255,255,128);
    ofIcoSpherePrimitive icoSphere;
    icoSphere.set( 250, 1 );
    icoSphere.drawWireframe();
    
    
    ofSetColor(255,255,255,128);
    ofDrawGridPlane(3000);
    
    ofSetColor(255,0,0,128);
    ofDrawAxis(1000);
    ofDrawArrow(ofVec3f(0,0,0),ofVec3f(1000,0,0));
    
    ofPopMatrix();
    
    
    ofSetColor( 255 );
    ofDrawBitmapString("sketch_20150924", 15, 15);
    
}
Пример #18
0
//--------------------------------------------------------------
void testApp::draw(){
    
    camera.begin();
    ofDrawAxis( 1000 );

    earth.setPosition( 0, 0, 0 );
    earth.draw();

    satellite.draw();
    camera.end();
    
}
Пример #19
0
//--------------------------------------------------------------
void ofApp::draw()
{
    ofSetColor(ofColor::white);

    cam.begin();
    {
        mesh.draw(OF_MESH_POINTS);

        ofDrawAxis(20);
    }
    cam.end();
}
Пример #20
0
void kinectCloud::customDraw()
{
    ofDrawAxis(200);
    ofCircle(0,0,50);

    if (useclips)
        drawClips();

    if (selected)
        glPointSize(2.0);
    mesh.drawVertices();
    glPointSize(1.0);
}
Пример #21
0
//--------------------------------------------------------------
void testApp::draw(){

    

    ofEnableDepthTest();
    ofTranslate(ofGetWidth()/2, ofGetHeight()/2,0);
    
    ofDrawAxis(100);
    node.draw();
    //cam.end();
    node2.draw();

}
Пример #22
0
void testApp::draw3DCam(ofNode& n) {
	if (NUM_CAMERAS != 2)
		return;
	
	int i;
	if (&n == (ofNode*)&camera[0].calib)
		i = 0;
	else
		i = 1;
	
	ofDrawAxis(10);
	
	ofPushMatrix();
	ofRotate(90,1,0,0);
	ofDrawGrid(100);
	ofPopMatrix();
	
	ofPushMatrix();
	glMultMatrixf(matPosRotFromXtoOther[i].getPtr());
	ofDrawAxis(10);
	ofPopMatrix();
}
Пример #23
0
void videoProcessor::drawMarker(float size, const ofColor & color){
    ofDrawAxis(size);
    ofPushMatrix();
    // move up from the center by size*.5
    // to draw a box centered at that point
    ofTranslate(0,size*0.5,0);
    ofFill();
    ofSetColor(color,50);
    ofBox(size);
    ofNoFill();
    ofSetColor(color);
    ofBox(size);
    ofPopMatrix();
}
 void ParallelTransportFrames::debugDraw(float axisSize)
 {
     ofSetColor(0, 255, 255);
     ofNoFill();
     for (int i = 0; i < frames.size(); ++i)
     {
         glPushMatrix();
         glMultMatrixf(frames[i].getPtr());
         glRotatef(90, 0, 1, 0);
         ofCircle(0, 0, axisSize * 2.f);
         ofDrawAxis(axisSize);
         glPopMatrix();
     }
 }
void SensorViewer::selfDraw(){
    materials["MATERIAL 1"]->begin();
    
    ofPushMatrix();
    ofRotate(90, 1, 0, 0);
    grid.draw();
    ofPopMatrix();
    
    ofPushMatrix();
    ofScale(1, -1, 1);
    for (std::map<string,Sensor>::iterator it=sensors.begin(); it!=sensors.end(); ++it){
        ofPushMatrix();
        ofTranslate(0,0,it->second.altitud);
        float angle;
        ofVec3f axis;//(0,0,1.0f);
        it->second.attitude.getRotate(angle, axis);
        ofRotate(angle, axis.x, axis.y, axis.z); // rotate with quaternion
        
        ofNoFill();
        ofSetColor(255,200);
        ofDrawAxis(100*sensorScale);
        
        ofSetColor(0, 0, 255,100);
        ofCircle(0, 0, 125*sensorScale);
        
        ofPushMatrix();
        ofRotate(90, 1, 0, 0);
        ofSetColor(0, 255, 0,100);
        ofCircle(0, 0, 125*sensorScale);
        ofPopMatrix();
        
        ofPushMatrix();
        ofRotate(90, 0, 1, 0);
        ofSetColor(255, 0, 0,100);
        ofCircle(0, 0, 125*sensorScale);
        ofPopMatrix();
        
        if(it->second.bRecording){
            ofFill();
            ofSetColor(255,0,0,abs(sin(ofGetElapsedTimef()))*255);
            ofDrawSphere(0, 0, 50*sensorScale);
        }
        
        ofPopMatrix();
    }
    ofPopMatrix();

    materials["MATERIAL 1"]->end();
}
//----------------------------------------
void ofLight::customDraw() {
    ofPushMatrix();
    glMultMatrixf(getGlobalTransformMatrix().getPtr());
    if(getIsPointLight()) {
        ofSphere( 0,0,0, 10);
    } else if (getIsSpotlight()) {
        float coneHeight = (sin(spotCutOff*DEG_TO_RAD) * 30.f) + 1;
        float coneRadius = (cos(spotCutOff*DEG_TO_RAD) * 30.f) + 8;
        ofCone(0, 0, -(coneHeight*.5), coneHeight, coneRadius);
    } else {
        ofBox(10);
    }
    ofDrawAxis(20);
    ofPopMatrix();
}
Пример #27
0
//------------------------------------------------
void TravelingCam::customDraw() {

    ofPushStyle();
    ofSetColor(ofColor::gray);
    ofDrawBox(10);
    ofDrawAxis(20);

    ofVec3f l = getLookAtDir();
    l.normalize();
    l*=200;
    ofSetColor(ofColor::magenta);
    ofSetLineWidth(3);
    ofDrawArrow(ofVec3f(0), ofVec3f(0, 0, -200));
    ofPopStyle();
}
Пример #28
0
	void GamingScene6::Draw()
	{

		//ofSetColor(255, 255, 255);		
		main_camera_.begin();
		ofPushMatrix();
		//draw static scene
		this->GetParent()->Draw();
		ofPopMatrix();

		ofDrawAxis(100);       
		main_camera_.end();

// 		ofPushMatrix();
// 		ofTranslate(hand_pos_.x, hand_pos_.y, hand_pos_.z);
// 		if (hand_radius_ == max_hand_radius_)
// 		{
// 			ofSetColor(255,0,0,255);
// 		}
// 		ofSphere(0, 0, 0, hand_radius_);
// 		ofPopMatrix();
// 
// 
// 		ofPushMatrix();
// 		ofTranslate(butterfly_pos_.x, butterfly_pos_.y, butterfly_pos_.z);
// 		ofSetColor(255, 255, 255);		
// 		ofSphere(0, 0, 0, butterfly_radius_);
// 		ofPopMatrix();

		if(Jungle::KINECT_ENABLE)
		{
			glPushMatrix();
			ofTranslate(0, h_ - 0.3*h_);
			ofScale(0.4, 0.4);
			JungleApp::KinectInstance().debugDraw();
			glPopMatrix();
		}  
        
        
        
//         ofSetColor(255,255,255,255);
//         ofDrawBitmapString("moving_time_ "+ ofToString(moving_time_), 20, 20);
//         ofDrawBitmapString("v length "+ ofToString(vlength), 20, 40);
// 		//ofDrawBitmapString("f "+ ofToString(butterfly_force_.x) + " "+ ofToString(butterfly_force_.y), 20, 80);
//         ofDrawBitmapString("vel "+ ofToString(butterfly_vel_.x) + " "+ ofToString(butterfly_vel_.y), 20, 80);
        //ofDrawBitmapString("particle num "+ ofToString(NUM_PARTICLE), 20, 80);
               
	}
Пример #29
0
//--------------------------------------------------------------
void ofApp::draw(){
    
    ofBackground(0, 0, 0);
    //legacy openGL
    ofSetColor(255,255,255);
    glPointSize(5);
    
    cam.begin();
    int numPoints = inputMD.getNumRows();
    std::vector<GRT::UINT> clv = kmeans.getClassLabelsVector();

    if(centerFlag){
        for (int i = 0; i < CLUSTER; i++) {
            ofSetColor(colors[i]);
            sp[i].draw();
        }
    }
    
    ofSetColor(255, 255, 255);

    for(int i = 0; i< numPoints; i++){
        GRT::VectorDouble vd = inputMD.getRowVector(i);
        GRT::UINT cl = clv[i];
        if(coloredPointFlag){
            ofSetColor(colors[cl]);
        }
        glBegin(GL_POINTS);
        glVertex3f(vd[0], vd[1], vd[2]);
        glEnd();

        if(linesFlag){
            ofSetColor(colors[cl]);
            ofVec3f pos = sp[cl].getPosition();
            glBegin(GL_LINES);
            glVertex3f(vd[0], vd[1], vd[2]);
            glVertex3f(pos.x, pos.y, pos.z);
            glEnd();
        }
    }
 
    ofDrawAxis(10);
    
    cam.end();
    ofSetColor(255,0,0);
    int x = 0;
}
Пример #30
0
//--------------------------------------------------------------
void testApp::draw(){

	cam.begin();
	
	ofDrawAxis(200);	
	ofSetColor(255, 255, 0);
	ofBox(20);
//	target.draw();
//	cam.getTarget().draw();
	
	
	cam.end();
	
	ofDisableLighting();
	ofSetColor(255, 255, 255);
	ofDrawBitmapString("This text is not affected by camera because it is after cam.end()", 10, 30);
}