mirror of
				https://github.com/maxartz15/VertexAnimation.git
				synced 2025-11-04 02:15:59 +01:00 
			
		
		
		
	Update VA_ModelBaker.cs
Removed LitGUI debug logs. Updated VA_ModelBaker material creation and setting update. Added mesh finalize function to optimize and upload the mesh data.
This commit is contained in:
		@@ -14,5 +14,45 @@ namespace TAO.VertexAnimation
 | 
			
		||||
 | 
			
		||||
			return material;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public static Material Create(string name, Shader shader, Texture2DArray positionMap, bool useNormalA, bool useInterpolation, int maxFrames)
 | 
			
		||||
		{
 | 
			
		||||
			Material material = Create(name, shader);
 | 
			
		||||
 | 
			
		||||
			material.Update(name, shader, positionMap, useNormalA, useInterpolation, maxFrames);
 | 
			
		||||
 | 
			
		||||
			return material;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public static void Update(this Material material, string name, Shader shader, Texture2DArray positionMap, bool useNormalA, bool useInterpolation, int maxFrames)
 | 
			
		||||
		{
 | 
			
		||||
			material.name = name;
 | 
			
		||||
 | 
			
		||||
			if (material.shader != shader)
 | 
			
		||||
			{
 | 
			
		||||
				material.shader = shader;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			material.SetTexture("_PositionMap", positionMap);
 | 
			
		||||
			material.SetInt("_MaxFrames", maxFrames);
 | 
			
		||||
 | 
			
		||||
			if (useNormalA)
 | 
			
		||||
			{
 | 
			
		||||
				material.EnableKeyword("USE_NORMALA_ON");
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				material.DisableKeyword("USE_NORMALA_ON");
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (useInterpolation)
 | 
			
		||||
			{
 | 
			
		||||
				material.EnableKeyword("USE_INTERPOLATION_ON");
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				material.DisableKeyword("USE_INTERPOLATION_ON");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -4,6 +4,7 @@ namespace TAO.VertexAnimation
 | 
			
		||||
{
 | 
			
		||||
	public static class MeshUtils
 | 
			
		||||
	{
 | 
			
		||||
		// Copy a mesh and it's properties.
 | 
			
		||||
		public static Mesh Copy(this Mesh mesh)
 | 
			
		||||
		{
 | 
			
		||||
			Mesh copy = new Mesh
 | 
			
		||||
@@ -29,5 +30,12 @@ namespace TAO.VertexAnimation
 | 
			
		||||
 | 
			
		||||
			return copy;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Optimize the mesh and upload the mesh data, makes the mesh no longer readable.
 | 
			
		||||
		public static void Finalize(this Mesh mesh)
 | 
			
		||||
		{
 | 
			
		||||
			mesh.Optimize();
 | 
			
		||||
			mesh.UploadMeshData(true);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user