mirror of
https://github.com/maxartz15/VertexAnimation.git
synced 2025-06-13 14:56:18 +02:00
Package.json
Package.json deps. More texture checks. Upgrade project to 2020.2. NOTE: Only works in editor. TODO: Save generated data in editor time.
This commit is contained in:
@ -55,6 +55,7 @@ namespace TAO.VertexAnimation
|
||||
for (int i = 0; i < textureGroups.Count; i++)
|
||||
{
|
||||
var t = GetTextures(i).ToArray();
|
||||
|
||||
if (VA_Texture2DArrayUtils.IsValidForTextureArray(t))
|
||||
{
|
||||
texture2DArray.Add(VA_Texture2DArrayUtils.CreateTextureArray(t, false, textureGroups[i].isLinear, textureGroups[i].wrapMode, textureGroups[i].filterMode, 1, name + textureGroups[i].shaderParamName));
|
||||
|
@ -18,7 +18,6 @@ namespace TAO.VertexAnimation
|
||||
{
|
||||
animationLib.animationLibrary.Create();
|
||||
|
||||
|
||||
// Blob builder to build.
|
||||
using (BlobBuilder blobBuilder = new BlobBuilder(Allocator.Temp))
|
||||
{
|
||||
|
@ -7,16 +7,19 @@ namespace TAO.VertexAnimation
|
||||
public static Texture2DArray CreateTextureArray(Texture2D[] a_textures, bool a_useMipChain, bool a_isLinear,
|
||||
TextureWrapMode a_wrapMode = TextureWrapMode.Repeat, FilterMode a_filterMode = FilterMode.Bilinear, int a_anisoLevel = 1, string a_name = "")
|
||||
{
|
||||
if(!IsValidForTextureArray(a_textures))
|
||||
if(!IsValidForTextureArray(a_textures) || !IsValidCopyTexturePlatform())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Texture2DArray textureArray = new Texture2DArray(a_textures[0].width, a_textures[0].height, a_textures.Length, a_textures[0].format, a_useMipChain, a_isLinear);
|
||||
|
||||
for (int i = 0; i < a_textures.Length; i++)
|
||||
if (IsValidCopyTexturePlatform())
|
||||
{
|
||||
Graphics.CopyTexture(a_textures[i], 0, 0, textureArray, i, 0);
|
||||
for (int i = 0; i < a_textures.Length; i++)
|
||||
{
|
||||
Graphics.CopyTexture(a_textures[i], 0, 0, textureArray, i, 0);
|
||||
}
|
||||
}
|
||||
|
||||
textureArray.wrapMode = a_wrapMode;
|
||||
@ -56,9 +59,47 @@ namespace TAO.VertexAnimation
|
||||
Debug.LogError("Texture " + a_textures[i].name + " has a different format/graphics format!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!a_textures[0].isReadable)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
Debug.LogWarning("Texture " + a_textures[i].name + " is not readable!");
|
||||
return true;
|
||||
#else
|
||||
Debug.LogError("Texture " + a_textures[i].name + " is not readable!");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsValidCopyTexturePlatform()
|
||||
{
|
||||
switch (SystemInfo.copyTextureSupport)
|
||||
{
|
||||
case UnityEngine.Rendering.CopyTextureSupport.None:
|
||||
Debug.LogError("No CopyTextureSupport on this platform!");
|
||||
return false;
|
||||
case UnityEngine.Rendering.CopyTextureSupport.Basic:
|
||||
return true;
|
||||
case UnityEngine.Rendering.CopyTextureSupport.Copy3D:
|
||||
return true;
|
||||
case UnityEngine.Rendering.CopyTextureSupport.DifferentTypes:
|
||||
return true;
|
||||
case UnityEngine.Rendering.CopyTextureSupport.TextureToRT:
|
||||
return true;
|
||||
case UnityEngine.Rendering.CopyTextureSupport.RTToTexture:
|
||||
return true;
|
||||
default:
|
||||
#if UNITY_EDITOR
|
||||
return true;
|
||||
#else
|
||||
Debug.LogError("No CopyTextureSupport on this platform!");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user