Revision c31aa527
Added by Leszek Koltunski 4 months ago
src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java | ||
---|---|---|
28 | 28 |
|
29 | 29 |
import org.distorted.examples.R; |
30 | 30 |
import org.distorted.library.effect.Effect; |
31 |
import org.distorted.library.effect.EffectName; |
|
31 | 32 |
import org.distorted.library.effect.EffectType; |
32 | 33 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
33 | 34 |
import org.distorted.library.effect.MatrixEffectScale; |
... | ... | |
48 | 49 |
import org.distorted.objectlib.helpers.FactoryCubit; |
49 | 50 |
import org.distorted.objectlib.helpers.ObjectFaceShape; |
50 | 51 |
import org.distorted.objectlib.helpers.ObjectShape; |
52 |
import org.distorted.objectlib.helpers.ObjectVertexEffects; |
|
51 | 53 |
|
52 | 54 |
import java.io.DataInputStream; |
53 | 55 |
import java.io.IOException; |
... | ... | |
390 | 392 |
|
391 | 393 |
private float[][] createV() |
392 | 394 |
{ |
395 |
final float X = 0.7f; |
|
396 |
final float Y = 0.7f; |
|
397 |
final float Z = 1.0f; |
|
398 |
|
|
393 | 399 |
return new float[][] |
394 |
{ |
|
395 |
{-1.6281155f, -0.2072947f, -3.1770508f }, |
|
396 |
{ 1.2135257f, -1.9635254f, -3.1770515f }, |
|
397 |
{-0.5427052f, -1.9635254f, -0.33541024f}, |
|
398 |
{-1.9635254f, -0.7499998f, -1.2135254f }, |
|
399 |
{-0.75000024f, 1.2135258f, -1.9635254f }, |
|
400 |
{ 1.2135253f, 0.87811553f,-1.4208202f }, |
|
401 |
{-1.2135255f, 0.4635256f, -0.7499998f }, |
|
402 |
{ 1.2135255f, -1.9635254f, -3.1770515f }, |
|
403 |
{ 2.9697561f, -1.9635254f, -0.33541024f}, |
|
404 |
{ 1.2135255f, -1.9635254f, 0.75f }, |
|
405 |
{ 8.940697E-8f, 1.7881393E-7f, 0.0f }, |
|
406 |
{ 1.2135255f, -0.4635254f, 0.75f }, |
|
407 |
{ 0.0f, 0.0f, 0.0f }, |
|
408 |
{ 1.2135255f, 0.87811553f, -1.4208202f }, |
|
409 |
{ 2.427051f, 0.0f, 0.0f } |
|
410 |
|
|
411 |
}; |
|
400 |
{ |
|
401 |
{-X,-Y,-Z}, |
|
402 |
{+X,-Y,-Z}, |
|
403 |
{+X,+Y,-Z}, |
|
404 |
{-X,-Y,+Z}, |
|
405 |
{+X,-Y,+Z}, |
|
406 |
{+X,+Y,+Z}, |
|
407 |
}; |
|
412 | 408 |
} |
413 | 409 |
|
414 | 410 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
416 | 412 |
private int[][][] createVI() |
417 | 413 |
{ |
418 | 414 |
return new int[][][] |
419 |
{ |
|
420 |
{{ 0, 1, 2, 3 }}, |
|
421 |
{{ 4, 5, 1, 0 }}, |
|
422 |
{{ 0, 3, 6, 4 }}, |
|
423 |
{{ 2, 7, 8, 9 }}, |
|
424 |
{{ 3, 2, 10,6 }, { 2, 9, 11, 12 }}, |
|
425 |
{{13, 14, 8, 7}}, |
|
426 |
{{ 6, 10, 5, 4}, { 11, 14, 13, 12}}, |
|
427 |
{{ 9, 8, 14, 11}} |
|
428 |
}; |
|
415 |
{ |
|
416 |
{{2,1,0}}, |
|
417 |
{{3,4,5}}, |
|
418 |
{{0,3,5,2}}, |
|
419 |
{{0,1,4,3}}, |
|
420 |
{{5,4,1,2}} |
|
421 |
}; |
|
422 |
} |
|
423 |
|
|
424 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
425 |
// String[] names, float[][] variables, float[][] centers, float[][] regions, boolean[] use |
|
426 |
|
|
427 |
private ObjectVertexEffects createEffects() |
|
428 |
{ |
|
429 |
final float R = 0.7f; |
|
430 |
|
|
431 |
String[] names = { EffectName.PIPE.name() }; |
|
432 |
float[][] vars = { {0.3f,0,0,1,2*R} }; |
|
433 |
float[][] cens = { {-R,R,0} }; |
|
434 |
float[][] regs = { {0,0,0,0} }; |
|
435 |
boolean[] use = { true }; |
|
436 |
|
|
437 |
return new ObjectVertexEffects(names,vars,cens,regs,use); |
|
429 | 438 |
} |
430 | 439 |
|
431 | 440 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
450 | 459 |
|
451 | 460 |
ObjectShape shape = new ObjectShape(vertices, vertIndices); |
452 | 461 |
ObjectFaceShape face = new ObjectFaceShape(bands, bandIndices, null); |
462 |
ObjectVertexEffects effects = createEffects(); |
|
453 | 463 |
|
454 | 464 |
int[] outer = new int[numFaces]; |
455 | 465 |
|
456 | 466 |
FactoryCubit factory = FactoryCubit.getInstance(); |
457 | 467 |
factory.clear(); |
458 | 468 |
factory.createNewFaceTransform(shape,outer); |
459 |
mMesh = factory.createRoundedSolid(shape,face,null,numFaces);
|
|
469 |
mMesh = factory.createRoundedSolid(shape,face,effects,numFaces);
|
|
460 | 470 |
|
461 | 471 |
int numEff = mMesh.getNumEffComponents(); |
462 | 472 |
for(int i=0; i<numEff; i++) mMesh.setEffectAssociation(i, 0, i); |
Also available in: Unified diff
add a test for a solid created with a VertexEffectPipe effect for DistortedExamples.