Project

General

Profile

« Previous | Next » 

Revision 277eddbb

Added by Leszek Koltunski almost 4 years ago

Remove the MeshBase.{set/get}Stretch API altogether.

View differences:

src/main/java/org/distorted/library/mesh/MeshBase.java
514 514
     {
515 515
     return (component>=0 && component<mComponent.size()) ? mComponent.get(component).mTextureMap : null;
516 516
     }
517

  
518
///////////////////////////////////////////////////////////////////////////////////////////////////
519
/**
520
 * Sometimes we want to display a Mesh on a rectangular screen. Then we need to stretch it by
521
 * different factors in x and y (or z) directions. If we also wanted do display some vertex effects
522
 * done on this mesh, let's say a bulge done by a Distort effect, and wanted the bulge to be round,
523
 * (i.e the same in x and y directions) then doing so without this method would be impossible.
524
 *
525
 * This sets 'stretch' factors in each 3 dimensions. All vertices of this Mesh will be premultiplied
526
 * by those factors in the very first line of the Vertex Shader, before any Effects are done on it.
527
 * Using this we can thus pre-stretch the mesh to aspect ratio equal to the surface we eventually
528
 * want to display the Mesh on, and this way we can achieve a round Distort bulge!
529
 *
530
 * This could also be used to pre-stretch a Rectangles Mesh to a size equal (in pixels) to the bitmap
531
 * this mesh is textured with - and this lets us work with all Effects in natural, pixel units.
532
 *
533
 * @param sx stretch factor in x.
534
 * @param sy stretch factor in y.
535
 * @param sz stretch factor in z.
536
 */
537
   public void setStretch(float sx, float sy, float sz)
538
     {
539
     mStretchX = sx;
540
     mStretchY = sy;
541
     mStretchZ = sz;
542
     }
543

  
544
///////////////////////////////////////////////////////////////////////////////////////////////////
545
/**
546
 * Returns the x-factor set by setStretch().
547
 */
548
   public float getStretchX()
549
     {
550
     return mStretchX;
551
     }
552

  
553
///////////////////////////////////////////////////////////////////////////////////////////////////
554
/**
555
 * Returns the y-factor set by setStretch().
556
 */
557
   public float getStretchY()
558
     {
559
     return mStretchY;
560
     }
561

  
562
///////////////////////////////////////////////////////////////////////////////////////////////////
563
/**
564
 * Returns the z-factor set by setStretch().
565
 */
566
   public float getStretchZ()
567
     {
568
     return mStretchZ;
569
     }
570 517
   }
571 518

  
572 519

  

Also available in: Unified diff