Revision 28f4aba0
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java | ||
---|---|---|
291 | 291 |
|
292 | 292 |
private void createMesh() |
293 | 293 |
{ |
294 |
final float[][] vertices = new float[][] |
|
294 |
int mode = 2; |
|
295 |
float[][] vertices = null; |
|
296 |
int[][] vertIndexes = null; |
|
297 |
float[][] bands = null; |
|
298 |
int[] bandIndexes = null; |
|
299 |
float[][] corners = null; |
|
300 |
int[] cornerIndexes = null; |
|
301 |
|
|
302 |
if( mode==0 ) // CUBE |
|
303 |
{ |
|
304 |
vertices = new float[][] |
|
295 | 305 |
{ |
296 | 306 |
{ 0.5f, 0.5f, 0.5f }, |
297 | 307 |
{ 0.5f, 0.5f,-0.5f }, |
... | ... | |
303 | 313 |
{-0.5f,-0.5f,-0.5f }, |
304 | 314 |
}; |
305 | 315 |
|
306 |
final int[][] vertIndexes = new int[][]
|
|
316 |
vertIndexes = new int[][]
|
|
307 | 317 |
{ |
308 | 318 |
{2,3,1,0}, // counterclockwise! |
309 | 319 |
{7,6,4,5}, |
... | ... | |
313 | 323 |
{3,7,5,1} |
314 | 324 |
}; |
315 | 325 |
|
316 |
final float[][] bands = new float[][]
|
|
326 |
bands = new float[][]
|
|
317 | 327 |
{ |
318 | 328 |
{0.05f,45,0.6f,0.5f,5, 2,2} |
319 | 329 |
}; |
320 | 330 |
|
321 |
final int[] bandIndexes = new int[] { 0,0,0,0,0,0 };
|
|
331 |
bandIndexes = new int[] { 0,0,0,0,0,0 };
|
|
322 | 332 |
|
323 |
final float[][] corners = new float[][]
|
|
333 |
corners = new float[][]
|
|
324 | 334 |
{ |
325 | 335 |
{ 0.01f, 0.10f } |
326 | 336 |
}; |
327 | 337 |
|
328 |
final int[] cornerIndexes = new int[] { 0,0,0,0,0,0,0,0 }; |
|
338 |
cornerIndexes = new int[] { 0,0,0,0,0,0,0,0 }; |
|
339 |
} |
|
340 |
else if( mode==1 ) // TETRAHEDRON |
|
341 |
{ |
|
342 |
vertices = new float[][] |
|
343 |
{ |
|
344 |
{-0.5f, SQ2/4, 0.0f}, |
|
345 |
{ 0.5f, SQ2/4, 0.0f}, |
|
346 |
{ 0.0f,-SQ2/4, 0.5f}, |
|
347 |
{ 0.0f,-SQ2/4,-0.5f} |
|
348 |
}; |
|
349 |
|
|
350 |
vertIndexes = new int[][] |
|
351 |
{ |
|
352 |
{2,1,0}, // counterclockwise! |
|
353 |
{2,3,1}, |
|
354 |
{3,2,0}, |
|
355 |
{3,0,1} |
|
356 |
}; |
|
357 |
|
|
358 |
bands = new float[][] |
|
359 |
{ |
|
360 |
{0.05f,30,0.6f,0.5f,5, 2,2} |
|
361 |
}; |
|
362 |
|
|
363 |
bandIndexes = new int[] { 0,0,0,0 }; |
|
364 |
|
|
365 |
corners = new float[][] |
|
366 |
{ |
|
367 |
{ 0.02f, 0.10f } |
|
368 |
}; |
|
369 |
|
|
370 |
cornerIndexes = new int[] { 0,0,0,0 }; |
|
371 |
} |
|
372 |
else if( mode==2 ) // DINO |
|
373 |
{ |
|
374 |
vertices = new float[][] |
|
375 |
{ |
|
376 |
{-0.5f, 0.0f, 0.0f}, |
|
377 |
{ 0.5f, 0.0f, 0.0f}, |
|
378 |
{ 0.0f,-0.5f, 0.0f}, |
|
379 |
{ 0.0f, 0.0f,-0.5f} |
|
380 |
}; |
|
381 |
|
|
382 |
vertIndexes = new int[][] |
|
383 |
{ |
|
384 |
{2,1,0}, // counterclockwise! |
|
385 |
{2,3,1}, |
|
386 |
{3,2,0}, |
|
387 |
{3,0,1} |
|
388 |
}; |
|
389 |
|
|
390 |
bands = new float[][] |
|
391 |
{ |
|
392 |
{0.028f,30,0.166f,0.8f,7, 2,5}, |
|
393 |
{0.028f,30,0.166f,0.8f,7, 1,2} |
|
394 |
}; |
|
395 |
|
|
396 |
bandIndexes = new int[] { 0,1,1,0 }; |
|
397 |
|
|
398 |
corners = new float[][] |
|
399 |
{ |
|
400 |
{ 0.01f, 0.04f } |
|
401 |
}; |
|
402 |
|
|
403 |
cornerIndexes = new int[] { 0,0,0,0 }; |
|
404 |
} |
|
329 | 405 |
|
330 | 406 |
FactoryCubit factory = FactoryCubit.getInstance(); |
331 | 407 |
mMesh = factory.createRoundedSolid(vertices, vertIndexes, bands, bandIndexes, corners, cornerIndexes); |
Also available in: Unified diff
Face cubit creation: progress: cube & tetrahedron work; dino cubit does not.
Also, the texture is not yet moved inside the (0,1)x(0,1) square.