Revision d04a4886
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java | ||
---|---|---|
33 | 33 |
import org.distorted.library.EffectNames; |
34 | 34 |
import org.distorted.library.type.Dynamic1D; |
35 | 35 |
import org.distorted.library.type.Dynamic3D; |
36 |
import org.distorted.library.DistortedObjectTree;
|
|
36 |
import org.distorted.library.DistortedTree; |
|
37 | 37 |
import org.distorted.library.type.Static1D; |
38 | 38 |
import org.distorted.library.type.Static3D; |
39 | 39 |
import org.distorted.library.type.Static4D; |
... | ... | |
41 | 41 |
import org.distorted.library.message.EffectMessage; |
42 | 42 |
import org.distorted.library.Distorted; |
43 | 43 |
import org.distorted.library.DistortedTexture; |
44 |
import org.distorted.library.DistortedEffectQueues;
|
|
44 |
import org.distorted.library.DistortedEffects; |
|
45 | 45 |
|
46 | 46 |
import android.graphics.Bitmap; |
47 | 47 |
import android.graphics.BitmapFactory; |
... | ... | |
104 | 104 |
|
105 | 105 |
private GLSurfaceView mView; |
106 | 106 |
private DistortedTexture mScreenTexture, mGFFATexture, mLogoTexture, mCrawlTexture, mCrawlBackgroundTexture, mStarTexture; |
107 |
private DistortedEffectQueues mScreenEffects, mGFFAEffects, mLogoEffects, mCrawlEffects, mCrawlBackgroundEffects;
|
|
108 |
private DistortedEffectQueues[] mStarQueue;
|
|
109 |
private DistortedObjectTree mRoot, mBackground;
|
|
107 |
private DistortedEffects mScreenEffects, mGFFAEffects, mLogoEffects, mCrawlEffects, mCrawlBackgroundEffects; |
|
108 |
private DistortedEffects[] mStarEffects;
|
|
109 |
private DistortedTree mRoot, mBackground; |
|
110 | 110 |
private DistortedFramebuffer mScreen; |
111 | 111 |
private GridFlat mQuad; |
112 | 112 |
|
... | ... | |
122 | 122 |
|
123 | 123 |
mQuad = new GridFlat(1,1); |
124 | 124 |
|
125 |
mScreenEffects = new DistortedEffectQueues();
|
|
126 |
mGFFAEffects = new DistortedEffectQueues();
|
|
127 |
mLogoEffects = new DistortedEffectQueues();
|
|
128 |
mCrawlEffects = new DistortedEffectQueues();
|
|
129 |
mCrawlBackgroundEffects = new DistortedEffectQueues();
|
|
125 |
mScreenEffects = new DistortedEffects(); |
|
126 |
mGFFAEffects = new DistortedEffects(); |
|
127 |
mLogoEffects = new DistortedEffects(); |
|
128 |
mCrawlEffects = new DistortedEffects(); |
|
129 |
mCrawlBackgroundEffects = new DistortedEffects(); |
|
130 | 130 |
|
131 |
mStarQueue = new DistortedEffectQueues[NUM_STARS];
|
|
132 |
mStarQueue[0] = new DistortedEffectQueues();
|
|
131 |
mStarEffects = new DistortedEffects[NUM_STARS];
|
|
132 |
mStarEffects[0] = new DistortedEffects();
|
|
133 | 133 |
|
134 |
for(int i=1; i<NUM_STARS; i++) mStarQueue[i] = new DistortedEffectQueues(mStarQueue[0],Distorted.CLONE_VERTEX);
|
|
134 |
for(int i=1; i<NUM_STARS; i++) mStarEffects[i] = new DistortedEffects(mStarEffects[0],Distorted.CLONE_VERTEX);
|
|
135 | 135 |
|
136 | 136 |
mScreen = new DistortedFramebuffer(0); |
137 | 137 |
mScreen.setProjection(60.0f, 0.0f, 0.0f); |
... | ... | |
168 | 168 |
mCrawlEffects.abortAllEffects(); |
169 | 169 |
mCrawlBackgroundEffects.abortAllEffects(); |
170 | 170 |
|
171 |
for(int i=0; i<NUM_STARS; i++) mStarQueue[i].abortAllEffects();
|
|
171 |
for(int i=0; i<NUM_STARS; i++) mStarEffects[i].abortAllEffects();
|
|
172 | 172 |
|
173 | 173 |
setupScreen(width,height); |
174 | 174 |
|
... | ... | |
199 | 199 |
private void setupScreen(int w, int h) |
200 | 200 |
{ |
201 | 201 |
mScreenTexture = new DistortedTexture(w,h); |
202 |
mRoot = new DistortedObjectTree(mScreenTexture, mScreenEffects,mQuad);
|
|
202 |
mRoot = new DistortedTree(mScreenTexture, mScreenEffects,mQuad); |
|
203 | 203 |
|
204 | 204 |
mCrawlBackgroundTexture = new DistortedTexture(w,(int)(Math.sqrt(3.0)*h)); |
205 | 205 |
|
... | ... | |
220 | 220 |
randomAlpha2 = 0.8f + 0.2f*mRnd.nextFloat(); |
221 | 221 |
randomTime = 500+mRnd.nextInt(2000); |
222 | 222 |
|
223 |
mStarQueue[i].move( new Static3D(randomX,randomY,0) );
|
|
224 |
mStarQueue[i].scale(randomS);
|
|
225 |
mStarQueue[i].rotate( new Static1D(randomA), axis, center );
|
|
223 |
mStarEffects[i].move( new Static3D(randomX,randomY,0) );
|
|
224 |
mStarEffects[i].scale(randomS);
|
|
225 |
mStarEffects[i].rotate( new Static1D(randomA), axis, center );
|
|
226 | 226 |
|
227 | 227 |
Dynamic1D di = new Dynamic1D(randomTime,0.0f); |
228 | 228 |
di.setNoise(alphaNoise); |
229 | 229 |
di.add(new Static1D(randomAlpha1)); |
230 | 230 |
di.add(new Static1D(randomAlpha2)); |
231 | 231 |
|
232 |
mStarQueue[i].alpha(di);
|
|
232 |
mStarEffects[i].alpha(di);
|
|
233 | 233 |
|
234 |
mRoot.attach(mStarTexture, mStarQueue[i], mQuad);
|
|
234 |
mRoot.attach(mStarTexture, mStarEffects[i], mQuad);
|
|
235 | 235 |
} |
236 | 236 |
|
237 | 237 |
float scale = (0.5f*w/mGFFATexture.getWidth()); |
Also available in: Unified diff
Change of names.