SimpleAnimation::SimpleAnimation(xmlNodePtr animationNode, const std::string& dyePalettes): mAnimation(new Animation), mAnimationTime(0), mAnimationPhase(0), mInitialized(false) { initializeAnimation(animationNode, dyePalettes); mCurrentFrame = mAnimation->getFrame(0); }
SimpleAnimation::SimpleAnimation(XmlNodePtr animationNode, const std::string& dyePalettes): mAnimation(new Animation), mAnimationTime(0), mAnimationPhase(0), mInitialized(false) { initializeAnimation(animationNode, dyePalettes); if (mAnimation) mCurrentFrame = &mAnimation->mFrames[0]; else mCurrentFrame = nullptr; }
void GameLoader::initializeObject(const QDomElement& element, AnimatedObject* object) { QSize size(element.attribute("width").toUInt(), element.attribute("height").toUInt()); double velocity = element.attribute("velocity").toDouble(); object->setSize(size); object->setVelocity(velocity); QDomElement marginsElement = element.firstChildElement("margins"); QMargins margins(marginsElement.attribute("left").toInt(), marginsElement.attribute("top").toInt(), marginsElement.attribute("right").toInt(), marginsElement.attribute("bottom").toInt()); object->setMargins(margins); initializeAnimation(element.firstChildElement("animation"), object->animation()); }
//___________________________________________________________________ bool StackedWidgetData::animate( void ) { // check enability if ( !enabled() ) return false; // initialize animation if ( !initializeAnimation() ) return false; // show transition widget transition().data()->show(); transition().data()->raise(); transition().data()->animate(); return true; }
void reshape (int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0, (GLdouble) w, 0.0, (GLdouble) h); windowWidth = w; windowHeight = h; image.resize(windowWidth*windowHeight); clearAnimation(); memset(image.data(),0,windowWidth*windowHeight*sizeof(Float3)); // clear image to black initializeAnimation(); glutDisplayFunc(display); } // end function reshape
void keyboard(unsigned char key, int x, int y) { switch(key) { case '\r': // enter key // reset clearAnimation(); memset(image.data(),0,windowWidth*windowHeight*sizeof(Float3)); // clear image to black initializeAnimation(); glutDisplayFunc(display); break; case 27: // escape key exit(0); } // end switch } // end function keyboard
void initGraphics() { glEnable(GL_TEXTURE_2D); glEnable(GL_DEPTH_TEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); eyeVector = vec3(0.0,0.0,defaultEyeZ); upVector = vec3(0.0,1.0,0.0); centerVector = vec3(0,0,0); initializeAnimation(); //initialize display lists initCircleThingy(); initTorus(); initSpaceStation(); initMouse(); //initialize shaders vertexShader = initshaders(GL_VERTEX_SHADER, "vertexShader.glsl"); fragmentShader = initshaders(GL_FRAGMENT_SHADER, "fragmentShader.glsl"); shaderProgram = initprogram(vertexShader,fragmentShader); //link up variables in shaders // computingTeapot = glGetUniformLocation(shaderProgram,"computingTeapot"); computingSphere = glGetUniformLocation(shaderProgram,"computingSphere"); centerDist = glGetUniformLocation(shaderProgram, "centerDist"); computingTorus = glGetUniformLocation(shaderProgram, "computingTorus"); torusTransparency = glGetUniformLocation(shaderProgram, "torusTransparency"); materialDiffuse = glGetUniformLocation(shaderProgram, "materialDiffuse"); materialSpecular = glGetUniformLocation(shaderProgram, "materialSpecular"); materialShininess = glGetUniformLocation(shaderProgram, "materialShininess"); viewMatrix = glGetUniformLocation(shaderProgram, "viewMatrix"); usingTextures = glGetUniformLocation(shaderProgram, "usingTextures"); computingMonitor = glGetUniformLocation(shaderProgram, "computingMonitor"); //initialize textures initSphereTexture(fragmentShader); }
//___________________________________________________________________ void LineEditData::textChanged( void ) { // check whether text change was triggered manually // in which case do not start transition if( _edited ) { _edited = false; return; } if( transition().data()->isAnimated() ) { transition().data()->endAnimation(); } if( isLocked() ) { // if locked one do not start the new animation, to prevent flicker // instead, one hides the transition pixmap, trigger an update, and return. // animations are re-locked. transition().data()->hide(); lockAnimations(); _timer.start( 0, this ); return; } if( initializeAnimation() ) { lockAnimations(); animate(); } else { transition().data()->hide(); } }
//___________________________________________________________________ bool LabelData::eventFilter( QObject* object, QEvent* event ) { if ( object != target_.data() ) return TransitionData::eventFilter( object, event ); switch ( event->type() ) { case QEvent::Show: /* at show event, on set the old text to current to avoid animate the "first" paint event. text mnemonic is always removed to avoid triggering the animation when only the latter is changed */ text_ = target_.data()->text().remove( '&' ); break; case QEvent::Paint: { if ( enabled() && target_ ) { // remove showMnemonic from text before comparing QString text( target_.data()->text().remove( '&' ) ); if ( text == text_ ) { if ( transition().data()->isAnimated() && TransitionWidget::paintEnabled() ) return true; else break; } // update text and pixmap text_ = text; if ( !(transition() && target_.data()->isVisible() ) ) break; if ( transition().data()->isAnimated() ) { transition().data()->endAnimation(); } // check whether animations are locked if ( isLocked() ) { // hide transition widget transition().data()->hide(); // restart the lock timer // and abort transition lockAnimations(); break; } // restart the lock timer // and prepare transition lockAnimations(); initializeAnimation(); timer_.start( 0, this ); if ( !transition().data()->startPixmap().isNull() && TransitionWidget::paintEnabled() ) { // show the transition widget // and disable this event painting transition().data()->show(); transition().data()->raise(); return true; } else { // hide transition widget and abort transition transition().data()->hide(); break; } } else if ( transition().data()->isAnimated() && TransitionWidget::paintEnabled() ) { // disable painting when transition is running // since label is obscured by transition widget return true; } else break; } default: break; } return TransitionData::eventFilter( object, event ); }