Skip to content

Commit

Permalink
Merge pull request #16 from soupday/dev
Browse files Browse the repository at this point in the history
0.1.8b
  • Loading branch information
soupday authored Oct 6, 2021
2 parents 1ddfad2 + c289303 commit 93745e2
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions Editor/ComputeBake.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class ComputeBake
private readonly List<string> importAssets;

public const int MAX_SIZE = 4096;
public const int MIN_SIZE = 128;
public const string COMPUTE_SHADER = "RLBakeShader";
public const string BAKE_FOLDER = "Baked";
public const string TEXTURES_FOLDER = "Textures";
Expand Down Expand Up @@ -72,29 +73,41 @@ public ComputeBake(UnityEngine.Object character, CharacterInfo info)

private static Vector2Int GetMaxSize(Texture2D a)
{
Vector2Int max = new Vector2Int(a.width, a.height);
Vector2Int max = new Vector2Int(MIN_SIZE, MIN_SIZE);
if (a) max = new Vector2Int(a.width, a.height);
if (max.x > MAX_SIZE) max.x = MAX_SIZE;
if (max.y > MAX_SIZE) max.y = MAX_SIZE;
return max;
}

private static Vector2Int GetMaxSize(Texture2D a, Texture2D b)
{
Vector2Int max = new Vector2Int(a.width, a.height);
if (b.width > max.x) max.x = b.width;
if (b.height > max.y) max.y = b.height;
Vector2Int max = new Vector2Int(MIN_SIZE, MIN_SIZE);
if (a) max = new Vector2Int(a.width, a.height);
if (b)
{
if (b.width > max.x) max.x = b.width;
if (b.height > max.y) max.y = b.height;
}
if (max.x > MAX_SIZE) max.x = MAX_SIZE;
if (max.y > MAX_SIZE) max.y = MAX_SIZE;
return max;
}

private static Vector2Int GetMaxSize(Texture2D a, Texture2D b, Texture2D c)
{
Vector2Int max = new Vector2Int(a.width, a.height);
if (b.width > max.x) max.x = b.width;
if (b.height > max.y) max.y = b.height;
if (c.width > max.x) max.x = c.width;
if (c.height > max.y) max.y = c.height;
Vector2Int max = new Vector2Int(MIN_SIZE, MIN_SIZE);
if (a) max = new Vector2Int(a.width, a.height);
if (b)
{
if (b.width > max.x) max.x = b.width;
if (b.height > max.y) max.y = b.height;
}
if (c)
{
if (c.width > max.x) max.x = c.width;
if (c.height > max.y) max.y = c.height;
}
if (max.x > MAX_SIZE) max.x = MAX_SIZE;
if (max.y > MAX_SIZE) max.y = MAX_SIZE;
return max;
Expand Down

0 comments on commit 93745e2

Please sign in to comment.