commit 3273dce21dc718ea33d3167bc6c5ed8c52c8ffda
Author: leszek <leszek@koltunski.pl>
Date:   Mon Sep 18 16:40:51 2023 +0200

    fix the 'holes in textures' problem.

diff --git a/src/main/java/org/distorted/library/effect/VertexEffectDeform.java b/src/main/java/org/distorted/library/effect/VertexEffectDeform.java
index 0455cf9..f1cb0d7 100644
--- a/src/main/java/org/distorted/library/effect/VertexEffectDeform.java
+++ b/src/main/java/org/distorted/library/effect/VertexEffectDeform.java
@@ -133,7 +133,8 @@ public class VertexEffectDeform extends VertexEffect
       + "float denomV = 1.0 / (aForce.y + Aw.x);                             \n"
       + "float denomH = 1.0 / (aForce.x + Aw.y);                             \n"
 
-      + "vec3 vertCorr= ONE - aPS / ( aForce+C*aPS + (ONE-sign(aForce)) );   \n"  // avoid division by 0 when force and PS both are 0
+      + "vec3 one_over_aforce = aForce - 0.001*(sign(aForce)-ONE);           \n"  // avoid division by 0 when force and PS both are 0
+      + "vec3 vertCorr= ONE - aPS/(C*aPS + one_over_aforce);                 \n"  // avoid division by 0 when force and PS both are 0
 
       + "float mvXvert = -B * ps.x * aForce.y * (1.0-quot.y) * denomV;       \n"  // impact the vertical   component of the force vector has on horizontal movement
       + "float mvYhorz = -B * ps.y * aForce.x * (1.0-quot.x) * denomH;       \n"  // impact the horizontal component of the force vector has on vertical   movement
diff --git a/src/main/java/org/distorted/library/mesh/MeshBase.java b/src/main/java/org/distorted/library/mesh/MeshBase.java
index b9df7b3..9b005e2 100644
--- a/src/main/java/org/distorted/library/mesh/MeshBase.java
+++ b/src/main/java/org/distorted/library/mesh/MeshBase.java
@@ -633,7 +633,7 @@ public abstract class MeshBase
  *
  * @y.exclude
  */
-   public void debug()
+   public void debugJobs()
      {
      if( mJobNode[0]!=null )
        {
@@ -670,7 +670,7 @@ public abstract class MeshBase
          sb.append(") ");
          }
 
-       DistortedLibrary.logMessage("MeshBase: "+sb.toString() );
+       DistortedLibrary.logMessage("MeshBase: "+sb);
        }
      }
 
@@ -692,9 +692,32 @@ public abstract class MeshBase
        sb.append(mVertAttribs1[VERT1_ATTRIBS*i+POS_ATTRIB+1]);
        sb.append(',');
        sb.append(mVertAttribs1[VERT1_ATTRIBS*i+POS_ATTRIB+2]);
-       sb.append(") ");
+       sb.append(")\n");
        }
-     DistortedLibrary.logMessage("MeshBase: "+sb.toString());
+     DistortedLibrary.logMessage("MeshBase: vertices: \n"+sb);
+     }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+   /**
+    * Not part of public API, do not document (public only because has to be used from the main package)
+    *
+    * @y.exclude
+    */
+   public void printNor()
+     {
+     StringBuilder sb = new StringBuilder();
+
+     for(int i=0; i<mNumVertices; i++)
+       {
+       sb.append('(');
+       sb.append(mVertAttribs1[VERT1_ATTRIBS*i+NOR_ATTRIB  ]);
+       sb.append(',');
+       sb.append(mVertAttribs1[VERT1_ATTRIBS*i+NOR_ATTRIB+1]);
+       sb.append(',');
+       sb.append(mVertAttribs1[VERT1_ATTRIBS*i+NOR_ATTRIB+2]);
+       sb.append(")\n");
+       }
+     DistortedLibrary.logMessage("MeshBase: normals:\n"+sb);
      }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -713,7 +736,7 @@ public abstract class MeshBase
        sb.append(' ');
        }
 
-     DistortedLibrary.logMessage("MeshBase: "+sb.toString());
+     DistortedLibrary.logMessage("MeshBase: "+sb);
      }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -745,7 +768,7 @@ public abstract class MeshBase
          }
        }
 
-     DistortedLibrary.logMessage("MeshBase: "+sb.toString());
+     DistortedLibrary.logMessage("MeshBase: "+sb);
      }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1210,7 +1233,6 @@ public abstract class MeshBase
  * <p>
  * This is a static, permanent modification of the vertices contained in this Mesh. If the effects
  * contain any Dynamics, the Dynamics will be evaluated at 0.
- *
  * We would call this several times building up a list of Effects to do. This list of effects gets
  * lazily executed only when the Mesh is used for rendering for the first time.
  *
@@ -1238,7 +1260,6 @@ public abstract class MeshBase
  * maps[1] = the map for the 2nd component
  * maps[2] = null
  * maps[3] = the map for the 4th component
- *
  * A map's width and height have to be non-zero (but can be negative!)
  *
  * @param maps            List of texture maps to apply to the texture's components.
@@ -1270,15 +1291,11 @@ public abstract class MeshBase
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * Set Effect association.
- *
  * This creates an association between a Component of this Mesh and a Vertex Effect.
  * One can set two types of associations - an 'logical and' and a 'equal' associations and the Effect
  * will only be active on vertices of Components such that
- *
  * (effect andAssoc) & (component andAssoc) != 0 || (effect equAssoc) == (mesh equAssoc)
- *
  * (see main_vertex_shader)
- *
  * The point: this way we can configure the system so that each Vertex Effect acts only on a certain
  * subset of a Mesh, thus potentially significantly reducing the number of render calls.
  */
@@ -1300,12 +1317,10 @@ public abstract class MeshBase
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * Set center of a Component.
- *
  * A 'center' of a (effect) component is a 3D point in space. The array of centers gets sent to
  * the vertex shader as a Uniform Buffer Object; in the vertex shader we can then use it to compute
  * the 'Inflation' of the whole Mesh per-component. 'Inflation' is needed by postprocess effects to
  * add the 'halo' around an object.
- *
  * This is all 'per-component' so that a user has a chance to make the halo look right in case of
  * non-convex meshes: then we need to ensure that each component of such a mesh is a convex
  * sub-mesh with its center being more-or-less the center of gravity of the sub-mesh.
@@ -1344,7 +1359,6 @@ public abstract class MeshBase
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * Adds an empty (no vertices) texture component to the end of the text component list.
- *
  * Sometimes we want to do this to have several Meshes with equal number of tex components each.
  */
    public void addEmptyTexComponent()
