浏览代码

address PR comments

/main
Paul Melamed 7 年前
当前提交
d852d360
共有 2 个文件被更改,包括 16 次插入17 次删除
  1. 11
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Decal/DecalSystem.cs
  2. 22
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Texture2DAtlas.cs

11
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Decal/DecalSystem.cs


{
TextureScaleBias other = obj as TextureScaleBias;
int size = m_Texture.width * m_Texture.height;
int otherSide = other.m_Texture.width * other.m_Texture.height;
if(size > otherSide)
int otherSize = other.m_Texture.width * other.m_Texture.height;
if(size > otherSize)
else if( size < otherSide)
else if( size < otherSize)
{
return 1;
}

cmd.SetGlobalTexture(HDShaderIDs._DecalAtlas2DID, Atlas.AtlasTexture);
}
public void AddTexture(CommandBuffer cmd, TextureScaleBias textureScaleBias) //ref Vector4 scaleBias, Texture texture)
public void AddTexture(CommandBuffer cmd, TextureScaleBias textureScaleBias)
textureScaleBias.m_ScaleBias = Atlas.AddTexture(cmd, textureScaleBias.m_Texture);
if (textureScaleBias.m_ScaleBias == Vector4.zero)
if (!Atlas.AddTexture(cmd, ref textureScaleBias.m_ScaleBias,textureScaleBias.m_Texture))
{
m_AllocationSuccess = false;
}

22
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Texture2DAtlas.cs


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;
}
}
}
正在加载...
取消
保存