Project

General

Profile

« Previous | Next » 

Revision dfbb340a

Added by Leszek Koltunski over 4 years ago

Fix: nwo we need to explicitly set mesh center to negative Z if we want to GLOW a flat object.

View differences:

src/main/java/org/distorted/objects/RubikObject.java
164 164
    mEffects.apply(mQuatEffect);
165 165
    mEffects.apply(mScaleEffect);
166 166

  
167
    // Now postprocessed effects (the glow when you solve an object) require component centers. In
168
    // order for the center to be in front of the object, we need to set the center to be behind it.
169
    getMesh().setComponentCenter(0,0,0,-0.1f);
170

  
167 171
    attach( new DistortedNode(mTexture,mEffects,mMesh) );
168 172

  
169 173
    setupPosition(moves);
src/main/java/org/distorted/states/RubikStatePlay.java
24 24
import android.graphics.drawable.BitmapDrawable;
25 25
import android.os.Build;
26 26
import android.os.Bundle;
27
import android.util.DisplayMetrics;
27 28
import android.util.TypedValue;
28 29
import android.view.Gravity;
29 30
import android.view.LayoutInflater;
......
73 74
  private AppCompatSpinner mLevelSpinner;
74 75
  private ArrayAdapter<String> mSpinnerAdapter;
75 76
  private int mLevelValue;
77
  private int mBarHeight;
76 78
  private float mButtonSize, mTitleSize, mMenuItemSize, mMenuTextSize;
77 79

  
78 80
  private ArrayList<Move> mMoves;
......
285 287
    mMenuButton.setPadding(padding,0,padding,0);
286 288
    mMenuButton.setImageResource(icon);
287 289

  
288
    final int barHeight = act.getScreenHeightInPixels()/10;
289

  
290 290
    mMenuButton.setOnClickListener( new View.OnClickListener()
291 291
      {
292 292
      @Override
......
294 294
        {
295 295
        if( act.getPreRender().canPlay() )
296 296
          {
297
          mMenuPopup.showAsDropDown(view, 0, -mMenuLayoutHeight-barHeight, Gravity.LEFT);
297
          if( mBarHeight<=0 )
298
            {
299
            DisplayMetrics displaymetrics = new DisplayMetrics();
300
            act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
301
            mBarHeight=displaymetrics.heightPixels/10;
302
            }
303

  
304
          mMenuPopup.showAsDropDown(view, 0, -mMenuLayoutHeight-mBarHeight, Gravity.LEFT);
298 305
          mMenuPopup.update(view, mMenuLayoutWidth, mMenuLayoutHeight);
299 306
          }
300 307
        }

Also available in: Unified diff