|
|
|
|
|
|
|
|
|
|
public class TextureCache2D : TextureCache |
|
|
|
{ |
|
|
|
private Texture2DArray cache; |
|
|
|
private Texture2DArray m_Cache; |
|
|
|
var mismatch = (cache.width != texture.width) || (cache.height != texture.height); |
|
|
|
var mismatch = (m_Cache.width != texture.width) || (m_Cache.height != texture.height); |
|
|
|
mismatch |= (cache.format != (texture as Texture2D).format); |
|
|
|
mismatch |= (m_Cache.format != (texture as Texture2D).format); |
|
|
|
texture.name, cache.width, cache.height, cache.format); |
|
|
|
texture.name, m_Cache.width, m_Cache.height, m_Cache.format); |
|
|
|
Graphics.CopyTexture(texture, 0, cache, sliceIndex); |
|
|
|
Graphics.CopyTexture(texture, 0, m_Cache, sliceIndex); |
|
|
|
return cache; |
|
|
|
return m_Cache; |
|
|
|
} |
|
|
|
|
|
|
|
public bool AllocTextureArray(int numTextures, int width, int height, TextureFormat format, bool isMipMapped) |
|
|
|
|
|
|
|
|
|
|
cache = new Texture2DArray(width, height, numTextures, format, isMipMapped) |
|
|
|
m_Cache = new Texture2DArray(width, height, numTextures, format, isMipMapped) |
|
|
|
{ |
|
|
|
hideFlags = HideFlags.HideAndDontSave, |
|
|
|
wrapMode = TextureWrapMode.Clamp |
|
|
|
|
|
|
|
|
|
|
public void Release() |
|
|
|
{ |
|
|
|
Texture.DestroyImmediate(cache); // do I need this?
|
|
|
|
Texture.DestroyImmediate(m_Cache); // do I need this?
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|