commit de53cf3edc773ef90b7ad53d5ebf891dd5598197
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Thu Mar 5 00:39:51 2020 +0000

    Make MeshBase.setTextureMap() work.

diff --git a/src/main/java/org/distorted/library/mesh/MeshBase.java b/src/main/java/org/distorted/library/mesh/MeshBase.java
index 90f08ca..31901fa 100644
--- a/src/main/java/org/distorted/library/mesh/MeshBase.java
+++ b/src/main/java/org/distorted/library/mesh/MeshBase.java
@@ -92,7 +92,7 @@ public abstract class MeshBase
 
      void setMap(float[] newMap)
        {
-       mTextureMap = newMap;
+       System.arraycopy(newMap,0,mTextureMap,0,4);
        }
      }
 
@@ -149,15 +149,6 @@ public abstract class MeshBase
      setAttribs(mVertAttribs);
      }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// change mVertAttribs from index 'begin' to index 'end' (inclusive) to the new Texture Map.
-// x varies from -mBoundingX to +mBoundingX; y accordingly.
-
-   private void changeTextureMap( float[] newMap, float[] oldMap, int begin, int end)
-     {
-
-     }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
    int numComponents()
@@ -476,16 +467,25 @@ public abstract class MeshBase
      int num_comp = mComponent.size();
      int num_maps = maps.length;
      int min = num_comp<num_maps ? num_comp : num_maps;
-     int lastEnd = 0;
+     int vertex = 0;
+     int index  = TEX_ATTRIB;
+     float[] newMap, oldMap;
+     Component comp;
 
      for(int i=0; i<min; i++)
        {
-       if( maps[i]!=null )
+       if( maps[i]!=null && maps[i][2]!=0.0f && maps[i][3]!=0.0f )
          {
-         Component comp = mComponent.get(i);
-         changeTextureMap(maps[i],comp.mTextureMap,lastEnd,comp.mEndIndex);
-         comp.setMap(maps[i]);
-         lastEnd = comp.mEndIndex;
+         comp = mComponent.get(i);
+         newMap = maps[i];
+         oldMap = comp.mTextureMap;
+
+         for( ; vertex<=comp.mEndIndex; vertex++, index+=VERT_ATTRIBS)
+           {
+           mVertAttribs[index  ] = (newMap[2]/oldMap[2])*(mVertAttribs[index  ]-oldMap[0]) + newMap[0];
+           mVertAttribs[index+1] = (newMap[3]/oldMap[3])*(mVertAttribs[index+1]-oldMap[1]) + newMap[1];
+           }
+         comp.setMap(newMap);
          }
        }
 
