// CCSceneObject void CCTile3DButton::update(const CCTime &gameTime) { super::update( gameTime ); if( scale != NULL ) { const float speed = gameTime.delta * 1.0f; if( scaleInterpolator.update( speed ) ) { dirtyModelMatrix(); } else { DELETE_POINTER( scale ); } } // Touch depress: On update if( touchDepressRange > 0.0f ) { if( touchDepressInterpolator.update( gameTime.delta ) ) { dirtyModelMatrix(); } } if( touchRotationAllowed ) { const float speed = touching || touchReleased ? 3.0f : touchRotationSpeed; if( touchRotationInterpolator.update( gameTime.delta * speed ) ) { const float magnitudeSquared = rotation.x * rotation.x + rotation.y * rotation.y; touchRotationMagnitude = sqrtf( magnitudeSquared ); touchRotationMagnitude = MIN( touchRotationMagnitude, 1.0f ); dirtyModelMatrix(); } } if( touching ) { touchingTime += gameTime.real; } else if( touchReleased ) { if( touchDepressInterpolator.finished() && touchRotationInterpolator.finished() ) { handleTouchRelease(); } } colourInterpolator.update( gameTime.delta ); if( textModel != NULL ) { textModel->colourInterpolator.update( gameTime.delta ); } }
void CCSceneMoveable::updateMovement(const float delta) { if( moveable ) { const float movementMagnitude = applyMovementDirection( delta ); velocity = movementVelocity; const float additionalMagnitude = CCVector3LengthSquared( additionalVelocity ); if( additionalMagnitude > 0.0f ) { velocity.add( additionalVelocity ); const float deceleration = decelerationSpeed * delta; CCToTarget( additionalVelocity.x, 0.0f, deceleration ); CCToTarget( additionalVelocity.y, 0.0f, deceleration ); CCToTarget( additionalVelocity.z, 0.0f, deceleration ); } const float velocityMagnitude = CCVector3LengthSquared( velocity ); if( velocityMagnitude > 0.0f ) { applyVelocity( delta, movementMagnitude ); dirtyModelMatrix(); updateCollisions = true; CCOctreeRefreshObject( this ); } } }
void CCRenderable::setPositionXYZ(const float x, const float y, const float z) { position.x = x; position.y = y; position.z = z; dirtyModelMatrix(); }
void CCRenderable::translate(const float x, const float y, const float z) { position.x += x; position.y += y; position.z += z; dirtyModelMatrix(); }
void TileSocial::update(const CCGameTime &gameTime) { super::update( gameTime ); if( rotationInterpolator.update( gameTime.delta * rotationSpeed ) ) { dirtyModelMatrix(); } }
CCRenderable::CCRenderable() { shouldRender = true; dirtyModelMatrix(); updateWorldMatrix = true; positionPtr = &position; scale = NULL; }
void TileSocialPhoto::update(const CCGameTime &gameTime) { // Handles the fading in and out of tiles depending on if they're in view and // if their texture is in memory.. if( rotationInterpolator.finished() ) { if( enabled == false || shouldRender == false ) { if( colourInterpolator.getTarget().alpha != CC_SMALLFLOAT ) { colourInterpolator.setTargetAlpha( CC_SMALLFLOAT ); } else if( baseModel->getColour()->alpha != CC_SMALLFLOAT ) { colourInterpolator.update( gameTime.delta ); } return; } else { if( baseSquare->textureInfo != NULL ) { const int textureHandleIndex = baseSquare->textureInfo->primaryIndex; CCTextureHandle *textureHandle = gEngine->textureManager->getTextureHandle( textureHandleIndex ); const CCTextureBase *texture = textureHandle->texture; //ASSERT( texture != NULL ); if( texture != NULL ) { if( colourInterpolator.getTarget().alpha != 1.0f ) { colourInterpolator.setTargetAlpha( 1.0f ); } } else if( colourInterpolator.getTarget().alpha != CC_SMALLFLOAT ) { colourInterpolator.setTargetAlpha( gameTime.delta ); } } } } super::update( gameTime ); if( rotationInterpolator.update( gameTime.delta * 180.0f ) ) { dirtyModelMatrix(); } }
// CCSceneObject void CCTile3DButton::update(const CCTime &gameTime) { super::update( gameTime ); if( scale != NULL ) { const float speed = gameTime.delta * 1.0f; if( scaleInterpolator.update( speed ) ) { dirtyModelMatrix(); } else { DELETE_POINTER( scale ); } } colourInterpolator.update( gameTime.delta ); if( textModel != NULL ) { textModel->colourInterpolator.update( gameTime.delta ); } }
void CCRenderable::rotationUpdated() { dirtyModelMatrix(); }