Revision 371d99fa
Added by Leszek Koltunski almost 9 years ago
| src/main/java/org/distorted/examples/fbo/FBORenderer.java | ||
|---|---|---|
| 126 | 126 | 
     | 
| 127 | 127 | 
    lisaWidth = bitmap1.getWidth();  | 
| 128 | 128 | 
    lisaHeight = bitmap1.getHeight();  | 
| 129 | 
          int textWidth = bitmap2.getWidth();
   | 
|
| 130 | 
          int textHeight= bitmap2.getHeight();
   | 
|
| 129 | 
          int gridWidth = bitmap2.getWidth();
   | 
|
| 130 | 
          int gridHeight= bitmap2.getHeight();
   | 
|
| 131 | 131 | 
     | 
| 132 | 132 | 
    DistortedTexture lisa = new DistortedTexture(lisaWidth,lisaHeight);  | 
| 133 | 
          DistortedTexture text = new DistortedTexture(textWidth,textHeight);
   | 
|
| 133 | 
          DistortedTexture grid = new DistortedTexture(gridWidth,gridHeight);
   | 
|
| 134 | 134 | 
    lisa.setTexture(bitmap1);  | 
| 135 | 
          text.setTexture(bitmap2);
   | 
|
| 136 | 
          DistortedEffects textEffects = new DistortedEffects();
   | 
|
| 135 | 
          grid.setTexture(bitmap2);
   | 
|
| 136 | 
          DistortedEffects gridEffects = new DistortedEffects();
   | 
|
| 137 | 137 | 
     | 
| 138 | 138 | 
    mEffects.abortAllEffects();  | 
| 139 | 139 | 
     | 
| 140 | 140 | 
    mRoot = new DistortedTree(lisa, mEffects,new MeshFlat(1,1));  | 
| 141 | 
          mRoot.attach(text,textEffects,new MeshCubes(20,5,false));
   | 
|
| 141 | 
          mRoot.attach(grid,gridEffects,new MeshCubes(10,10,false));
   | 
|
| 142 | 142 | 
     | 
| 143 | 
          float factor = lisaWidth/(2.0f*textWidth);
   | 
|
| 143 | 
          float factor = lisaWidth/(2.0f*gridWidth);
   | 
|
| 144 | 144 | 
     | 
| 145 | 
          textEffects.move( new Static3D( (lisaWidth-factor*textWidth)/2,(lisaHeight-factor*textHeight)/2,0) );
   | 
|
| 146 | 
          textEffects.scale(factor);
   | 
|
| 145 | 
          gridEffects.move( new Static3D( (lisaWidth-factor*gridWidth)/2,(lisaHeight-factor*gridHeight)/2,0) );
   | 
|
| 146 | 
          gridEffects.scale(factor);
   | 
|
| 147 | 147 | 
     | 
| 148 | 148 | 
    Dynamic1D rotDyn = new Dynamic1D(12000,0.0f);  | 
| 149 | 149 | 
    rotDyn.add(new Static1D( 0));  | 
| 150 | 150 | 
    rotDyn.add(new Static1D(360));  | 
| 151 | 151 | 
    rotDyn.setMode(Dynamic.MODE_JUMP);  | 
| 152 | 152 | 
     | 
| 153 | 
          textEffects.rotate(rotDyn, new Static3D(1,0,0), new Static3D(textWidth/2,textHeight/2,textHeight/10) );
   | 
|
| 153 | 
          gridEffects.rotate(rotDyn, new Static3D(1,0,0), new Static3D(gridWidth/2,gridHeight/2,gridHeight/10) );
   | 
|
| 154 | 154 | 
     | 
| 155 | 155 | 
    Dynamic1D sinkDyn = new Dynamic1D(3000,0.0f);  | 
| 156 | 156 | 
    sinkDyn.add(new Static1D(1.0f));  | 
| 157 | 157 | 
    sinkDyn.add(new Static1D(0.3f));  | 
| 158 | 158 | 
     | 
| 159 | 
          textEffects.sink(sinkDyn, new Static3D(textWidth/2,textHeight/2, 0));
   | 
|
| 159 | 
          gridEffects.sink(sinkDyn, new Static3D(gridWidth/2,gridHeight/2, 0));
   | 
|
| 160 | 160 | 
     | 
| 161 | 161 | 
    Dynamic1D chromaDyn = new Dynamic1D(5000,0.0f);  | 
| 162 | 162 | 
    chromaDyn.add(new Static1D(0.0f));  | 
Also available in: Unified diff
Minor