浏览代码

minor clean up. Didn't need these afterall

minor clean up. Didn't need these afterall
/main
mmikk 8 年前
当前提交
922fa26b
共有 2 个文件被更改,包括 5 次插入15 次删除
  1. 2
      Assets/ScriptableRenderLoop/common/CubeToSpherical.shader
  2. 18
      Assets/ScriptableRenderLoop/common/TextureCache.cs

2
Assets/ScriptableRenderLoop/common/CubeToSpherical.shader


UNITY_DECLARE_TEXCUBE(_srcCubeTexture);
uniform int _cubeMipLvl;
uniform int _dstPanoWidth;
uniform int _dstPanoHeight;
struct v2f {

18
Assets/ScriptableRenderLoop/common/TextureCache.cs


private Texture2DArray m_CacheNoCubeArray;
private RenderTexture[] m_StagingRTs;
private int m_NumPanoMipLevels;
private int m_PanoWidthTop;
private int m_PanoHeightTop;
private int m_dstPanoWidthPropName;
private int m_dstPanoHeightPropName;
private int m_cubeSrcTexPropName;
// alternative panorama path intended for mobile
// the member variables below are only in use when m_IsNoCubeArray is true.

{
if(!m_CubeBlitMaterial) m_CubeBlitMaterial = new Material(Shader.Find("Hidden/CubeToPano"));
m_PanoWidthTop = 4*width;
m_PanoHeightTop = 2*width;
int panoWidthTop = 4*width;
int panoHeightTop = 2*width;
m_CacheNoCubeArray = new Texture2DArray(m_PanoWidthTop, m_PanoHeightTop, numCubeMaps, TextureFormat.RGBAHalf, isMipMapped)
m_CacheNoCubeArray = new Texture2DArray(panoWidthTop, panoHeightTop, numCubeMaps, TextureFormat.RGBAHalf, isMipMapped)
{
hideFlags = HideFlags.HideAndDontSave,
wrapMode = TextureWrapMode.Repeat,

m_NumPanoMipLevels = isMipMapped ? GetNumMips(m_PanoWidthTop, m_PanoHeightTop) : 1;
m_NumPanoMipLevels = isMipMapped ? GetNumMips(panoWidthTop, panoHeightTop) : 1;
m_StagingRTs[m] = new RenderTexture(Mathf.Max(1,m_PanoWidthTop>>m), Mathf.Max(1,m_PanoHeightTop>>m), 0, RenderTextureFormat.ARGBHalf);
m_StagingRTs[m] = new RenderTexture(Mathf.Max(1,panoWidthTop>>m), Mathf.Max(1,panoHeightTop>>m), 0, RenderTextureFormat.ARGBHalf);
m_dstPanoWidthPropName = Shader.PropertyToID("_dstPanoWidth");
m_dstPanoHeightPropName = Shader.PropertyToID("_dstPanoHeight");
m_cubeSrcTexPropName = Shader.PropertyToID("_srcCubeTexture");
}
}

for(int m=0; m<m_NumPanoMipLevels; m++)
{
m_CubeBlitMaterial.SetInt(m_CubeMipLevelPropName, Mathf.Min(m_NumMipLevels-1,m) );
m_CubeBlitMaterial.SetInt(m_dstPanoWidthPropName, m_StagingRTs[m].width);
m_CubeBlitMaterial.SetInt(m_dstPanoHeightPropName, m_StagingRTs[m].height);
Graphics.SetRenderTarget(m_StagingRTs[m]);
Graphics.Blit(null, m_CubeBlitMaterial, 0);
}

正在加载...
取消
保存