|
|
|
|
|
|
m_Height = height; |
|
|
|
} |
|
|
|
|
|
|
|
public Vector4 Allocate(int width, int height) |
|
|
|
public bool Allocate(ref Vector4 result, int width, int height) |
|
|
|
return node.m_Rect; |
|
|
|
result = node.m_Rect; |
|
|
|
return true; |
|
|
|
return new Vector4(0, 0, 0, 0); |
|
|
|
result = Vector4.zero; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
m_AllocationCache.Clear(); |
|
|
|
} |
|
|
|
|
|
|
|
public Vector4 AddTexture(CommandBuffer cmd, Texture texture) |
|
|
|
public bool AddTexture(CommandBuffer cmd, ref Vector4 scaleBias, Texture texture) |
|
|
|
IntPtr key = texture.GetNativeTexturePtr(); |
|
|
|
Vector4 scaleBias; |
|
|
|
IntPtr key = texture.GetNativeTexturePtr(); |
|
|
|
scaleBias = m_AtlasAllocator.Allocate(width, height); |
|
|
|
if ((scaleBias.x > 0) && (scaleBias.y > 0)) |
|
|
|
if (m_AtlasAllocator.Allocate(ref scaleBias, width, height)) |
|
|
|
{ |
|
|
|
scaleBias.Scale(new Vector4(1.0f / m_Width, 1.0f / m_Height, 1.0f / m_Width, 1.0f / m_Height)); |
|
|
|
for (int mipLevel = 0; mipLevel < (texture as Texture2D).mipmapCount; mipLevel++) |
|
|
|
|
|
|
} |
|
|
|
m_AllocationCache.Add(key, scaleBias); |
|
|
|
return scaleBias; |
|
|
|
return true; //scaleBias;
|
|
|
|
return new Vector4(0, 0, 0, 0); |
|
|
|
return false; new Vector4(0, 0, 0, 0); |
|
|
|
return scaleBias; |
|
|
|
return true; //scaleBias;
|
|
|
|
} |
|
|
|
} |
|
|
|
} |