Revision ed89e05e
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/examples/glow/GlowRenderer.java | ||
---|---|---|
32 | 32 |
import org.distorted.library.effect.PostprocessEffectGlow; |
33 | 33 |
import org.distorted.library.main.Distorted; |
34 | 34 |
import org.distorted.library.main.DistortedEffects; |
35 |
import org.distorted.library.main.DistortedEffectsPostprocess; |
|
36 | 35 |
import org.distorted.library.main.DistortedNode; |
37 | 36 |
import org.distorted.library.main.DistortedScreen; |
38 | 37 |
import org.distorted.library.main.DistortedTexture; |
... | ... | |
63 | 62 |
private GLSurfaceView mView; |
64 | 63 |
private DistortedTexture mLeaf; |
65 | 64 |
private DistortedScreen mScreen; |
66 |
private DistortedEffectsPostprocess[] mLeafGlow = new DistortedEffectsPostprocess[NUM_LEAVES];
|
|
65 |
private DistortedEffects[] mLeafEffects = new DistortedEffects[NUM_LEAVES];
|
|
67 | 66 |
private PostprocessEffectGlow[] mGlow = new PostprocessEffectGlow[NUM_LEAVES]; |
68 | 67 |
private int mRootW, mRootH; |
69 | 68 |
private int mGlowing; |
... | ... | |
81 | 80 |
mLeaf = new DistortedTexture(LEAF_SIZE,LEAF_SIZE); |
82 | 81 |
DistortedTexture surface = new DistortedTexture(mRootW,mRootH); |
83 | 82 |
MeshObject mesh = new MeshFlat(1,1); |
84 |
DistortedEffects[] leafEffects = new DistortedEffects[NUM_LEAVES]; |
|
85 | 83 |
|
86 | 84 |
DistortedNode root = new DistortedNode(surface, new DistortedEffects(), mesh); |
87 | 85 |
|
... | ... | |
94 | 92 |
|
95 | 93 |
for(int j=0; j<NUM_LEAVES; j++) |
96 | 94 |
{ |
97 |
mLeafGlow[j] = new DistortedEffectsPostprocess(); |
|
98 |
mLeafGlow[j].registerForMessages(this); |
|
99 |
|
|
100 |
leafEffects[j] = new DistortedEffects(); |
|
101 |
leafEffects[j].apply( new MatrixEffectRotate(new Static1D(j*(360/NUM_LEAVES)), axis, center) ); |
|
102 |
leafEffects[j].apply(leafMove); |
|
103 |
leafEffects[j].apply( new FragmentEffectChroma(chromaLevel, new Static3D(colors[3*j],colors[3*j+1], colors[3*j+2])) ); |
|
104 |
DistortedNode node = new DistortedNode( mLeaf, leafEffects[j], mesh); |
|
105 |
node.setPostprocessEffects(mLeafGlow[j]); |
|
95 |
mLeafEffects[j] = new DistortedEffects(); |
|
96 |
mLeafEffects[j].registerForMessages(this); |
|
97 |
mLeafEffects[j].apply( new MatrixEffectRotate(new Static1D(j*(360/NUM_LEAVES)), axis, center) ); |
|
98 |
mLeafEffects[j].apply(leafMove); |
|
99 |
mLeafEffects[j].apply( new FragmentEffectChroma(chromaLevel, new Static3D(colors[3*j],colors[3*j+1], colors[3*j+2])) ); |
|
100 |
DistortedNode node = new DistortedNode( mLeaf, mLeafEffects[j], mesh); |
|
106 | 101 |
root.attach(node); |
107 | 102 |
} |
108 | 103 |
|
... | ... | |
119 | 114 |
effects.apply(new MatrixEffectScale(mScale)); |
120 | 115 |
effects.apply( new MatrixEffectRotate(rot, axis, center) ); |
121 | 116 |
|
122 |
Dynamic1D radius = new Dynamic1D(5000,1.0f); |
|
123 |
Static1D startR = new Static1D( 0); |
|
124 |
Static1D endR = new Static1D(50); |
|
125 |
radius.add(startR); |
|
126 |
radius.add(endR); |
|
117 |
Dynamic1D radiusDyn = new Dynamic1D(5000,1.0f); |
|
118 |
radiusDyn.add(new Static1D( 0)); |
|
119 |
radiusDyn.add(new Static1D(50)); |
|
127 | 120 |
|
128 | 121 |
for(int leaf=0; leaf<NUM_LEAVES; leaf++) |
129 | 122 |
{ |
... | ... | |
133 | 126 |
color.add(startC); |
134 | 127 |
color.add(endC); |
135 | 128 |
|
136 |
mGlow[leaf] = new PostprocessEffectGlow(radius,color); |
|
129 |
mGlow[leaf] = new PostprocessEffectGlow(radiusDyn,color);
|
|
137 | 130 |
} |
138 | 131 |
|
139 | 132 |
makeGlow(0); |
... | ... | |
149 | 142 |
//android.util.Log.e("glow", "glowing: "+leaf); |
150 | 143 |
|
151 | 144 |
mGlowing = leaf; |
152 |
mLeafGlow[leaf].apply(mGlow[leaf]);
|
|
145 |
mLeafEffects[leaf].apply(mGlow[leaf]);
|
|
153 | 146 |
} |
154 | 147 |
|
155 | 148 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Remove old facility to correct Postprocessing buckets on new Postporcessing effects.
New facility will follow shortly....