Project

General

Profile

« Previous | Next » 

Revision 687263cc

Added by Leszek Koltunski about 4 years ago

Move the 'pre-multiply mesh before applying any effects' thing from [(Xsize of texture, Ysize of texture) x Mesh's zFactor] to Effects.setStretch(sx,sy,sz)

View differences:

src/main/java/org/distorted/examples/objecttree/ObjectTreeRenderer.java
78 78
      chromaDyn.add(new Static1D(0.0f));
79 79
      chromaDyn.add(new Static1D(0.8f));
80 80

  
81
      mEffects= new DistortedEffects();
81
      mEffects= new DistortedEffects(1);
82 82
      mEffects.apply(new MatrixEffectScale(mScale));
83 83
      mEffects.apply(new MatrixEffectMove(mMove));
84 84
      mEffects.apply(new FragmentEffectChroma(chromaDyn, new Static3D(0,0,1)));
......
169 169
          } 
170 170
        catch(IOException e) { }
171 171
        }  
172
      
172

  
173
      final int GRID = 20;
174
      final Static4D mapFB = new Static4D(0.0f,0.0f,1.0f     ,1.0f     );
175
      final Static4D mapLR = new Static4D(0.0f,0.0f,1.0f/GRID,1.0f     );
176
      final Static4D mapTB = new Static4D(0.0f,0.0f,1.0f     ,1.0f/GRID);
177

  
173 178
      lisaWidth     = bitmap1.getWidth();
174 179
      lisaHeight    = bitmap1.getHeight();
175 180
      int gridWidth = bitmap2.getWidth();
176 181
      int gridHeight= bitmap2.getHeight();
182
      int gridDepth = gridWidth/GRID;
177 183

  
178
      if( mLisaTexture==null ) mLisaTexture = new DistortedTexture(lisaWidth,lisaHeight);
179
      if( mGridTexture==null ) mGridTexture = new DistortedTexture(gridWidth,gridHeight);
184
      mEffects.setStretch(lisaWidth,lisaHeight,0);
185

  
186
      if( mLisaTexture==null ) mLisaTexture = new DistortedTexture();
187
      if( mGridTexture==null ) mGridTexture = new DistortedTexture();
180 188
      mLisaTexture.setTexture(bitmap1);
181 189
      mGridTexture.setTexture(bitmap2);
182
      DistortedEffects gridEffects = new DistortedEffects();
183 190

  
184
      final int GRID = 20;
185
      final Static4D mapFB = new Static4D(0.0f,0.0f,1.0f     ,1.0f     );
186
      final Static4D mapLR = new Static4D(0.0f,0.0f,1.0f/GRID,1.0f     );
187
      final Static4D mapTB = new Static4D(0.0f,0.0f,1.0f     ,1.0f/GRID);
191
      DistortedEffects gridEffects = new DistortedEffects(gridWidth,gridHeight,gridDepth);
188 192

  
189 193
      if( mMeshRectangles ==null ) mMeshRectangles = new MeshRectangles(1,1);
190 194
      if( mMeshCubes==null) mMeshCubes= new MeshCubes(GRID,GRID,1, mapFB, mapFB, mapLR, mapLR, mapTB, mapTB);
191 195

  
192
      int gridDepth = mGridTexture.getDepth(mMeshCubes);
193

  
194 196
      mRoot = new DistortedNode(mLisaTexture, mEffects, mMeshRectangles);
195 197
      mRoot.attach(mGridTexture,gridEffects,mMeshCubes);
196 198

  

Also available in: Unified diff