Project

General

Profile

« Previous | Next » 

Revision 630cf5ce

Added by Leszek Koltunski about 2 years ago

Bandaged: FactoryBandagedCubit can now create any subsections of any NxMxK cuboid.

View differences:

src/main/java/org/distorted/objectlib/helpers/FactoryBandagedCubit.java
424 424

  
425 425
///////////////////////////////////////////////////////////////////////////////////////////////////
426 426

  
427
  private float[] buildVertices(int[][] wall, int section)
427
  private float[] buildVertices(int[][] wall, int section, float dx, float dy)
428 428
    {
429 429
    int numPoints = buildPoints(wall,section);
430 430
    int numSections = numPoints/2;
......
442 442

  
443 443
    for(int s=0; s<numSections; s++)
444 444
      {
445
      vertices[6*pointer  ] = x-dX;
446
      vertices[6*pointer+1] = dY-y;
445
      vertices[6*pointer  ] = x-dx;
446
      vertices[6*pointer+1] = dy-y;
447 447
      vertices[6*pointer+2] = 0.0f;
448 448

  
449 449
      y = isOddVertical(x,y) ? moveDown(x,y) : moveUp(x,y);
450 450

  
451
      vertices[6*pointer+3] = x-dX;
452
      vertices[6*pointer+4] = dY-y;
451
      vertices[6*pointer+3] = x-dx;
452
      vertices[6*pointer+4] = dy-y;
453 453
      vertices[6*pointer+5] = 0.0f;
454 454

  
455 455
      x = isOddHorizontal(x,y) ? moveRight(x,y) : moveLeft(x,y);
......
519 519
      {
520 520
      case AXIS_XP: for(i=0; i<len; i++)
521 521
                      {
522
                      vertices[3*i+2] = -vertices[3*i];
522
                      vertices[3*i+2] =-vertices[3*i  ];
523 523
                      vertices[3*i  ] = layer-(dX-1.0f);
524 524
                      }
525 525
                    break;
526 526
      case AXIS_XM: for(i=0; i<len; i++)
527 527
                      {
528
                      vertices[3*i+2] = vertices[3*i];
528
                      vertices[3*i+2] = vertices[3*i  ];
529 529
                      vertices[3*i  ] = layer-dX;
530 530
                      }
531 531
                    break;
532 532
      case AXIS_YP: for(i=0; i<len; i++)
533 533
                      {
534
                      vertices[3*i+2] = -vertices[3*i+1];
534
                      vertices[3*i+2] =-vertices[3*i+1];
535 535
                      vertices[3*i+1] = layer-(dY-1.0f);
536 536
                      }
537 537
                    break;
......
548 548
                    break;
549 549
      case AXIS_ZM: for(i=0; i<len; i++)
550 550
                      {
551
                      vertices[3*i  ] = -vertices[3*i];
552 551
                      vertices[3*i+2] = layer-dZ;
552
                      vertices[3*i  ] =-vertices[3*i  ];
553 553
                      }
554 554
                    break;
555 555
      }
......
567 567
    {
568 568
    int sections = markSections(wall);
569 569

  
570
    float dx = (axis==AXIS_XP || axis==AXIS_XM) ? dZ : dX;
571
    float dy = (axis==AXIS_YP || axis==AXIS_YM) ? dZ : dY;
572

  
570 573
    for(int i=0; i<sections; i++)
571 574
      {
572
      float[] vertices = buildVertices(wall,i+1);
575
      float[] vertices = buildVertices(wall,i+1,dx,dy);
576

  
573 577
      rotateAndMoveVertices(vertices,axis,layer);
574 578
      list.add(vertices);
575 579
/*
......
580 584
        {
581 585
        w += ( "["+vertices[3*j]+" "+vertices[3*j+1]+" "+vertices[3*j+2]+"] ");
582 586
        }
583
      android.util.Log.e("D", "axis: "+axis+" layer: "+layer+" vertices after: "+w);
584
 */
587
      android.util.Log.e("D", "1 section: "+i+" axis: "+axis+" layer: "+layer+" vertices after: "+w);
588
*/
585 589
      }
586 590
    }
587 591

  

Also available in: Unified diff