Revision 140f2c4e
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java | ||
---|---|---|
31 | 31 |
import org.distorted.library.effect.EffectType; |
32 | 32 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
33 | 33 |
import org.distorted.library.effect.MatrixEffectScale; |
34 |
import org.distorted.library.effect.VertexEffect; |
|
35 |
import org.distorted.library.effect.VertexEffectDeform; |
|
36 | 34 |
import org.distorted.library.effect.VertexEffectDisappear; |
37 |
import org.distorted.library.effect.VertexEffectRotate; |
|
38 | 35 |
import org.distorted.library.main.DistortedEffects; |
39 | 36 |
import org.distorted.library.main.DistortedLibrary; |
40 | 37 |
import org.distorted.library.main.DistortedScreen; |
... | ... | |
54 | 51 |
import javax.microedition.khronos.opengles.GL10; |
55 | 52 |
|
56 | 53 |
import static org.distorted.examples.meshfile.MeshFileActivity.PROCEDURAL; |
57 |
import static org.distorted.examples.meshfile.FactoryCubit.COS18; |
|
58 |
import static org.distorted.examples.meshfile.FactoryCubit.SIN18; |
|
59 | 54 |
|
60 | 55 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
61 | 56 |
|
... | ... | |
65 | 60 |
private static final float SQ3 = (float)Math.sqrt(3); |
66 | 61 |
private final float DEFAULT_SCALE = 0.3f; |
67 | 62 |
|
68 |
private GLSurfaceView mView; |
|
63 |
private final GLSurfaceView mView;
|
|
69 | 64 |
private DistortedTexture mTexture; |
70 |
private DistortedScreen mScreen; |
|
71 |
private DistortedEffects mEffects; |
|
72 |
private Static3D mScale; |
|
65 |
private final DistortedScreen mScreen;
|
|
66 |
private final DistortedEffects mEffects;
|
|
67 |
private final Static3D mScale;
|
|
73 | 68 |
private long mTime; |
74 | 69 |
private float mCurrentScale; |
75 | 70 |
private MeshBase mMesh; |
... | ... | |
258 | 253 |
|
259 | 254 |
private MeshBase createStaticMesh() |
260 | 255 |
{ |
261 |
/* |
|
262 |
MeshBase triangle = new MeshTriangle(5); |
|
263 |
|
|
264 |
VertexEffectMove move = new VertexEffectMove( new Static3D(1,0,0) ); |
|
265 |
triangle.apply(move); |
|
266 |
|
|
267 |
triangle.mergeEffComponents(); |
|
268 |
|
|
269 |
VertexEffectScale scale = new VertexEffectScale( new Static3D(2,1,1) ); |
|
270 |
triangle.apply(scale); |
|
271 |
|
|
272 |
return triangle; |
|
273 |
*/ |
|
274 |
/* |
|
275 |
final float DIST = 0.2f; |
|
276 |
float[] vertices = new float[6]; |
|
277 |
|
|
278 |
vertices[0] = 0.5f-DIST; |
|
279 |
vertices[1] = -0.5f-DIST; |
|
280 |
|
|
281 |
vertices[2] = 0.5f-DIST; |
|
282 |
vertices[3] = 0.5f-DIST; |
|
283 |
|
|
284 |
vertices[4] = -0.5f-DIST; |
|
285 |
vertices[5] = 0.5f-DIST; |
|
286 |
|
|
287 |
float[] bands0 = new float[] {1.0f, 0.0f, 0.5f, 0.03f, 0.0f, 0.05f}; |
|
288 |
|
|
289 |
MeshBase mesh = new MeshPolygon(vertices,bands0,0,0); |
|
290 |
mesh.setShowNormals(true); |
|
291 |
|
|
292 |
return mesh; |
|
293 |
*/ |
|
294 |
|
|
295 | 256 |
final float IVY_D = 0.10f; |
296 | 257 |
final int IVY_N = 8; |
297 | 258 |
|
... | ... | |
344 | 305 |
|
345 | 306 |
final int[][] vertIndexes = new int[][] |
346 | 307 |
{ |
347 |
{0,1,3,2},
|
|
348 |
{5,4,6,7},
|
|
349 |
{5,1,0,4},
|
|
350 |
{6,2,3,7},
|
|
351 |
{4,0,2,6},
|
|
352 |
{1,5,7,3}
|
|
308 |
{2,3,1,0}, // counterclockwise!
|
|
309 |
{7,6,4,5},
|
|
310 |
{4,0,1,5},
|
|
311 |
{7,3,2,6},
|
|
312 |
{6,2,0,4},
|
|
313 |
{3,7,5,1}
|
|
353 | 314 |
}; |
354 | 315 |
|
355 | 316 |
final float[][] bands = new float[][] |
356 | 317 |
{ |
357 |
{0.048f,35,0.5f,0.7f,5, 2,2}
|
|
318 |
{0.05f,45,0.6f,0.5f,5, 2,2}
|
|
358 | 319 |
}; |
359 | 320 |
|
360 | 321 |
final int[] bandIndexes = new int[] { 0,0,0,0,0,0 }; |
Also available in: Unified diff
Face cubit creation: progress, a cube renders correctly :)