Project

General

Profile

« Previous | Next » 

Revision 65362dd4

Added by Leszek Koltunski almost 8 years ago

Various relatively minor cleanups.

View differences:

src/main/java/org/distorted/library/DistortedFramebuffer.java
29 29
/**
30 30
 * Class which represents a OpenGL Framebuffer object.
31 31
 * <p>
32
 * User is able to create either WRITE-only Framebuffers from objects already constructed outside
33
 * of the library (the first constructor; primary use case: the screen) or an offscreen READ-WRITE
32
 * User is able to create either Framebuffers from objects already constructed outside
33
 * of the library (the first constructor; primary use case: the screen) or an offscreen
34 34
 * FBOs (used by the DistortedNode, but also can be used by external users of the library)
35 35
 * <p>
36 36
 * Also, keep all objects created in a static LinkedList. The point: we need to be able to mark
37 37
 * Framebuffers for deletion, and delete all marked objects later at a convenient time (that's
38 38
 * because we can only delete from a thread that holds the OpenGL context so here we provide a
39
 * framework where one is able to mark for deletion at any place and actual deletion takes place
39
 * framework where one is able to mark for deletion at any time and actual deletion takes place
40 40
 * on the next render).
41 41
 */
42 42
public class DistortedFramebuffer
......
271 271
 * to set the size of an not-yet-created Framebuffer of an object that has been created with the
272 272
 * second constructor.
273 273
 * <p>
274
 * Fully creating an object, rendering to it, then resizing mid-render is also possible.
274
 * Fully creating an object, rendering to it, then resizing mid-render is also possible. Actual
275
 * resize takes place on the next render.
275 276
 *
276 277
 * @param width The new width.
277 278
 * @param height The new height.
src/main/java/org/distorted/library/EffectQueue.java
48 48

  
49 49
  protected Vector<EffectListener> mListeners =null;
50 50
  protected int mNumListeners=0;  // ==mListeners.length(), but we only create mListeners if the first one gets added
51
  protected long mBitmapID;
51
  protected long mObjectID;
52 52

  
53 53
  private static boolean mCreated;
54 54

  
......
68 68
    if( obj!=null )
69 69
      {
70 70
      mObjHalfX = obj.getWidth() / 2.0f;
71
      mObjHalfY = obj.getHeight() / 2.0f;
71
      mObjHalfY = obj.getHeight()/ 2.0f;
72 72
      mObjHalfZ = obj.getDepth() / 2.0f;
73

  
74
      mBitmapID = obj.getID();
73
      mObjectID = obj.getID();
75 74
      }
76 75

  
77 76
    if( mMax[mMaxIndex]>0 )
......
221 220
                                          EffectMessage.EFFECT_REMOVED,
222 221
                                          (removedID<<EffectTypes.LENGTH)+EffectNames.getType(removedName).type,
223 222
                                          removedName,
224
                                          mBitmapID,
223
                                          mObjectID,
225 224
                                          null);
226 225
        }
227 226
      }
......
271 270
                                      EffectMessage.EFFECT_REMOVED,
272 271
                                      (removedID<<EffectTypes.LENGTH)+EffectNames.getType(removedName).type,
273 272
                                      removedName,
274
                                      mBitmapID,
273
                                      mObjectID,
275 274
                                      null);
276 275
    }
277 276
  
src/main/java/org/distorted/library/EffectQueueFragment.java
75 75
                                          EffectMessage.EFFECT_FINISHED,
76 76
                                          (mID[i]<<EffectTypes.LENGTH)+EffectTypes.FRAGMENT.type,
77 77
                                          mName[i],
78
                                          mBitmapID,
78
                                          mObjectID,
79 79
                                          null);
80 80
      
81 81
        if( EffectNames.isUnity(mName[i], mUniforms, NUM_UNIFORMS*i) )
......
162 162
      else return -1;
163 163

  
164 164
      mInter[1][mNumEffects] = null;
165
      mUniforms[NUM_UNIFORMS*mNumEffects+6] = 1000*mObjHalfX;
166
      mUniforms[NUM_UNIFORMS*mNumEffects+7] = 1000*mObjHalfY;
165
      mUniforms[NUM_UNIFORMS*mNumEffects+6] = Float.MAX_VALUE;
166
      mUniforms[NUM_UNIFORMS*mNumEffects+7] = Float.MAX_VALUE;
167 167

  
168 168
      mInter[2][mNumEffects] = null;
169 169

  
......
302 302
      else return -1;
303 303

  
304 304
      mInter[1][mNumEffects]  = null;
305
      mUniforms[NUM_UNIFORMS*mNumEffects+6] = 1000*mObjHalfX;
306
      mUniforms[NUM_UNIFORMS*mNumEffects+7] = 1000*mObjHalfY;
305
      mUniforms[NUM_UNIFORMS*mNumEffects+6] = Float.MAX_VALUE;
306
      mUniforms[NUM_UNIFORMS*mNumEffects+7] = Float.MAX_VALUE;
307 307

  
308 308
      return addBase(eln);
309 309
      }
src/main/java/org/distorted/library/EffectQueueMatrix.java
114 114
                                          EffectMessage.EFFECT_FINISHED,
115 115
                                         (mID[i]<<EffectTypes.LENGTH)+EffectTypes.MATRIX.type,
116 116
                                          mName[i],
117
                                          mBitmapID,
117
                                          mObjectID,
118 118
                                          null);
119 119

  
120 120
        if( EffectNames.isUnity(mName[i], mUniforms, NUM_UNIFORMS*i) )
src/main/java/org/distorted/library/EffectQueueVertex.java
85 85
                                            EffectMessage.EFFECT_FINISHED,
86 86
                                           (mID[i]<<EffectTypes.LENGTH)+EffectTypes.VERTEX.type,
87 87
                                            mName[i],
88
                                            mBitmapID,
88
                                            mObjectID,
89 89
                                            null);
90 90

  
91 91
          if( EffectNames.isUnity(mName[i], mUniforms, NUM_UNIFORMS*i) )
......
369 369

  
370 370
        mUniforms[NUM_UNIFORMS*mNumEffects+ 8] = tmp.getX();
371 371
        mUniforms[NUM_UNIFORMS*mNumEffects+ 9] =-tmp.getY();   // invert y already
372
        mUniforms[NUM_UNIFORMS*mNumEffects+10] = z<=0.0f ? 1000*mObjHalfX : z;
372
        mUniforms[NUM_UNIFORMS*mNumEffects+10] = z<=0.0f ? Float.MAX_VALUE : z;
373 373
        mUniforms[NUM_UNIFORMS*mNumEffects+11] = tmp.getW();
374 374
        mInter[1][mNumEffects] = null;
375 375
        }
......
379 379
      {
380 380
      mUniforms[NUM_UNIFORMS*mNumEffects+ 8] = 0.0f;
381 381
      mUniforms[NUM_UNIFORMS*mNumEffects+ 9] = 0.0f;
382
      mUniforms[NUM_UNIFORMS*mNumEffects+10] = 1000*mObjHalfX;
382
      mUniforms[NUM_UNIFORMS*mNumEffects+10] = Float.MAX_VALUE;
383 383
      mUniforms[NUM_UNIFORMS*mNumEffects+11] = 0.0f;
384 384
      mInter[1][mNumEffects] = null;
385 385
      }

Also available in: Unified diff