Project

General

Profile

« Previous | Next » 

Revision b6a71581

Added by Leszek Koltunski over 2 years ago

Improve 'off-center' objects: move the node, not the object!
This simplifies the Effects and makes them more correct (glow!)

View differences:

src/main/java/org/distorted/objectlib/effects/win/WinEffectGlow.java
67 67
    degreeDyn.add(new Static1D(1.5f));
68 68
    degreeDyn.add(new Static1D(1.0f));
69 69

  
70
    float moveX = mPre.getMoveX();
71
    float moveY = mPre.getMoveY();
72
    int width   = mScreen.getWidth();
73
    int height  = mScreen.getHeight();
74
    Static3D center = new Static3D(moveX/width, moveY/height, 0);
70
    Static3D center = new Static3D(0,0,0);
75 71
    float ratio = 0.5f*mObject.getRatio();
76 72

  
77 73
    mNodeEffects[1] = new VertexEffectSink(degreeDyn, center, new Static4D(0,0,0,ratio) );
src/main/java/org/distorted/objectlib/main/TwistyObject.java
208 208

  
209 209
    MatrixEffectScale nodeScaleEffect = new MatrixEffectScale(mNodeScale);
210 210
    nodeEffects.apply(nodeScaleEffect);
211
    nodeEffects.apply(moveEffect);
211 212

  
212 213
    mNumTexCols = NUM_STICKERS_IN_ROW;
213 214
    mNumTexRows = (NUM_TEXTURES+1)/NUM_STICKERS_IN_ROW;
......
233 234
    mEffects.apply(mRotateEffect);
234 235
    mEffects.apply(quatEffect);
235 236
    mEffects.apply(scaleEffect);
236
    mEffects.apply(moveEffect);
237 237

  
238 238
    // Now postprocessed effects (the glow when you solve an object) require component centers. In
239 239
    // order for the effect to be in front of the object, we need to set the center to be behind it.

Also available in: Unified diff