Revision 3a4f3ae2
Added by Leszek Koltunski almost 7 years ago
src/main/java/org/distorted/examples/glow/GlowRenderer.java | ||
---|---|---|
54 | 54 |
private int mRootW, mRootH; |
55 | 55 |
private Static3D mMove, mScale; |
56 | 56 |
private Static1D mRadius; |
57 |
private Static4D mColor; |
|
57 | 58 |
|
58 | 59 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
59 | 60 |
|
... | ... | |
68 | 69 |
mScale = new Static3D(1,1,1); |
69 | 70 |
mRadius= new Static1D(25); |
70 | 71 |
|
71 |
Static4D color = new Static4D(1.0f,1.0f,0.0f,0.5f); // half-transparent yellow
|
|
72 |
mColor = new Static4D(1.0f,1.0f,0.0f,0.5f); // half-transparent yellow
|
|
72 | 73 |
|
73 | 74 |
DistortedEffects effects = new DistortedEffects(); |
74 | 75 |
effects.apply(new MatrixEffectMove(mMove)); |
75 | 76 |
effects.apply(new MatrixEffectScale(mScale)); |
76 |
effects.apply(new PostprocessEffectGlow(mRadius,color));
|
|
77 |
effects.apply(new PostprocessEffectGlow(mRadius,mColor));
|
|
77 | 78 |
|
78 | 79 |
mScreen = new DistortedScreen(); |
79 | 80 |
mScreen.attach(mLeaf, effects, new MeshFlat(1,1) ); |
... | ... | |
81 | 82 |
|
82 | 83 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
83 | 84 |
|
84 |
int setGlow(int glow) |
|
85 |
int setGlowRadius(int glow)
|
|
85 | 86 |
{ |
86 | 87 |
int radius = glow/2; |
87 | 88 |
mRadius.set(radius); |
88 | 89 |
return radius; |
89 | 90 |
} |
90 | 91 |
|
92 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
93 |
|
|
94 |
float setGlowAlpha(float glow) |
|
95 |
{ |
|
96 |
float alpha = glow/100.0f; |
|
97 |
mColor.set4(alpha); |
|
98 |
return alpha; |
|
99 |
} |
|
100 |
|
|
91 | 101 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
92 | 102 |
|
93 | 103 |
public void onDrawFrame(GL10 glUnused) |
Also available in: Unified diff
Improve 'Glow' app.