Beispiel #1
0
//--------------------------------------------------------------
void testApp::drawActor(const ramActor &actor)
{
	ramNode n1 = actor.getNode(ramActor::JOINT_HEAD);
	ramNode n2 = actor.getNode(ramActor::JOINT_RIGHT_HAND);
	ramNode n3 = actor.getNode(ramActor::JOINT_LEFT_HAND);
	ramNode n4 = actor.getNode(ramActor::JOINT_RIGHT_TOE);
	ramNode n5 = actor.getNode(ramActor::JOINT_LEFT_TOE);

	ofPushStyle();
	{
		// draw line betweem two nodes
		ofNoFill();
		ofSetColor( ramColor::RED_LIGHT );
		ofSetLineWidth( 3 );
		ofLine( n2, n3 );


		// draw triangle using three nodes
		ofFill();
		ofSetColor( ramColor::BLUE_LIGHT );
		ofSetLineWidth( 3 );
		ofTriangle( n1, n4, n5 );


		// ramNode::beginTransform() ~ endTransform()
		n1.beginTransform();
		{
			// draw cube at JOINT_HEAD
			ofNoFill();
			ofSetColor( ramColor::YELLOW_DEEP );
			ofSetLineWidth( 3 );
			ofBox( 20 );

			// draw cone at JOINT_HEAD
			ofNoFill();
			ofSetColor( ramColor::GRAY );
			ofSetLineWidth( 2 );
			ofCone(10, 100);
		}
		n1.endTransform();


		// draw plane using several nodes
		ofNoFill();
		ofSetColor( ramColor::YELLOW_LIGHT );
		ofSetLineWidth( 2 );
		ofPushMatrix();
		{
			ofScale( 3, 3, 3 );
			ramStripe( n1, n2, n3, n4, n5 );
		}
		ofPopMatrix();
	}
	ofPopStyle();
}
Beispiel #2
0
//--------------------------------------------------------------
void ofDrawArrow(const ofVec3f& start, const ofVec3f& end, float headSize) {
	
	//draw line
	ofLine(start, end);
	
	//draw cone
	ofMatrix4x4 mat;
	mat.makeRotationMatrix(ofVec3f(0,0,1), end - start);
	ofPushMatrix();
	ofTranslate(end);
	glMultMatrixf(mat.getPtr());
	ofTranslate(0,0,-headSize);
	ofCone(headSize, headSize);	
	ofPopMatrix();
}
//----------------------------------------
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();
}