void Animation::candleMelt( Object *candle, Object *tip, float rawScale ) { float adj = Animation::scaleBottomFixed( candle, pow(rawScale, tick.scale()) ); vec4 currentTipPos = tip->_trans.otm() * vec4(tip->getMax(),1.0); tip->_trans.push( TransMat( 0, adj, 0 ) ); currentTipPos.y += adj; if (*(Engine::instance()->getNumLights()) > 0) { Engine::instance()->getLights()->at(0)->y( currentTipPos.y ); Engine::instance()->setLights(); } }
AttrFillGeometry* FillGeometryNudger::MutateFill(AttrFillGeometry* FillToMutate) { if (!FillToMutate->IsVisible() || FillToMutate->GetSelectionCount() == 0) return NULL; // Make a copy of this Fill to change AttrFillGeometry* NewFill = (AttrFillGeometry*)FillToMutate->SimpleCopy(); if (NewFill == NULL) return NULL; // Construct the translation matrix Trans2DMatrix TransMat(X_NudgeDistance, Y_NudgeDistance); BOOL isARampBlob = FALSE; // And apply it to the fill NewFill->TransformSelectedControlPoints(TransMat, &isARampBlob); if (LastNudgeType == FillToMutate->GetRuntimeClass()) { BOOL IsSame = TRUE; if (FillToMutate->GetStartPoint() && *FillToMutate->GetStartPoint() != LastNudgeStart) IsSame = FALSE; if (FillToMutate->GetEndPoint() && *FillToMutate->GetEndPoint() != LastNudgeEnd) IsSame = FALSE; if (FillToMutate->GetEndPoint2() && *FillToMutate->GetEndPoint2() != LastNudgeEnd2) IsSame = FALSE; if (IsSame) return NewFill; } Node *pNode = FillToMutate; while ((pNode != NULL) && !pNode->IsSpread()) pNode = pNode->FindParent(); if (pNode == NULL) return NewFill; // We're not really in the tree Spread* pSpread = (Spread*)pNode; DocRect OldBounds = FillToMutate->GetBlobBoundingRect(); DocRect NewBounds = NewFill->GetBlobBoundingRect(); DocRect Bounds = OldBounds.Union(NewBounds); RenderRegion* pRegion = DocView::RenderOnTop(&Bounds, pSpread, UnclippedEOR); while (pRegion) { if (!isARampBlob) { // MUST do a full redraw of the fill blobs FillToMutate->RenderFillBlobs(pRegion); NewFill->RenderFillBlobs(pRegion); } else { FillToMutate->DisableRampRedraw (); FillToMutate->RenderFillBlobs(pRegion); FillToMutate->EnableRampRedraw (); NewFill->DisableRampRedraw (); NewFill->RenderFillBlobs(pRegion); NewFill->EnableRampRedraw (); } // Get the Next render region pRegion = DocView::GetNextOnTop(&Bounds); } AttrFillGeometry::LastRenderedMesh = NULL; LastNudgeType = FillToMutate->GetRuntimeClass(); if (FillToMutate->GetStartPoint()) LastNudgeStart = *FillToMutate->GetStartPoint(); if (FillToMutate->GetEndPoint()) LastNudgeEnd = *FillToMutate->GetEndPoint(); if (FillToMutate->GetEndPoint2()) LastNudgeEnd2 = *FillToMutate->GetEndPoint2(); return NewFill; }