Revision 0ba5de00
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/examples/stencil/StencilRenderer.java | ||
---|---|---|
136 | 136 |
|
137 | 137 |
setScreen(true); |
138 | 138 |
|
139 |
float cw = cube.getStretchX(); |
|
140 |
float ch = cube.getStretchY(); |
|
141 |
|
|
142 |
float fw = quaFlo.getStretchX(); |
|
143 |
float fh = quaFlo.getStretchY(); |
|
144 |
|
|
145 | 139 |
Static3D axisX = new Static3D(1,0,0); |
146 | 140 |
Static3D axisZ = new Static3D(0,0,1); |
147 | 141 |
|
... | ... | |
153 | 147 |
Static3D rotCenter = new Static3D(0,0,0); |
154 | 148 |
|
155 | 149 |
MatrixEffectScale scale = new MatrixEffectScale(mScale); |
156 |
MatrixEffectMove move1 = new MatrixEffectMove( new Static3D( 0, 0, cw/2) );
|
|
150 |
MatrixEffectMove move1 = new MatrixEffectMove( new Static3D( 0, 0, cube.getStretchX()/2) );
|
|
157 | 151 |
MatrixEffectRotate rotaX = new MatrixEffectRotate(new Static1D(-60.0f), axisX, rotCenter); |
158 | 152 |
MatrixEffectRotate rotaZ = new MatrixEffectRotate(rotDyn, axisZ, rotCenter); |
159 | 153 |
|
160 | 154 |
///////////////////////////////////////////////////////////////////////////////////////////////////// |
161 | 155 |
// First move the cube and its reflection to the middle of the floor. Then scale the floor, the cube |
162 |
// and its reflection. Then keep rotating all along the Z axis, tilt all, and finally move all to the |
|
163 |
// middle of the screen. |
|
156 |
// and its reflection. Then keep rotating all along the Z axis, tilt all. |
|
164 | 157 |
///////////////////////////////////////////////////////////////////////////////////////////////////// |
165 | 158 |
// The cube |
166 |
cube1Effects.apply( rotaX ); |
|
167 |
cube1Effects.apply( rotaZ ); |
|
168 |
cube1Effects.apply( scale ); |
|
169 | 159 |
cube1Effects.apply( move1 ); |
160 |
cube1Effects.apply( scale ); |
|
161 |
cube1Effects.apply( rotaZ ); |
|
162 |
cube1Effects.apply( rotaX ); |
|
170 | 163 |
///////////////////////////////////////////////////////////////////////////////////////////////////// |
171 | 164 |
// Floor |
172 |
floorEffects.apply( rotaX ); |
|
173 |
floorEffects.apply( rotaZ ); |
|
174 | 165 |
floorEffects.apply( scale ); |
166 |
floorEffects.apply( rotaZ ); |
|
167 |
floorEffects.apply( rotaX ); |
|
175 | 168 |
///////////////////////////////////////////////////////////////////////////////////////////////////// |
176 | 169 |
// Reflection |
177 |
cube2Effects.apply( rotaX ); |
|
178 |
cube2Effects.apply( rotaZ ); |
|
179 |
cube2Effects.apply( scale ); |
|
180 |
cube2Effects.apply( new MatrixEffectScale(new Static3D(1,1,-1)) ); |
|
181 | 170 |
cube2Effects.apply( move1 ); |
182 | 171 |
cube2Effects.apply( new MatrixEffectScale(new Static3D(1,1,-1)) ); |
172 |
cube2Effects.apply( scale ); |
|
173 |
cube2Effects.apply( rotaZ ); |
|
174 |
cube2Effects.apply( rotaX ); |
|
183 | 175 |
cube2Effects.apply( new FragmentEffectBrightness(new Static1D(0.5f)) ); |
184 | 176 |
|
185 | 177 |
///////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Fixes for the merge.