예제 #1
0
void SimpleCameraModel::plotKeyframe(float t) {
	// Iterate over list of model properties
	PropertyList* props = properties.getProperties();
	for (PropertyList::iterator iter = props->begin();
		iter != props->end();
		iter++) {

		// Cast property to a range property
		RangeProperty* rp = dynamic_cast<RangeProperty*>(*iter);
		if (!rp) { continue; }

		// Get the curve, and add a control point
		Curve* pCurve = ModelerUserInterface::getInstance()->
			graph->curve(rp->getCurveIndex());
        pCurve->addControlPoint( Animator::Point(t, rp->getValue()) );
	}

	// Redraw the curves
	ModelerUserInterface::getInstance()->graph->redraw();
}
예제 #2
0
// We are going to override (is that the right word?) the draw()
// method of ModelerView to draw out RobotArm
void RobotArm::draw()
{
    /* pick up the slider values */
    float theta = baseRotation.getValue();
    float phi = lowerTilt.getValue();
    float psi = upperTilt.getValue();
    float cr = clawRotation.getValue();
    float h1 = baseLength.getValue();
    float h2 = lowerLength.getValue();
    float h3 = upperLength.getValue();




    static GLfloat lmodel_ambient[] = {0.4,0.4,0.4,1.0};

    // define the model

    ground(-0.2);

    base(0.8);

    glTranslatef( 0.0, 0.8, 0.0 );			// move to the top of the base
    glRotatef( theta, 0.0, 1.0, 0.0 );		// turn the whole assembly around the y-axis.
    rotation_base(h1);						// draw the rotation base

    glTranslatef( 0.0, h1, 0.0 );			// move to the top of the base
    glRotatef( phi, 0.0, 0.0, 1.0 );		// rotate around the z-axis for the lower arm
    glTranslatef( -0.1, 0.0, 0.4 );
    lower_arm(h2);							// draw the lower arm

    glTranslatef( 0.0, h2, 0.0 );			// move to the top of the lower arm
    glRotatef( psi, 0.0, 0.0, 1.0 );		// rotate  around z-axis for the upper arm
    upper_arm(h3);							// draw the upper arm

    glTranslatef( 0.0, h3, 0.0 );
    glRotatef( cr, 0.0, 0.0, 1.0 );
    claw(1.0);

}