Project

General

Profile

« Previous | Next » 

Revision dbe3079d

Added by Leszek Koltunski almost 4 years ago

Extend the MeshBase.setTextureMaps API so that we are able to set a single texture map to a single texture component, or a few consecutive at a time, not necessarily starting from component 0.

View differences:

src/main/java/org/distorted/library/mesh/MeshBase.java
490 490

  
491 491
///////////////////////////////////////////////////////////////////////////////////////////////////
492 492

  
493
   void textureMap(Static4D[] maps)
493
   void textureMap(Static4D[] maps, int startComponent)
494 494
     {
495 495
     int num_comp = mTexComponent.size();
496 496
     int num_maps = maps.length;
497
     int min = Math.min(num_comp, num_maps);
497
     int min = Math.min(num_comp-startComponent, num_maps);
498 498
     int vertex = 0;
499 499
     Static4D newMap, oldMap;
500 500
     TexComponent comp;
......
503 503
     for(int i=0; i<min; i++)
504 504
       {
505 505
       newMap = maps[i];
506
       comp = mTexComponent.get(i);
506
       comp = mTexComponent.get(i+startComponent);
507 507

  
508 508
       if( newMap!=null )
509 509
         {
......
852 852
 *
853 853
 * A map's width and height have to be non-zero (but can be negative!)
854 854
 *
855
 * @param maps List of texture maps to apply to the texture's components.
855
 * @param maps            List of texture maps to apply to the texture's components.
856
 * @param startComponent  the component the first of the maps refers to.
856 857
 */
857
   public void setTextureMap(Static4D[] maps)
858
   public void setTextureMap(Static4D[] maps, int startComponent)
858 859
     {
859 860
     if( mJobNode[0]==null )
860 861
       {
861
       textureMap(maps);
862
       textureMap(maps,startComponent);
862 863
       }
863 864
     else
864 865
       {
865
       mJobNode[0] = DeferredJobs.textureMap(this,maps);
866
       mJobNode[0] = DeferredJobs.textureMap(this,maps,startComponent);
866 867
       }
867 868
     }
868 869

  

Also available in: Unified diff