Project

General

Profile

« Previous | Next » 

Revision 7451c98a

Added by Leszek Koltunski over 7 years ago

Hide the 'depth' of a DistortedTexture inside the library, so users do not get exposed to this weirdness.

View differences:

src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldRenderer.java
126 126
      mObjWidth = bitmap.getWidth();
127 127
      mObjHeight= bitmap.getHeight();
128 128

  
129
      mTexture = new DistortedTexture(mObjWidth,mObjHeight,0);
129
      mTexture = new DistortedTexture(mObjWidth,mObjHeight);
130 130
      mTexture.setTexture(bitmap);
131 131

  
132 132
      mGrid = new GridFlat(30,30*mObjHeight/mObjWidth);
src/main/java/org/distorted/examples/bean/BeanRenderer.java
147 147
      bmpHeight = bitmap.getHeight();
148 148
      bmpWidth  = bitmap.getWidth();
149 149
      
150
      mTexture = new DistortedTexture(bmpWidth, bmpHeight, 0);
150
      mTexture = new DistortedTexture(bmpWidth,bmpHeight);
151 151
      mTexture.setTexture(bitmap);
152 152
      mGrid = new GridFlat(25,25*bmpHeight/bmpWidth);
153 153

  
src/main/java/org/distorted/examples/catanddog/CatAndDogRenderer.java
110 110
      bmpHeight = bitmap.getHeight();
111 111
      bmpWidth  = bitmap.getWidth();
112 112

  
113
      mTexture = new DistortedTexture(bmpWidth,bmpHeight,0);
113
      mTexture = new DistortedTexture(bmpWidth,bmpHeight);
114 114
      mTexture.setTexture(bitmap);
115 115

  
116 116
      try
src/main/java/org/distorted/examples/check/CheckRenderer.java
132 132
      bmpHeight = bitmap.getHeight();
133 133
      bmpWidth  = bitmap.getWidth();
134 134

  
135
      mTexture = new DistortedTexture(bmpWidth,bmpHeight,0);
135
      mTexture = new DistortedTexture(bmpWidth,bmpHeight);
136 136
      mTexture.setTexture(bitmap);
137 137
      mGrid = new GridFlat(30,30*bmpHeight/bmpWidth);
138 138

  
src/main/java/org/distorted/examples/cubes/CubesActivity.java
200 200
        str += mShape[i] ? "1" : "0";
201 201

  
202 202
      mGrid = new GridCubes(mNumCols, str, false);
203
      mTexture = new DistortedTexture(mNumCols,mNumRows,1);
203
      mTexture = new DistortedTexture(mNumCols,mNumRows);
204 204

  
205 205
      setContentView(R.layout.cubeslayout);
206 206
      }
src/main/java/org/distorted/examples/deform/DeformRenderer.java
239 239
     {
240 240
     Canvas stretchCanvas;
241 241
      
242
     stretchTexture = new DistortedTexture(w,h,0);
242
     stretchTexture = new DistortedTexture(w,h);
243 243
     stretchGrid    = new GridFlat(50,50*h/w);
244 244
     Bitmap stretchBitmap = Bitmap.createBitmap(w,h, Bitmap.Config.ARGB_8888);
245 245
     stretchCanvas = new Canvas(stretchBitmap);
......
261 261
        
262 262
     touchPoint= new Static3D(0,0,0);
263 263
        
264
     fpsTexture = new DistortedTexture( fpsW, fpsH, 0);
264
     fpsTexture = new DistortedTexture(fpsW,fpsH);
265 265
     fpsGrid = new GridFlat(1,1);
266 266

  
267 267
     fpsBitmap = Bitmap.createBitmap(fpsW,fpsH, Bitmap.Config.ARGB_8888);
src/main/java/org/distorted/examples/differentbitmaps/DifferentBitmapsRenderer.java
161 161
      
162 162
      mTexture = new DistortedTexture[NUM];
163 163
      for(int i=0; i<NUM; i++)
164
        mTexture[i] = new DistortedTexture(bmpWidth, bmpHeight,0);
164
        mTexture[i] = new DistortedTexture(bmpWidth,bmpHeight);
165 165
      
166 166
      mTexture[0].setTexture(bitmap0);
167 167
      mTexture[1].setTexture(bitmap1);
src/main/java/org/distorted/examples/differenteffects/DifferentEffectsRenderer.java
166 166
     bmpWidth  = bitmap.getWidth();
167 167

  
168 168
     mGrid     = new GridFlat(30,30*bmpHeight/bmpWidth);
169
     mTexture  = new DistortedTexture(bmpWidth, bmpHeight, 1);
169
     mTexture  = new DistortedTexture(bmpWidth,bmpHeight);
170 170

  
171 171
     mTexture.setTexture(bitmap);
172 172

  
src/main/java/org/distorted/examples/dynamic/DynamicRenderer.java
58 58
     mPaint.setColor(0xff447da7);
59 59
     mPaint.setStyle(Style.FILL);
60 60
      
61
     mView = v;
61
     mView   = v;
62 62
     mGrid   = new GridFlat(1,1);
63 63
     mQueues = new DistortedEffectQueues();
64 64
     }
