Revision d04a4886
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
import org.distorted.examples.R; |
29 | 29 |
|
30 |
import org.distorted.library.DistortedEffects; |
|
30 | 31 |
import org.distorted.library.DistortedFramebuffer; |
31 |
import org.distorted.library.DistortedObjectTree;
|
|
32 |
import org.distorted.library.DistortedTree; |
|
32 | 33 |
import org.distorted.library.EffectTypes; |
33 | 34 |
import org.distorted.library.type.Dynamic1D; |
34 | 35 |
import org.distorted.library.type.Static3D; |
35 | 36 |
import org.distorted.library.type.Static1D; |
36 | 37 |
import org.distorted.library.Distorted; |
37 | 38 |
import org.distorted.library.GridFlat; |
38 |
import org.distorted.library.DistortedEffectQueues; |
|
39 | 39 |
import org.distorted.library.DistortedTexture; |
40 | 40 |
|
41 | 41 |
import android.graphics.Bitmap; |
... | ... | |
52 | 52 |
private static final int NUM_LEAVES = 8; |
53 | 53 |
|
54 | 54 |
private GLSurfaceView mView; |
55 |
private DistortedObjectTree mRoot;
|
|
55 |
private DistortedTree mRoot; |
|
56 | 56 |
private DistortedTexture mLeaf; |
57 | 57 |
private DistortedFramebuffer mScreen; |
58 | 58 |
private int mScreenW, mScreenH; |
... | ... | |
65 | 65 |
|
66 | 66 |
mLeaf = new DistortedTexture(LEAF_SIZE,LEAF_SIZE); |
67 | 67 |
GridFlat grid = new GridFlat(1,1); |
68 |
DistortedEffectQueues effects = new DistortedEffectQueues();
|
|
68 |
DistortedEffects effects = new DistortedEffects();
|
|
69 | 69 |
|
70 | 70 |
mScreenW = 9*LEAF_SIZE; |
71 | 71 |
mScreenH = 9*LEAF_SIZE; |
72 |
mRoot = new DistortedObjectTree(new DistortedTexture(mScreenW,mScreenH), effects, grid);
|
|
72 |
mRoot = new DistortedTree(new DistortedTexture(mScreenW,mScreenH), effects, grid); |
|
73 | 73 |
|
74 | 74 |
Dynamic1D rot = new Dynamic1D(5000,0.0f); |
75 | 75 |
rot.setMode(Dynamic1D.MODE_JUMP); |
76 | 76 |
rot.add(new Static1D( 0)); |
77 | 77 |
rot.add(new Static1D(360)); |
78 | 78 |
|
79 |
DistortedObjectTree[] mCircleNode = new DistortedObjectTree[NUM_CIRCLES];
|
|
79 |
DistortedTree[] mCircleNode = new DistortedTree[NUM_CIRCLES];
|
|
80 | 80 |
|
81 | 81 |
int[] colors = new int[] {0,0,1, 0,0,0, 1,0,0, 1,1,0, 0,1,0}; // blue, black, red, yellow, green |
82 | 82 |
int[] positions = new int[] {0,2*LEAF_SIZE, 3*LEAF_SIZE,2*LEAF_SIZE, 6*LEAF_SIZE,2*LEAF_SIZE, 3*LEAF_SIZE/2,9*LEAF_SIZE/2, 9*LEAF_SIZE/2,9*LEAF_SIZE/2}; |
... | ... | |
89 | 89 |
{ |
90 | 90 |
if( i<=1 ) |
91 | 91 |
{ |
92 |
effects = new DistortedEffectQueues();
|
|
93 |
mCircleNode[i] = new DistortedObjectTree(new DistortedTexture(3*LEAF_SIZE,3*LEAF_SIZE), effects, grid);
|
|
92 |
effects = new DistortedEffects(); |
|
93 |
mCircleNode[i] = new DistortedTree(new DistortedTexture(3*LEAF_SIZE,3*LEAF_SIZE), effects, grid); |
|
94 | 94 |
|
95 | 95 |
for(int j=0; j<NUM_LEAVES-i; j++) |
96 | 96 |
{ |
97 |
effects = new DistortedEffectQueues();
|
|
97 |
effects = new DistortedEffects(); |
|
98 | 98 |
mCircleNode[i].attach(mLeaf, effects, grid); |
99 | 99 |
effects.rotate( new Static1D(j*(360/NUM_LEAVES)), axis, center ); |
100 | 100 |
effects.move(moveVector); |
... | ... | |
102 | 102 |
} |
103 | 103 |
else |
104 | 104 |
{ |
105 |
mCircleNode[i] = new DistortedObjectTree(mCircleNode[0], Distorted.CLONE_BITMAP|Distorted.CLONE_CHILDREN);
|
|
105 |
mCircleNode[i] = new DistortedTree(mCircleNode[0], Distorted.CLONE_BITMAP|Distorted.CLONE_CHILDREN); |
|
106 | 106 |
} |
107 | 107 |
|
108 | 108 |
mRoot.attach(mCircleNode[i]); |
109 |
effects = mCircleNode[i].getQueues();
|
|
109 |
effects = mCircleNode[i].getEffects();
|
|
110 | 110 |
effects.move( new Static3D(positions[2*i], positions[2*i+1], 0) ); |
111 | 111 |
effects.rotate( rot, axis, center ); |
112 | 112 |
effects.chroma( new Static1D(0.5f), new Static3D(colors[3*i],colors[3*i+1], colors[3*i+2]) ); |
... | ... | |
127 | 127 |
|
128 | 128 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
129 | 129 |
{ |
130 |
DistortedEffectQueues effects = mRoot.getQueues();
|
|
130 |
DistortedEffects effects = mRoot.getEffects();
|
|
131 | 131 |
|
132 | 132 |
effects.abortEffects(EffectTypes.MATRIX); |
133 | 133 |
|
Also available in: Unified diff
Change of names.