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(); }
void SimpleCameraModel::clearKeyframe(float t) { // Iterate over list of model properties PropertyList* props = properties.getProperties(); for (PropertyList::iterator iter = props->begin(); iter != props->end(); iter++) { // Attempt to cast property to a range property RangeProperty* rp = dynamic_cast<RangeProperty*>(*iter); if (!rp) { continue; } // Get the curve Curve* pCurve = ModelerUserInterface::getInstance()-> graph->curve(rp->getCurveIndex()); // Remove all control points in a small range around the current time. pCurve->removeControlPointsInRange( t-REMOVE_KEYFRAME_RANGE/2, t+REMOVE_KEYFRAME_RANGE/2 ); } // Redraw the curves ModelerUserInterface::getInstance()->graph->redraw(); }
// 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); }
void ModelerUserInterface::SliderCallback(Fl_Slider* slider, void* p) { RangeProperty* prop = (RangeProperty*) p; prop->setValue((float)slider->value()); ModelerUserInterface::getInstance()->m_modelerView->redraw(); }