Revision 16b22aab
Added by Leszek Koltunski about 5 years ago
src/main/java/org/distorted/examples/movingglow/MovingGlowRenderer.java | ||
---|---|---|
66 | 66 |
private PostprocessEffectGlow[] mGlow = new PostprocessEffectGlow[NUM_LEAVES]; |
67 | 67 |
private int mRootW, mRootH; |
68 | 68 |
private int mGlowing; |
69 |
private Static3D mMove, mScale;
|
|
69 |
private Static3D mScale; |
|
70 | 70 |
|
71 | 71 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
72 | 72 |
|
... | ... | |
83 | 83 |
|
84 | 84 |
DistortedNode root = new DistortedNode(surface, new DistortedEffects(), mesh); |
85 | 85 |
|
86 |
Static3D moveVector = new Static3D(0.55f*LEAF_SIZE, (mRootH-LEAF_SIZE)/2, 0);
|
|
86 |
Static3D moveVector = new Static3D(-1.45f*LEAF_SIZE, 0, 0);
|
|
87 | 87 |
Static1D chromaLevel= new Static1D(0.5f); |
88 |
Static3D center = new Static3D(mRootW/2, mRootH/2, 0);
|
|
88 |
Static3D center = new Static3D(0,0,0);
|
|
89 | 89 |
Static3D axis = new Static3D(0,0,1); |
90 | 90 |
|
91 | 91 |
MatrixEffectMove leafMove = new MatrixEffectMove(moveVector); |
... | ... | |
101 | 101 |
root.attach(node); |
102 | 102 |
} |
103 | 103 |
|
104 |
mMove = new Static3D(0,0,0); |
|
105 | 104 |
mScale= new Static3D(1,1,1); |
106 | 105 |
|
107 | 106 |
Dynamic1D rot = new Dynamic1D(5000,0.0f); |
... | ... | |
110 | 109 |
rot.add(new Static1D(360)); |
111 | 110 |
|
112 | 111 |
DistortedEffects effects = root.getEffects(); |
113 |
effects.apply(new MatrixEffectMove(mMove)); |
|
114 | 112 |
effects.apply(new MatrixEffectScale(mScale)); |
115 | 113 |
effects.apply( new MatrixEffectRotate(rot, axis, center) ); |
116 | 114 |
|
... | ... | |
176 | 174 |
float qw = (float)width /mRootW; |
177 | 175 |
float qh = (float)height/mRootH; |
178 | 176 |
float factor = 0.9f* (qw<qh ? qw:qh); |
179 |
int w = (int)(factor*mRootW); |
|
180 |
int h = (int)(factor*mRootH); |
|
181 | 177 |
|
182 |
mMove.set((width-w)/2 ,(height-h)/2, 0); |
|
183 | 178 |
mScale.set( factor,factor,factor ); |
184 | 179 |
mScreen.resize(width, height); |
185 | 180 |
} |
Also available in: Unified diff
Fix several more apps for the 'center-of-matrix-effects-in-screen-center' change.