......
84 84
     texW = width;
85 85
     texH = height;
86 86

  
87
     mTexture= new DistortedTexture(texW,texH,0);
87
     mTexture= new DistortedTexture(texW,texH);
88 88
     mBitmap = Bitmap.createBitmap(texW,texH, Bitmap.Config.ARGB_8888);
89 89
     mCanvas = new Canvas(mBitmap);
90 90

  
src/main/java/org/distorted/examples/effectqueue/EffectQueueRenderer.java
70 70
    texHeight= BHEI;
71 71

  
72 72
    mGrid    = new GridFlat(80,80*texHeight/texWidth);
73
    mTexture = new DistortedTexture(texWidth,texHeight,0);
73
    mTexture = new DistortedTexture(texWidth,texHeight);
74 74
    mQueues  = new DistortedEffectQueues();
75 75

  
76 76
    mQueues.addEventListener(this);
src/main/java/org/distorted/examples/effects3d/Effects3DActivity.java
411 411
      int h = mBitmap.getHeight();
412 412

  
413 413
      mQueues = new DistortedEffectQueues();
414
      mTexture= new DistortedTexture(w,h,0);
414
      mTexture= new DistortedTexture(w,h);
415 415
      mGrid   = new GridFlat(mNumCols,mNumCols*h/w);
416 416
      setEffectView();
417 417
      }
......
442 442
      str += mShape[i] ? "1" : "0";
443 443

  
444 444
    mQueues = new DistortedEffectQueues();
445
    mTexture= new DistortedTexture(mNumCols,mNumRows,1);
445
    mTexture= new DistortedTexture(mNumCols,mNumRows);
446 446
    mGrid   = new GridCubes(mNumCols, str, false);
447 447

  
448 448
    setEffectView();
......
496 496

  
497 497
  public int getDepth()
498 498
    {
499
    return mTexture==null ? 0: mTexture.getDepth();
499
    return mTexture==null ? 0: mTexture.getDepth(mGrid);
500 500
    }
501 501

  
502 502
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java
75 75
      mObjectTexture     = act.getTexture();
76 76
      mObjectGrid        = act.getGrid();
77 77
      mObjectQueues      = act.getQueues();
78
      mBackgroundTexture = new DistortedTexture(100, 100, 0);
79
      mCenterTexture     = new DistortedTexture(100, 100, 0);
80
      mRegionTexture     = new DistortedTexture(100, 100, 0);
78
      mBackgroundTexture = new DistortedTexture(100,100);
79
      mCenterTexture     = new DistortedTexture(100,100);
80
      mRegionTexture     = new DistortedTexture(100,100);
81 81
      mQuad              = new GridFlat(1,1);
82 82
      mBackgroundQueues  = new DistortedEffectQueues();
83 83
      mCenterQueues      = new DistortedEffectQueues();
......
85 85

  
86 86
      mObjWidth = mObjectTexture.getWidth();
