Project

General

Profile

« Previous | Next » 

Revision 3b8f5220

Added by Leszek Koltunski almost 2 years ago

Improve two things in the BandagedCreator:

- when one minimizes the app and re-maximizes it, now the app remembers the state of the bandaged cube being created
- when one minimizes the app while one of th cubits is marked, it no longer gets marked the second time on re-maximizaton (which was the reason why some cubits sometimes couldn't be unmarked).

View differences:

src/main/java/org/distorted/bandaged/BandagedCubit.java
57 57

  
58 58
    private final DistortedNode mNode;
59 59
    private final DistortedEffects mEffects;
60
    private final DistortedTexture mTexture;
60 61
    private final Static3D mMove;
61 62
    private final boolean mRoundCorners;
62 63
    private final int mX, mY, mZ;
......
181 182
      FactoryBandagedCubit factory = FactoryBandagedCubit.getInstance();
182 183
      MeshBase mesh = factory.createMesh(mPosition,mX,mY,mZ,false,mRoundCorners);
183 184

  
184
      DistortedTexture texture = new DistortedTexture();
185
      mTexture = new DistortedTexture();
185 186
      if( mBitmap==null ) createBitmap();
186
      texture.setTextureAlreadyInverted(mBitmap);
187
      mTexture.setTextureAlreadyInverted(mBitmap);
187 188

  
188 189
      resetTextureMaps(mesh);
189 190

  
......
198 199
      mEffects.apply(quat2Effect);
199 200
      mEffects.apply(quat1Effect);
200 201

  
201
      mNode = new DistortedNode(texture,mEffects,mesh);
202
      mNode = new DistortedNode(mTexture,mEffects,mesh);
202 203
      }
203 204

  
204 205
///////////////////////////////////////////////////////////////////////////////////////////////////
......
245 246
      mMove.set( scale*mUnscaledX, scale*mUnscaledY, scale*mUnscaledZ);
246 247
      }
247 248

  
249
///////////////////////////////////////////////////////////////////////////////////////////////////
250

  
251
    public void recreateBitmap()
252
      {
253
      if( mBitmap==null ) createBitmap();
254
      mTexture.setTextureAlreadyInverted(mBitmap);
255
      }
256

  
248 257
///////////////////////////////////////////////////////////////////////////////////////////////////
249 258

  
250 259
    public void scaleMove(float scale)
......
256 265

  
257 266
    public void setMarked()
258 267
      {
259
      FragmentEffectBrightness effect = new FragmentEffectBrightness(mAlpha);
260
      mMarkedEffectID = effect.getID();
261
      mEffects.apply(effect);
268
      if( mMarkedEffectID<0 )
269
        {
270
        FragmentEffectBrightness effect = new FragmentEffectBrightness(mAlpha);
271
        mMarkedEffectID = effect.getID();
272
        mEffects.apply(effect);
273
        }
262 274
      }
263 275

  
264 276
///////////////////////////////////////////////////////////////////////////////////////////////////
265 277

  
266 278
    public void setUnmarked()
267 279
      {
268
      if( mMarkedEffectID>=0 ) mEffects.abortById(mMarkedEffectID);
280
      if( mMarkedEffectID>=0 )
281
        {
282
        mEffects.abortById(mMarkedEffectID);
283
        mMarkedEffectID = -1;
284
        }
269 285
      }
270 286

  
271 287
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff