Project

General

Profile

« Previous | Next » 

Revision 5b4a2d76

Added by Leszek Koltunski about 5 years ago

1) new 'Rubik' app (skeleton)
2) MeshCubes: add support for custom texture mappings on each side (Rubik needs that!)

View differences:

src/main/java/org/distorted/examples/objecttree/ObjectTreeRenderer.java
44 44
import org.distorted.library.type.Dynamic1D;
45 45
import org.distorted.library.type.Static1D;
46 46
import org.distorted.library.type.Static3D;
47
import org.distorted.library.type.Static4D;
47 48

  
48 49
import android.graphics.Bitmap;
49 50
import android.graphics.BitmapFactory;
......
181 182
      DistortedEffects gridEffects = new DistortedEffects();
182 183

  
183 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);
184 188

  
185 189
      if( mMeshFlat==null ) mMeshFlat = new MeshFlat(1,1);
186
      if( mMeshCubes==null) mMeshCubes= new MeshCubes(GRID,GRID,1);
190
      if( mMeshCubes==null) mMeshCubes= new MeshCubes(GRID,GRID,1, mapFB, mapFB, mapLR, mapLR, mapTB, mapTB);
191

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

  
188 194
      mRoot = new DistortedNode(mLisaTexture, mEffects, mMeshFlat);
189 195
      mRoot.attach(mGridTexture,gridEffects,mMeshCubes);
......
209 215
      Dynamic1D sinkDyn = new Dynamic1D(3000,0.0f);
210 216
      sinkDyn.add(new Static1D(1.0f));
211 217
      sinkDyn.add(new Static1D(0.3f));
212
      VertexEffectSink sink = new VertexEffectSink(sinkDyn, new Static3D(gridWidth/2,gridHeight/2, 0));
218
      VertexEffectSink sink = new VertexEffectSink(sinkDyn, new Static3D(gridWidth/2.0f, gridHeight/2.0f, gridDepth/2.0f) );
213 219
      gridEffects.apply(sink);
214 220

  
215 221
      VertexEffectSink.enable();

Also available in: Unified diff