87 87
      mObjHeight= mObjectTexture.getHeight();
88
      mObjDepth = mObjectTexture.getDepth();
88
      mObjDepth = mObjectTexture.getDepth(mObjectGrid);
89 89

  
90 90
      mQuat1 = new Static4D(0,0,0,1);  // unity
91 91
      mQuat2 = new Static4D(0,0,0,1);  // quaternions
src/main/java/org/distorted/examples/fbo/FBORenderer.java
125 125
      int textWidth = bitmap2.getWidth();
126 126
      int textHeight= bitmap2.getHeight();
127 127

  
128
      DistortedTexture lisa = new DistortedTexture(lisaWidth,lisaHeight,0);
129
      DistortedTexture text = new DistortedTexture(textWidth,textHeight,0);
128
      DistortedTexture lisa = new DistortedTexture(lisaWidth,lisaHeight);
129
      DistortedTexture text = new DistortedTexture(textWidth,textHeight);
130 130
      lisa.setTexture(bitmap1);
131 131
      text.setTexture(bitmap2);
132 132
      DistortedEffectQueues textQueues = new DistortedEffectQueues();
src/main/java/org/distorted/examples/flag/FlagRenderer.java
67 67

  
68 68
      mQueues  = new DistortedEffectQueues();
69 69
      mGrid    = new GridCubes(50,30,false);
70
      mTexture = new DistortedTexture(500,300,10);
70
      mTexture = new DistortedTexture(500,300);
71 71

  
72 72
      mObjWidth = mTexture.getWidth();
73 73
      mObjHeight= mTexture.getHeight();
src/main/java/org/distorted/examples/girl/GirlRenderer.java
205 205
      bmpWidth  = bitmap.getWidth();
206 206

  
207 207
      mGrid = new GridFlat(30,30*bmpHeight/bmpWidth);
208
      mTexture = new DistortedTexture(bmpWidth,bmpHeight,0);
208
      mTexture = new DistortedTexture(bmpWidth,bmpHeight);
209 209
      mTexture.setTexture(bitmap);
210 210

  
211 211
      try
src/main/java/org/distorted/examples/listener/ListenerRenderer.java
158 158
      bmpWidth  = bitmap.getWidth();
159 159

  
160 160
      mGrid    = new GridFlat(50,50*bmpHeight/bmpWidth);
161
      mTexture = new DistortedTexture(bmpWidth,bmpHeight,0);
161
      mTexture = new DistortedTexture(bmpWidth,bmpHeight);
162 162
      mTexture.setTexture(bitmap);
163 163

  
164 164
      for(int i=0; i<NUM_BUBBLES; i++) randomizeNewBubble();
src/main/java/org/distorted/examples/matrix3d/Matrix3DActivity.java
71 71

  
72 72
    mQueues = new DistortedEffectQueues();
73 73
    mGrid   = new GridCubes(1,1,false);
74
    mTexture= new DistortedTexture(100,100,100);
74
    mTexture= new DistortedTexture(100,100);
75 75

  
76 76
    setEffectView();
77 77
    }
......
205 205

  
206 206
  public int getDepth()
207 207
    {
208
    return mTexture==null ? 0: mTexture.getDepth();
208
    return mTexture==null ? 0: mTexture.getDepth(mGrid);
209 209
    }
210 210

  
211 211
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/monalisa/MonaLisaRenderer.java
131 131
      bmpWidth  = bitmap.getWidth();
132 132

  
133 133
      mGrid = new GridFlat(9,9*bmpHeight/bmpWidth);
134
      mTexture = new DistortedTexture(bmpWidth,bmpHeight,0);
134
      mTexture = new DistortedTexture(bmpWidth,bmpHeight);
135 135
      mTexture.setTexture(bitmap);
136 136

  
137 137
      try
src/main/java/org/distorted/examples/movingeffects/MovingEffectsRenderer.java
116 116
     texH = height;
117 117

  
118 118
     mGrid    = new GridFlat(80,80*texH/texW);
119
     mTexture = new DistortedTexture(texW,texH,0);
