Paul Melamed
7 年前
当前提交
22cfa928
共有 5 个文件被更改,包括 86 次插入 和 3 次删除
-
24ScriptableRenderPipeline/HDRenderPipeline/HDRP/Decal/DecalSystem.cs
-
2ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDUtils.cs
-
2ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/Blit.shader
-
50ScriptableRenderPipeline/HDRenderPipeline/HDRP/Texture2DAtlas.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/HDRP/Texture2DAtlas.cs.meta
|
|||
using System.Collections.Generic; |
|||
using UnityEngine.Rendering; |
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
|
|||
|
|||
#if UNITY_EDITOR
|
|||
using UnityEditor; |
|||
#endif
|
|||
|
|||
namespace UnityEngine.Experimental.Rendering |
|||
{ |
|||
public class Texture2DAtlas |
|||
{ |
|||
private RTHandle m_AtlasTexture = null; |
|||
private int m_Width; |
|||
private int m_Height; |
|||
private RenderTextureFormat m_Format; |
|||
|
|||
public Texture2DAtlas(int width, int height, RenderTextureFormat format) |
|||
{ |
|||
m_Width = width; |
|||
m_Height = height; |
|||
m_Format = format; |
|||
m_AtlasTexture = RTHandle.Alloc(m_Width, |
|||
m_Height, |
|||
1, |
|||
DepthBits.None, |
|||
RenderTextureFormat.ARGB32, |
|||
FilterMode.Point, |
|||
TextureWrapMode.Clamp, |
|||
TextureDimension.Tex2D, |
|||
false, |
|||
false, |
|||
true, |
|||
false); |
|||
} |
|||
|
|||
public void Release() |
|||
{ |
|||
RTHandle.Release(m_AtlasTexture); |
|||
} |
|||
|
|||
public void AddTexture(CommandBuffer cmd, Texture texture) |
|||
{ |
|||
float scaleW = (float)texture.width / m_Width; |
|||
float scaleH = (float) texture.height / m_Height; |
|||
HDUtils.BlitTexture(cmd, texture, m_AtlasTexture, new Vector4(1,1,0,0), new Vector4(scaleW, scaleH, 0, 0), 0, 0, false); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 081cfbdef2e1c014aa1d1c9aa16fb952 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue