Esempio n. 1
0
void _Line::draw(ofColor _color)
{
	ofPushMatrix();
	ofTranslate(this->x, this->y, this->z);
	ofRotateX(this->xRotation);
	ofRotateY(this->yRotation);
	ofRotateZ(this->zRotation);
	
	int oldWidth = 1;
	ofSetLineWidth(this->lineWidth);
	ofSetColor(_color);

	int x = this->point2.x - this->point1.x;
	int y = this->point2.y - this->point1.y;
	int z = this->point2.z - this->point1.z;
	ofDrawLine(ofPoint(0,0,0), ofPoint(x,y,z));
	
	if (this->selected)
		ofSetColor(ofColor::red);
	else
		ofSetColor(ofColor::blue);
	ofDrawSphere(0, 0, 0, 3);
	ofDrawSphere(x, y, z, 3);

	ofSetLineWidth(oldWidth);
	ofPopMatrix();
}
//--------------------------------------------------------------
void LeapVisualizer::drawBone (const Finger & finger, Bone & bone,ofxLeapMotion & leap){
	
	Finger::Type fingerType = finger.type();
	Bone::Type   boneType   = bone.type();
	
	// The Leap returns data in millimeters.
	ofPoint bonePt0 = leap.getofPoint ( bone.prevJoint());
	ofPoint bonePt1 = leap.getofPoint ( bone.nextJoint());
	float boneThickness = bone.width();
	
	// ofPoint bonePtC = leap.getofPoint ( bone.center()); // works, but:
	ofPoint bonePtC = (bonePt0 + bonePt1)/2.0;
	
	if (bDrawSimple){
		// Draw a simple white skeleton.
		ofSetColor(ofColor::white);
		ofLine(bonePt0, bonePt1);
		ofDrawSphere(bonePt0, boneThickness * 0.15);
		ofDrawSphere(bonePt1, boneThickness * 0.15);
		ofDrawSphere(bonePtC, boneThickness * 0.05);
		
	} else {
		// Draw a colored cylinder with double-sphere caps.
		setColorByFinger (fingerType, boneType);
		drawOrientedCylinder (bonePt0, bonePt1, boneThickness/2.0);
		ofDrawSphere(bonePt0, boneThickness/2.0);
		ofDrawSphere(bonePt1, boneThickness/2.0);
	}
}
Esempio n. 3
0
void ofApp::draw(){
    //背景
    ofBackgroundGradient(ofColor(90, 90, 90), ofColor(30, 30, 30),  OF_GRADIENT_BAR);
    
    //ログ表示
    ofSetColor(200);
    ofDrawBitmapString("ofxLeapMotion - Example App\nLeap Connected? " + ofToString(leap.isConnected()), 20, 20);
    
    ofEnableDepthTest();
    cam.begin();
    
    //地面のグリッドを描画
    ofPushMatrix();
    ofRotate(90, 0, 0, 1);
    ofSetColor(20);
    ofDrawGridPlane(800, 20, false);
    ofPopMatrix();
    
    //検出した手を描画
    fingerType fingerTypes[] = {THUMB, INDEX, MIDDLE, RING, PINKY};
    
    for(int i = 0; i < simpleHands.size(); i++){
        bool isLeft = simpleHands[i].isLeft;
        ofPoint handPos = simpleHands[i].handPos;
        ofPoint handNormal = simpleHands[i].handNormal;
        
        //手の中心位置を描画
        ofSetColor(0, 0, 255);
        ofDrawSphere(handPos.x, handPos.y, handPos.z, 20);
        
        //手の平の向きを描画
        ofSetColor(255, 255, 0);
        ofDrawArrow(handPos, handPos + 100*handNormal);
        
        //5本の指をそれぞれ描画
        for (int f=0; f<5; f++) {
            ofPoint mcp = simpleHands[i].fingers[ fingerTypes[f] ].mcp;  // 関節1
            ofPoint pip = simpleHands[i].fingers[ fingerTypes[f] ].pip;  // 関節2
            ofPoint dip = simpleHands[i].fingers[ fingerTypes[f] ].dip;  // 関節3
            ofPoint tip = simpleHands[i].fingers[ fingerTypes[f] ].tip;  // 指先
            
            //関節と指先を描画
            ofSetColor(0, 255, 0);
            ofDrawSphere(mcp.x, mcp.y, mcp.z, 12);
            ofDrawSphere(pip.x, pip.y, pip.z, 12);
            ofDrawSphere(dip.x, dip.y, dip.z, 12);
            ofDrawSphere(tip.x, tip.y, tip.z, 12);
            
            //線で結ぶ
            ofSetColor(255, 0, 0);
            ofSetLineWidth(20);
            ofDrawLine(mcp.x, mcp.y, mcp.z, pip.x, pip.y, pip.z);
            ofDrawLine(pip.x, pip.y, pip.z, dip.x, dip.y, dip.z);
            ofDrawLine(dip.x, dip.y, dip.z, tip.x, tip.y, tip.z);
        }
    }
    
    cam.end();
    ofDisableDepthTest();
}
//--------------------------------------------------------------
void LeapVisualizer::drawPalmFromXML(ofxXmlSettings & XML){
	
	int nFingerTags = XML.getNumTags("F");
	if (nFingerTags > 0){
		
		ofMesh palmMesh;
		int nVertices = 0;
		float averageFingerWidth = 0;
		
		for (int f=0; f<nFingerTags; f++){
			XML.pushTag("F", f);
			float fingerWidth = XML.getValue("WIDTH", 0.0);
			averageFingerWidth += fingerWidth;
			
			if (XML.getNumTags("B") > 0){
				XML.pushTag("B", 0);
				palmMesh.addVertex( ofPoint(XML.getValue("Q:X",0.0), XML.getValue("Q:Y",0.0), XML.getValue("Q:Z",0.0)) );
				palmMesh.addVertex( ofPoint(XML.getValue("P:X",0.0), XML.getValue("P:Y",0.0), XML.getValue("P:Z",0.0)) );
				nVertices += 2;
				XML.popTag();
			}
			XML.popTag();
		}
		
		if (nVertices > 3){
			if (bDrawSimple){
				ofSetColor(ofColor::brown);
			} else {
				ofSetColor(ofColor::gray);
			}
			
			// Draw the palm as a mesh of triangles.
			int nPalmMeshVertices = palmMesh.getNumVertices();
			for (int i=0; i<(nPalmMeshVertices-2); i++){
				palmMesh.addTriangle(i, i+1, i+2); }
			palmMesh.drawFaces();
			
			if (!bDrawSimple){
				averageFingerWidth /= nFingerTags;
				if (nPalmMeshVertices == 10){
					float rad = averageFingerWidth / 2.0;
					for (int i=0; i<4; i++){
						ofVec3f p0 = palmMesh.getVertex( i   *2);
						ofVec3f p1 = palmMesh.getVertex((i+1)*2);
						drawOrientedCylinder (p0, p1, 10);
						ofDrawSphere(p0, rad);
						ofDrawSphere(p1, rad);
					}
					for (int i=0; i<4; i++){
						ofVec3f p0 = palmMesh.getVertex( i   *2 + 1);
						ofVec3f p1 = palmMesh.getVertex((i+1)*2 + 1);
						drawOrientedCylinder (p0, p1, 10);
						ofDrawSphere(p0, rad);
						ofDrawSphere(p1, rad);
					}
				}
			}
		}
	}
}
Esempio n. 5
0
//--------------------------------------------------------------
void ofApp::draw(){
    ofBackground(0);
    came.begin();
    
    for (int i = 0; i <simpleHands.size(); i++) {
        for (int f = 0; f<5 ;f++) {
            ofSetColor(255);
            ofDrawSphere(fingerPos.at(20*i+4*f+0), 10);
            
            ofSetColor(200);
            ofDrawSphere(fingerPos.at(20*i+4*f+1),10);
            
            ofSetColor(155);
            ofDrawSphere(fingerPos.at(20*i+4*f+2), 10);
            
            ofSetColor(100);
            ofDrawSphere(fingerPos.at(20*1+4*f+3), 10);
            
            ofLine(fingerPos.at(20*i+4*f+0),fingerPos.at(20*i+4*f+1));
            ofLine(fingerPos.at(20*i+4*f+1),fingerPos.at(20*i+4*f+2));
            ofLine(fingerPos.at(20*i+4*f+1),fingerPos.at(20*i+4*f+3));
        }
        

        }
    
    came.end();
}
//--------------------------------------------------------------
void testApp::draw() {
    
    ofSetColor(pointLight.getDiffuseColor());
    ofDrawSphere(pointLight.getPosition(), 20.f);
    
    // enable lighting //
    ofEnableLighting();
    // the position of the light must be updated every frame, 
    // call enable() so that it can update itself //
    pointLight.enable();
    material.begin();
    
    if(bDrawWireframe) ofNoFill();
    else ofFill();
    
    ofPushMatrix();
    ofTranslate(center.x, center.y, 0);
    ofRotate(rotation, 0, 0, 1);
	for(int i = 0; i < numSpheres; i++) {
        float angle = TWO_PI / (float)numSpheres * i;
        float x = cos(angle) * radius;
        float y = sin(angle) * radius;
        ofDrawSphere(x, y, -200, sphereRadius);
    }
    ofPopMatrix();
	material.end();
	// turn off lighting //
    ofDisableLighting();
    
    ofSetColor(255, 255, 255);
    ofDrawBitmapString("Draw Wireframe (w) : "+ofToString(bDrawWireframe, 0), 20, 20);
    
}
Esempio n. 7
0
void ofApp::draw()
{
    ofBackground(0);

    cam.begin();

    ofPushMatrix();
    ofTranslate(- ofGetWidth() / 2, - ofGetHeight() / 2, 0);

    ofNoFill();
    ofSetColor(255);

    // Draw all of the points.
    mesh.draw();

    ofFill();
    ofSetColor(255, 255, 0, 80);

    for (std::size_t i = 0; i < searchResults.size(); ++i)
    {
        float normalizedDistance = ofMap(searchResults[i].second, radius * radius, 0, 0, 1, true);

        ofSetColor(255, 255, 0, normalizedDistance * 127);

        ofDrawSphere(points[searchResults[i].first], 5);

        if (MODE_NEAREST_N == mode)
        {
            ofSetColor(255, 127);
            ofDrawBitmapString(ofToString(i), points[searchResults[i].first]);
        }
    }

    if (MODE_RADIUS == mode)
    {
        ofNoFill();
        ofSetColor(255, 0, 0, 50);
        ofDrawSphere(firefly, radius);
    }

    ofPopMatrix();

    cam.end();

    std::stringstream ss;


    if (MODE_RADIUS == mode)
    {
        ss << "SEARCH MODE (space): RADIUS" << std::endl;
        ss << "       RADIUS (-/=): " << radius;
    }
    else
    {
        ss << "SEARCH MODE (space): NEAREST N" << std::endl;
        ss << "    NEAREST N (-/=): " << nearestN;
    }

    ofDrawBitmapStringHighlight(ss.str(), ofVec2f(30, 30));
}
Esempio n. 8
0
//--------------------------------------------------------------
void ofApp::draw(){
    ofBackgroundGradient(ofColor(90, 90, 90), ofColor(30, 30, 30),  OF_GRADIENT_BAR);
	ofSetColor(200);
	ofDrawBitmapString("ofxLeapMotion - Example App\nLeap Connected? " + ofToString(leap.isConnected()), 20, 20);
        // cam.setTarget(cam_position.x,cam_position.y,cam_position.z);
	cam.begin();
    cam.setTarget(ofVec3f(cam_position.x,cam_position.y,cam_position.z));
	ofPushMatrix();
    ofRotate(90, 0, 0, 1);
    ofSetColor(20);
    ofDrawGridPlane(800, 20, false);
	ofPopMatrix();
    ofSetColor(255,0,0);
    //
    // Threaded Gromacs Calls
    threadedObject.draw();    
    //
    // Leap Motion
    //
    fingerType fingerTypes[] = {THUMB, INDEX, MIDDLE, RING, PINKY};
    for(int i = 0; i < simpleHands.size(); i++){
        bool isLeft        = simpleHands[i].isLeft;
        ofPoint handPos    = simpleHands[i].handPos;
        ofPoint handNormal = simpleHands[i].handNormal;
        
        ofSetColor(0, 0, 255);
        ofDrawSphere(handPos.x, handPos.y, handPos.z, 20);
        ofSetColor(255, 255, 0);
        ofDrawArrow(handPos, handPos + 100*handNormal);
        
        for (int f=0; f<5; f++) {
            ofPoint mcp = simpleHands[i].fingers[ fingerTypes[f] ].mcp;  // metacarpal
            ofPoint pip = simpleHands[i].fingers[ fingerTypes[f] ].pip;  // proximal
            ofPoint dip = simpleHands[i].fingers[ fingerTypes[f] ].dip;  // distal
            ofPoint tip = simpleHands[i].fingers[ fingerTypes[f] ].tip;  // fingertip
            
            ofSetColor(0, 255, 0);
            ofDrawSphere(mcp.x, mcp.y, mcp.z, 12);
            ofDrawSphere(pip.x, pip.y, pip.z, 12);
            ofDrawSphere(dip.x, dip.y, dip.z, 12);
            ofDrawSphere(tip.x, tip.y, tip.z, 12);
            
            ofSetColor(255, 0, 0);
            ofSetLineWidth(20);
            ofLine(mcp.x, mcp.y, mcp.z, pip.x, pip.y, pip.z);
            ofLine(pip.x, pip.y, pip.z, dip.x, dip.y, dip.z);
            ofLine(dip.x, dip.y, dip.z, tip.x, tip.y, tip.z);
        }
    }
    
    
    
	cam.end();
}
Esempio n. 9
0
//--------------------------------------------------------------
// draws the length of the joint and locations of pivots, but if bodies are sprung more than the length,
// will not connect all the way //
void ofxBulletJoint::drawJointConstraints() {
	ofVec3f pa = getPivotAWorldPos();
	ofVec3f pb = getPivotBWorldPos();
	
	ofLine( pa, pb );
	
	ofSetColor(255, 0, 0);
	ofDrawSphere(pa, .5);
	ofSetColor(0, 0, 255);
	ofDrawSphere(pb, .5);
}
Esempio n. 10
0
// ofxLeapMotionSimpleHand
//--------------------------------------------------------------
void ofxLeapMotionSimpleHand::debugDraw(){
	ofPushStyle();
	
		ofSetColor(190);
		ofSetLineWidth(2);

		ofEnableLighting();
		ofPushMatrix();
			ofTranslate(handPos);
			//rotate the hand by the downwards normal
			ofQuaternion q;
			q.makeRotate(ofPoint(0, -1, 0), handNormal);
			ofMatrix4x4 m;
			q.get(m);
			glMultMatrixf(m.getPtr());
			
			
			//scale it to make it not a box
			ofScale(1, 0.35, 1.0);
#if (OF_VERSION_MAJOR == 0) && (OF_VERSION_MINOR < 8)
			ofBox(0, 0, 0, 60);
#else
			ofDrawBox(0, 0, 0, 60);
#endif
		ofPopMatrix();
	
		// sphere - hand openness debug draw
		ofSetColor(200, 0, 0, 80);
		ofDrawSphere(sphereCenter, sphereRadius);
	
		for(int i = 0; i < fingers.size(); i++){
			//ofDrawArrow(handPos, fingers[i].pos, 10);
		
			// fingers base debug draw
			ofSetColor(190);
			ofLine(handPos, fingers[i].base);
			ofDrawBox(fingers[i].base, 20);
			ofLine(fingers[i].base, fingers[i].pos);
			
			ofSetColor(0, 200, 0);
			ofDrawSphere(fingers[i].pos, 20);

		}
		
		ofSetColor(220, 220, 0);
		for(int i = 0; i < fingers.size(); i++){
			ofDrawArrow(fingers[i].pos + fingers[i].vel/20, fingers[i].pos + fingers[i].vel/10, 10);
		}
	
		ofDisableLighting();
	
	ofPopStyle();
}
void GestureCursor::draw3D( ) 
{
	switch ( status ) 
	{
		case LOST :
			ofSetColor( 128 , 128 , 128 , 128 ) ; 
		break; 

		case OPEN :
			ofSetColor( 0 , 255 , 0 , 128 ) ; 
		break; 

		case CLOSED :
			ofSetColor( 255 , 0 , 0 , 128 ) ; 
		break; 

		case LASSO :
			ofSetColor( 0 ,  0 , 255 , 128 ) ; 
		break;

	}

	ofPushMatrix( ) ; 
		ofTranslate( worldPosition ) ;
		ofDrawSphere( 20 ) ; 
	ofPopMatrix( ) ;
}
Esempio n. 12
0
//--------------------------------------------------------------
void ofApp::draw()
{

	ssao.begin( camera.getNearClip(), camera.getFarClip() );
	camera.begin();
	
	glEnable(GL_DEPTH_TEST);
	glBlendFunc(GL_ONE, GL_ZERO);
	
	float elapsedTime = ofGetElapsedTimef();
	float step = 1. / float(randomPositions.size());
	for (int i=0; i<randomPositions.size(); i++) {
		ofSetColor(randomColors[i]);
		
//        if(i%2){
			ofDrawSphere(randomPositions[i].x, randomPositions[i].y, randomPositions[i].z, 40 + sin( elapsedTime + float(i) * step)*20 );
//        }
//        else{
//			glPushMatrix();
//			glTranslatef( randomPositions[i].x, randomPositions[i].y, randomPositions[i].z );
//			glRotatef( (elapsedTime*10 +i)*10, sin(i), 0, cos(i) );
//			ofDrawBox(0,0,0, 40 + sin( elapsedTime + float(i) * step)*20 );
//			glPopMatrix();
//        }
	}
	
	camera.end();
	
	ssao.end();
	
	ofSetColor(255);
	ssao.draw();
}
//--------------------------------------------------------------
void LeapVisualizer::drawFinger (const Finger & finger,ofxLeapMotion & leap){
	
	if (finger.isValid()){
		
		// For every bone (i.e. phalange) in the finger,
		for (int b=0; b<4; b++) {
			
			// Get each bone;
			Bone::Type boneType = static_cast<Bone::Type>(b);
			Bone bone = finger.bone(boneType);
			if (bone.isValid()){
				
				// Don't consider zero-length bones, such as the Thumb's metacarpal.
				if (bone.length() > 0){
					drawBone (finger, bone,leap);
					
				} // end if boneLength
			} // end if bone isValid()
		} // end for each bone
		
		if (bDrawSimple){
			// Draw the fingertip, which is an extra point within the last phalange.
			ofSetColor(ofColor::white);
			ofPoint fingerTipPt = leap.getofPoint ( finger.tipPosition() );
			ofDrawSphere(fingerTipPt, finger.width() * 0.05);
		}
	}
}
//--------------------------------------------------------------
void ofApp::draw(){
    ofBackgroundGradient(ofColor(255), ofColor(212));
    ofEnableDepthTest();
    ofEnableLighting();
    cam.begin();
    light1.enable();
    vtfShader.begin();
    vtfShader.setUniform4f("COMMON_Ambient",0.1,0.1,0.1,1.0);
    vtfShader.setUniform4f("COMMON_Diffuse",0.5,0.5,0.5,1.0);
    vtfShader.setUniform4f("COMMON_Specular",0.5,0.5,0.5,1.0);
    vtfShader.setUniform1f("COMMON_Shininess",100.0);
    vtfShader.setUniform1i("ADS_NumLights",ofGetLightingEnabled());
    vtfShader.setUniformTexture("posTex", posTex,0);
    vtfShader.setUniformTexture("sizeTex", sizeTex,1);
    vtfShader.setUniformTexture("rotTex", rotTex,2);
    vtfShader.setUniformTexture("colorTex", colorTex,3);
    vtfShader.setUniform1f("iCount", textureRes);
    object.drawInstanced(OF_MESH_FILL, textureRes*textureRes);
    vtfShader.end();
    if(lookAtSphere)ofDrawSphere(target, 50);
    light1.disable();
    cam.end();
    ofDisableLighting();
    ofDisableDepthTest();
}
Esempio n. 15
0
void Torso::formatConnections()
{
    // set connection points. These are used to position the axes of the child body parts
    for (int i = 0; i < connectingPointsAbsolute.size(); i++)
    {
        // rotate and position the absolute connection ponts
        connectingPointsAbsolute[i] = connectingPoints[i];
        connectingPointsAbsolute[i].rotate(qangle, ofVec3f(qaxis.x, qaxis.y, qaxis.z));
        connectingPointsAbsolute[i] += *originPoint; //skelJointPos;
    }

	if (isDrawDebug)
	{
		ofPushStyle();
		ofSetColor(0, 0, 255, 255);

#ifdef TARGET_OSX
		ofDrawSphere(connectingPointsAbsolute[0], 5);
#else
		ofSphere(connectingPointsAbsolute[0], 5);
#endif

		ofPopStyle();
	}
}
Esempio n. 16
0
//--------------------------------------------------------------
void ofApp::renderScene() {
    ofEnableDepthTest();

    pbr.begin(&cam, &particlesShader);
    pbr.getShader()->setUniformTexture("posTex", *tf.getTexture(0), 11);
    pbr.getShader()->setUniformTexture("velTex", *tf.getTexture(1), 12);
    pbr.getShader()->setUniformTexture("ageTex", *tf.getTexture(2), 13);
    pbr.getShader()->setUniformTexture("lifetimeTex", *tf.getTexture(3), 14);
    pbr.getShader()->setUniform3f("maxSize", boxSize);
    material1.begin(&pbr);
    mesh.drawInstanced(OF_MESH_FILL, numParticles);
    material1.end();
    pbr.end();

    pbr.begin(&cam);
    jointMaterial.begin(&pbr);
    for (int i = 0; i < bvh.getNumJoints(); i++) {
        ofMatrix4x4 m = bvh.getJoint(i)->getMatrix();
        ofPushMatrix();
        float angle;
        ofVec3f axis;
        m.getRotate().getRotate(angle, axis);
        ofTranslate(bvh.getJoint(i)->getPosition() * 10);
        ofRotate(angle, axis.x, axis.y, axis.z);
        ofDrawSphere(0, 0, 0, 10);
        ofPopMatrix();
    }
    jointMaterial.end();
    floorMaterial.begin(&pbr);
    ofDrawBox(0, -25, 0, 5000, 1, 5000);
    floorMaterial.end();
    pbr.end();

    ofDisableDepthTest();
}
Esempio n. 17
0
void Scene::drawLineSkeleton(SkeletonDataObject skeleton)
{
    ofSetColor(255, 255);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_HEAD], skeleton.skeletonPositions[KINECT_SDK_SHOULDER_CENTRE]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_SHOULDER_CENTRE], skeleton.skeletonPositions[KINECT_SDK_SHOULDER_LEFT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_SHOULDER_CENTRE], skeleton.skeletonPositions[KINECT_SDK_SHOULDER_RIGHT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_SHOULDER_LEFT], skeleton.skeletonPositions[KINECT_SDK_ELBOW_LEFT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_SHOULDER_RIGHT], skeleton.skeletonPositions[KINECT_SDK_ELBOW_RIGHT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_ELBOW_LEFT], skeleton.skeletonPositions[KINECT_SDK_WRIST_LEFT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_ELBOW_RIGHT], skeleton.skeletonPositions[KINECT_SDK_WRIST_RIGHT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_WRIST_LEFT], skeleton.skeletonPositions[KINECT_SDK_HAND_LEFT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_WRIST_RIGHT], skeleton.skeletonPositions[KINECT_SDK_HAND_RIGHT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_SHOULDER_CENTRE], skeleton.skeletonPositions[KINECT_SDK_HIP_CENTRE]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_HIP_CENTRE], skeleton.skeletonPositions[KINECT_SDK_HIP_LEFT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_HIP_CENTRE], skeleton.skeletonPositions[KINECT_SDK_HIP_RIGHT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_HIP_LEFT], skeleton.skeletonPositions[KINECT_SDK_KNEE_LEFT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_HIP_RIGHT], skeleton.skeletonPositions[KINECT_SDK_KNEE_RIGHT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_KNEE_LEFT], skeleton.skeletonPositions[KINECT_SDK_ANKLE_LEFT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_KNEE_RIGHT], skeleton.skeletonPositions[KINECT_SDK_ANKLE_RIGHT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_ANKLE_LEFT], skeleton.skeletonPositions[KINECT_SDK_FOOT_LEFT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_ANKLE_RIGHT], skeleton.skeletonPositions[KINECT_SDK_FOOT_RIGHT]);
    
    for (int i = 0; i < skeleton.skeletonPositions.size(); i++)
    {
        ofVec3f skelPoint = skeleton.skeletonPositions[i];
        ofSetColor(255, 0, 0);
#ifdef TARGET_OSX
        ofDrawSphere(skelPoint.x, skelPoint.y, skelPoint.z, 1);
#else
		ofSphere(skelPoint.x, skelPoint.y, skelPoint.z, 1);
#endif
    }
}
Esempio n. 18
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();
    
}
Esempio n. 19
0
void Circle::drawCircle() {
    ofPushStyle();
	ofSetColor(color);
	ofDrawSphere(x, y, z, radius);
	timesDrawn++;
    ofPopStyle();
}
void LeapToCameraCalibrator::drawWorldPoints(){
	ofPushMatrix();
    ofSetColor(ofColor::red);
    for(int i = 0; i < calibVectorWorld.size(); i++){
        ofDrawSphere(calibVectorWorld[i], 5.0f);
    }
	ofPopMatrix();
}
void HueLeapMotionGesture::draw(){
    // 真ん中の点を表示する
    // Sphereを表示する
    if ( tracking ){
        ofSetColor(0,255,0,128);
        ofDrawSphere((const ofPoint)fingerCenterPoint, HUE_LEAP_MOTION_GESTURE_CENTER_SHERER_RAD);
    }
}
Esempio n. 22
0
//--------------------------------------------------------------
void ofxBulletSphere::draw() {
	if(!_bCreated || _rigidBody == NULL) {
		ofLog(OF_LOG_WARNING, "ofxBulletSphere :: draw : must call create() first and add() after");
		return;
	}
	transformGL();
    ofDrawSphere( 0, 0, 0, getRadius() );
    restoreTramsformGL();
}
Esempio n. 23
0
void Dots::draw() {
    ofSetColor(255,255,255);
    ofPushMatrix();
    ofDisableDepthTest();
    ofEnableAlphaBlending();
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    ofTranslate(getPosition().x, getPosition().y);
    
    if (drawLines) {
        // Draw the lines
        for(unsigned int i = 0; i < particles.size(); i++){
            for (unsigned int j = 0; j < particles[i].neighbors.size(); ++j) {
                ofVec3f p1 = particles[i].position;
                ofVec3f p2 = particles[i].neighbors.at(j)->position;
                float distance = p1.distance(p2);
                ofSetColor(255, 255, 255, 200 - fabs(distance) * 2);
                ofLine(p1, p2);

            }
        }
    }
    
    if (drawTriangles) {
        // Draw the triangles
        for(unsigned int i = 0; i < particles.size(); i++){
            for (unsigned int j = 0; j < particles[i].neighbors.size(); ++j) {
                Particle* firstNeighbor = particles[i].neighbors.at(j);
                for (unsigned int k = 0; k < j; ++k) {
                    Particle* secondNeighbor = particles[i].neighbors.at(k);
                    for (unsigned int l = 0; l < secondNeighbor->neighbors.size(); l++) {
                        if (secondNeighbor->neighbors.at(l) == firstNeighbor) {
                            // Match!
                            float d1 = particles[i].position.distance(firstNeighbor->position);
                            float d2 = particles[i].position.distance(secondNeighbor->position);
                            float d3 = firstNeighbor->position.distance(secondNeighbor->position);
                            float largestDistance = max(d1, max(d2,d3));
                            ofSetColor(255, 255, 255, 100 - largestDistance);
                            ofTriangle(particles[i].position, firstNeighbor->position, secondNeighbor->position);
                        }
                    }
                }
            }
        }
    }
    
    if (drawDots) {
        // Draw the spheres
        ofSetColor(255,255,255);
        for(unsigned int i = 0; i < particles.size(); i++){
            Particle p = particles.at(i);
            ofDrawSphere(p.position, 2);
        }
    }

    ofPopMatrix();
}
Esempio n. 24
0
void ExpandingSphereAnimation::draw(const ClockState &state) {
  ofPushStyle();

  ofFloatColor color = _color;
  color.a *= _params.alpha.evaluate(percentage());
  ofSetColor(color);
  ofDrawSphere(_position, _params.radius.evaluate(percentage()));

  ofPopStyle();
}
Esempio n. 25
0
//-------------------------------------------------------------
void ofxCGALSkinSurface::drawPoints() {
    for(int i=0; i<points.size(); i++) {
        float px = points[i].point.x;
        float py = points[i].point.y;
        float pz = points[i].point.z;
        float radius = points[i].radius;
        
        ofDrawSphere(px, py, pz, radius);
    }
}
void ofxSplineEditor::drawMarkPoint(){
    ofSetColor(255, 255, 255, 50);
    for(int x = 0; x < 1000; x += 100){
        for(int y = 0; y < 1000; y +=100){
            for(int z = -500; z < 500; z += 100){
                ofDrawSphere(x, y, z, 3);
            }
        }
    }
}
Esempio n. 27
0
//--------------------------------------------------------------
void PinballChinoManager::draw(){
    
	
	camera.begin();
	glEnable( GL_DEPTH_TEST );
    
   
    chinoLights.setMainLightPosition(myScenario.lightPos);
    
    
	ofEnableLighting();
    chinoLights.enable();
    

    // debug draw
    if(bDrawDebug){
        //myScenario.drawDebug();
        
        world.drawDebug();
        // draw the box that is used to detect if the ball is outside the scenario
        ofNoFill();
        ofDrawBox(0, 0, 0, myScenario.ballLimitsBoxSize);
        ofDrawSphere(myScenario.lightPos, 2);
        ofFill();
         
    }
	
	//Draw Scenario
	myScenario.draw(ScenarioEditor::getInstance()->bEscenarioEditorMode);
	
	//Draw Sceario shadow Map
	//simple_shadow.begin();
    //myScenario.draw(ScenarioEditor::getInstance()->bEscenarioEditorMode);
	//simple_shadow.end();
	
	chinoLights.disable();
	ofDisableLighting();

 
	glDisable(GL_DEPTH_TEST);
	camera.end();

    
    statusDisplay.draw();
    missionDisplay.draw();
    
    ScenarioEditor::getInstance()->draw();
    
    if(bDrawDebug){

        (currentMissions)[idcurrentMission]->debugDraw();
    }
    
    chinoLights.draw();
}
Esempio n. 28
0
//--------------------------------------------------------------
void ofApp::draw(){
    
    cam.begin();
    
    ofPushMatrix();
    ofRotate(90, 0, 0, 1);
    ofSetColor(20);
    ofDrawGridPlane(800, 20, false);
    ofPopMatrix();
    
    fingerType fingerTypes[] = {THUMB, INDEX, MIDDLE, RING, PINKY};
    
    for(int i = 0; i < simpleHands.size(); i++){
        bool isLeft        = simpleHands[i].isLeft;
        ofPoint handPos    = simpleHands[i].handPos;
        ofPoint handNormal = simpleHands[i].handNormal;
        
        ofSetColor(0, 0, 255);
        ofDrawSphere(handPos.x, handPos.y, handPos.z, 20);
        
        height = handPos.y;
        
    }
    cam.end();
    
    if(height < -400){
        height = -400;
    }
    else if(height > 150){
        height = 150;
    }
    
    height = ofMap(height, -400, 150, 1, 7);
    

    ofBackground(ofColor::fromHsb(ofMap(height, 1, 7, 0, 255), 255, 255, 100));
    
    ofSetColor(255, 255, 255, 100);
    note.draw(ofGetWidth()/2-note.getWidth()/2, ofGetHeight()/2-note.getHeight()/2);
    
    ofSetColor(255, 255, 255);
    ofCircle(ofGetWidth()/2, ofGetHeight()/2, radius_1);
    radius_1 += (20 + height*5);
    if(radius_1 > ofGetWidth()/2){
        radius_1 = 0;
    }
    player.draw(ofGetWidth()-600,ofGetHeight()-700);
    theremin.draw(30,ofGetHeight()-600);
    
    sound.setSpeed(ofMap(height, 1, 8, 1.0, 2.0));
    
    ofDrawBitmapStringHighlight(ofToString(height), 30, 10);
    
}
Esempio n. 29
0
void Stars::draw(){

	for(int i = 0; i < _num; i++){
	
		ofSetColor(_color);
		ofSetSphereResolution(4);
		ofDrawSphere(_pos[i], _radius);
	
	}

}
//--------------------------------------------------------------
void vhpParticula::draw() {
    ofPushStyle();
    ofSetColor(color);
    ofFill();
    ofPushMatrix();
    ofTranslate(0, 0, posicion.z);
    ofDrawSphere(posicion.x, posicion.y,radio);
    //ofCircle(posicion.x, posicion.y,radio);
    ofPopMatrix();
    ofPopStyle();
}