119
     mTexture = new DistortedTexture(texW,texH);
120 120
     mBitmap  = Bitmap.createBitmap(texW,texH, Bitmap.Config.ARGB_8888);
121 121
     mCanvas  = new Canvas(mBitmap);
122 122

  
src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java
62 62
      {     
63 63
      mView = v;
64 64

  
65
      mLeaf = new DistortedTexture(LEAF_SIZE,LEAF_SIZE,1);
65
      mLeaf = new DistortedTexture(LEAF_SIZE,LEAF_SIZE);
66 66
      GridFlat grid = new GridFlat(1,1);
67 67
      DistortedEffectQueues queue = new DistortedEffectQueues();
68 68

  
69 69
      mScreenW = 9*LEAF_SIZE;
70 70
      mScreenH = 9*LEAF_SIZE;
71 71

  
72
      mScreen = new DistortedObjectTree(new DistortedTexture(mScreenW,mScreenH,0), queue, grid);
72
      mScreen = new DistortedObjectTree(new DistortedTexture(mScreenW,mScreenH), queue, grid);
73 73
     
74 74
      Dynamic1D rot = new Dynamic1D(5000,0.0f);
75 75
      rot.setMode(Dynamic1D.MODE_JUMP);
......
90 90
        if( i==0 )
91 91
          {
92 92
          queue = new DistortedEffectQueues();
93
          mCircleNode[i] = new DistortedObjectTree(new DistortedTexture(3*LEAF_SIZE,3*LEAF_SIZE,1), queue, grid);
93
          mCircleNode[i] = new DistortedObjectTree(new DistortedTexture(3*LEAF_SIZE,3*LEAF_SIZE), queue, grid);
94 94
        
95 95
          for(int j=0; j<NUM_LEAVES; j++)
96 96
            {
src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java
207 207
    bmpHeight = bmp.getHeight();
208 208
    bmpWidth  = bmp.getWidth();
209 209

  
210
    mTexture = new DistortedTexture(bmpWidth,bmpHeight,0);
210
    mTexture = new DistortedTexture(bmpWidth,bmpHeight);
211 211
    mTexture.setTexture(bmp);
212 212

  
213 213
    mGrid= new GridFlat(9,9*bmpHeight/bmpWidth);  // more-or-less square Grid with 9 columns.
src/main/java/org/distorted/examples/projection/ProjectionRenderer.java
99 99
      mHeight= height;
100 100

  
101 101
      Paint paint = new Paint();
102
      mTexture    = new DistortedTexture(width,height,0);
102
      mTexture    = new DistortedTexture(width,height);
103 103
      mGrid       = new GridFlat(50,50*height/width);
104 104
      Bitmap bmp  = Bitmap.createBitmap(width,height, Bitmap.Config.ARGB_8888);
105 105
      Canvas bmpCanvas = new Canvas(bmp);
src/main/java/org/distorted/examples/quaternion/QuaternionRenderer.java
61 61
    {
62 62
    mView    = v;
63 63
    mGrid    = new GridCubes(1,1,false);
64
    mTexture = new DistortedTexture(1,1,1);
64
    mTexture = new DistortedTexture(1,1);
65 65
    mQueues  = new DistortedEffectQueues();
66 66
    mRot     = new DynamicQuat();
67 67

  
src/main/java/org/distorted/examples/save/SaveRenderer.java
234 234
    bmpWidth  = bitmap.getWidth();
235 235

  
236 236
    mGrid = new GridFlat(30,30*bmpHeight/bmpWidth);
237
    mGirl = new DistortedTexture(bmpWidth,bmpHeight,0);
237
    mGirl = new DistortedTexture(bmpWidth,bmpHeight);
238 238
    mGirl.setTexture(bitmap);
239 239

  
240 240
    mOffscreen = new DistortedFramebuffer(bmpWidth,bmpHeight);
src/main/java/org/distorted/examples/sink/SinkRenderer.java
131 131
    bmpWidth  = bitmap.getWidth();
132 132

  
133 133
    mGrid    = new GridFlat(30,30*bmpHeight/bmpWidth);
134
    mTexture = new DistortedTexture(bmpWidth,bmpHeight,0);
134
    mTexture = new DistortedTexture(bmpWidth,bmpHeight);
135 135
    mTexture.setTexture(bitmap);
136 136

  
137 137
    try
src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java
111 111
  private DistortedObjectTree mRoot, mBackground;
112 112
  private GridFlat mQuad;
113 113

  
114

  
115 114
///////////////////////////////////////////////////////////////////////////////////////////////////
116 115

  
117 116
  StarWarsRenderer(GLSurfaceView v)
......
172 171

  
173 172
  private void setupScreen(int w, int h)
174 173
    {
175
    mScreenTexture = new DistortedTexture(w,h,0);
174
    mScreenTexture = new DistortedTexture(w,h);
176 175
    mRoot = new DistortedObjectTree(mScreenTexture,mScreenQueue,mQuad);
177 176
      
178
    mCrawlBackgroundTexture = new DistortedTexture(w,(int)(Math.sqrt(3.0)*h),0);
177
    mCrawlBackgroundTexture = new DistortedTexture(w,(int)(Math.sqrt(3.0)*h));
179 178
       
180 179
    int randomA, randomX, randomY, randomTime;
181 180
    float randomS, randomAlpha1, randomAlpha2;
......
257 256
    paint.setTypeface(tf);     
258 257
 
259 258
    ///// create GFFA ///////////////////
260
    mGFFATexture  = new DistortedTexture(GFFA_WIDTH, GFFA_HEIGHT, 0);
259
    mGFFATexture  = new DistortedTexture(GFFA_WIDTH,GFFA_HEIGHT);
261 260
    bitmapGFFA = Bitmap.createBitmap(GFFA_WIDTH,GFFA_HEIGHT,Bitmap.Config.ARGB_8888);
262 261
    bitmapGFFA.eraseColor(0x00000000);
263 262
    Canvas gffaCanvas = new Canvas(bitmapGFFA);
......
270 269
    mGFFATexture.setTexture(bitmapGFFA);
271 270
      
272 271
    ///// create Logo ///////////////////
273
    mLogoTexture  = new DistortedTexture(bitmapLogo.getWidth(),bitmapLogo.getHeight(),0);
272
    mLogoTexture  = new DistortedTexture(bitmapLogo.getWidth(),bitmapLogo.getHeight());
274 273
    mLogoTexture.setTexture(bitmapLogo);
275 274

  
276 275
    ///// create CRAWL //////////////////
277
    mCrawlTexture = new DistortedTexture(CRAWL_WIDTH, CRAWL_HEIGHT, 0);
276
    mCrawlTexture = new DistortedTexture(CRAWL_WIDTH,CRAWL_HEIGHT);
278 277
    bitmapText = Bitmap.createBitmap(CRAWL_WIDTH,CRAWL_HEIGHT,Bitmap.Config.ARGB_8888);
279 278
    bitmapText.eraseColor(0x00000000);
280 279
    Canvas textCanvas = new Canvas(bitmapText);
......
288 287
    mCrawlTexture.setTexture(bitmapText);
289 288
      
290 289
    ///// create Stars ///////////////////
291
    mStarTexture = new DistortedTexture(bitmapStar.getWidth(),bitmapStar.getHeight(),0);
290
    mStarTexture = new DistortedTexture(bitmapStar.getWidth(),bitmapStar.getHeight());
292 291
    mStarTexture.setTexture(bitmapStar);
293 292

  
294 293
    gffaID = mGFFAQueue.getID();
src/main/java/org/distorted/examples/wind/WindRenderer.java
58 58

  
59 59
      mGrid    = new GridCubes(50,30,false);
60 60
      mQueues  = new DistortedEffectQueues();
61
      mTexture = new DistortedTexture(50,30,1);
61
      mTexture = new DistortedTexture(50,30);
62 62
      mEffects = new WindEffectsManager(mTexture);
63 63

  
64 64
      mObjWidth = mTexture.getWidth();

Also available in: Unified diff