本文整理汇总了C#中RenderTextureFormat类的典型用法代码示例。如果您正苦于以下问题:C# RenderTextureFormat类的具体用法?C# RenderTextureFormat怎么用?C# RenderTextureFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RenderTextureFormat类属于命名空间,在下文中一共展示了RenderTextureFormat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTexture2D
//--------------- Dispose --------------------
//--------------- TEXTURE 2D --------------------
public static Texture2D GetTexture2D(int width, int height, bool linear, RenderTextureFormat rtMatchFormat = RenderTextureFormat.Default)
{
Texture2D result = null;
int i = texture2DBuffers.Count;
while (--i > -1){
if (texture2DBuffers[i] == null){
texture2DBuffers.RemoveAt(i);
}
}
TextureFormat format = GetBest2DFormat(rtMatchFormat);
int idx = texture2DBuffers.FindIndex(item => item.width == width && item.height == height && item.format == format);
if (idx != -1){
result = texture2DBuffers[idx];
texture2DBuffers.RemoveAt(idx);
}
if (result == null) {
result = new Texture2D(width, height, format, false, linear);
result.name = "vBug_PoolTexture";
result.filterMode = FilterMode.Point;
result.anisoLevel = 0;
}
return result;
}
示例2: OnRenderImage
protected void OnRenderImage(RenderTexture src, RenderTexture dst)
{
if (!this.CheckResources())
{
Graphics.Blit(src, dst);
return;
}
int num = src.width;
int num1 = src.height;
int num2 = src.depth;
RenderTextureFormat renderTextureFormat = src.format;
if (num != this.w || num1 != this.h || num2 != this.d || renderTextureFormat != this.fmt)
{
this.CleanupCaptureRT();
RenderTexture renderTexture = new RenderTexture(num, num1, num2, renderTextureFormat)
{
hideFlags = HideFlags.DontSave
};
this.captureRT = renderTexture;
if (!this.captureRT.Create() && !this.captureRT.IsCreated())
{
Graphics.Blit(src, dst);
return;
}
this.captureRT.SetGlobalShaderProperty("_OpaqueFrame");
this.w = num;
this.h = num1;
this.d = num2;
this.fmt = renderTextureFormat;
}
Graphics.Blit(src, this.captureRT);
Graphics.Blit(src, dst);
}
示例3: Awake
protected virtual void Awake() {
Assert.SupportsRenderTextures(this);
Assert.NotNull<Shader>(this, replacementShader, "replacementShader");
if (!Assert.SupportsRenderTextureFormats(this, rtFormat)) {
rtFormat = RenderTextureFormat.Default;
}
}
示例4: Get
public RenderTexture Get(int width, int height, int depthBuffer = 0, RenderTextureFormat format = RenderTextureFormat.ARGBHalf, RenderTextureReadWrite rw = RenderTextureReadWrite.Default, FilterMode filterMode = FilterMode.Bilinear, TextureWrapMode wrapMode = TextureWrapMode.Clamp, string name = "FactoryTempTexture")
{
var rt = RenderTexture.GetTemporary(width, height, depthBuffer, format);
rt.filterMode = filterMode;
rt.wrapMode = wrapMode;
rt.name = name;
m_TemporaryRTs.Add(rt);
return rt;
}
示例5: GetTemporaryRenderTexture
public RenderTexture GetTemporaryRenderTexture(int width, int height, int depthBuffer = 0, RenderTextureFormat format = RenderTextureFormat.ARGBHalf, FilterMode filterMode = FilterMode.Bilinear)
{
RenderTexture temporary = RenderTexture.GetTemporary(width, height, depthBuffer, format);
temporary.filterMode = filterMode;
temporary.wrapMode = TextureWrapMode.Clamp;
temporary.name = "RenderTextureUtilityTempTexture";
this.m_TemporaryRTs.Add(temporary);
return temporary;
}
示例6: GetTemporaryRenderTexture
public RenderTexture GetTemporaryRenderTexture(int width, int height, int depthBuffer = 0, RenderTextureFormat format = RenderTextureFormat.ARGBHalf, FilterMode filterMode = FilterMode.Bilinear)
{
var rt = RenderTexture.GetTemporary(width, height, depthBuffer, format);
rt.filterMode = filterMode;
rt.wrapMode = TextureWrapMode.Clamp;
rt.name = "RenderTextureUtilityTempTexture";
m_TemporaryRTs.Add(rt);
return rt;
}
示例7: RenderTexture
/// <summary>
/// <para>Creates a new RenderTexture object.</para>
/// </summary>
/// <param name="width">Texture width in pixels.</param>
/// <param name="height">Texture height in pixels.</param>
/// <param name="depth">Number of bits in depth buffer (0, 16 or 24). Note that only 24 bit depth has stencil buffer.</param>
/// <param name="format">Texture color format.</param>
/// <param name="readWrite">How or if color space conversions should be done on texture read/write.</param>
public RenderTexture(int width, int height, int depth, RenderTextureFormat format)
{
Internal_CreateRenderTexture(this);
this.width = width;
this.height = height;
this.depth = depth;
this.format = format;
Internal_SetSRGBReadWrite(this, QualitySettings.activeColorSpace == ColorSpace.Linear);
}
示例8: CheckSupport
bool CheckSupport()
{
if (!Supported ()) {
enabled = false;
return false;
}
rtFormat = SystemInfo.SupportsRenderTextureFormat (RenderTextureFormat.RGB565) ? RenderTextureFormat.RGB565 : RenderTextureFormat.Default;
return true;
}
示例9: CreateDataTexture
static RenderTexture CreateDataTexture(int w, int h, RenderTextureFormat f)
{
RenderTexture r = new RenderTexture(w, h, 0, f);
r.filterMode = FilterMode.Point;
r.useMipMap = false;
r.generateMips = false;
r.Create();
return r;
}
示例10: CreateGBufferRT
RenderTexture CreateGBufferRT(RenderTextureFormat format, int depth = 0)
{
var ret = new RenderTexture(m_camera.pixelWidth, m_camera.pixelHeight, depth, format);
ret.filterMode = FilterMode.Point;
ret.useMipMap = false;
ret.generateMips = false;
ret.enableRandomWrite = m_enable_uav;
ret.Create();
return ret;
}
示例11: FrameBlendingFilter
public FrameBlendingFilter()
{
_useCompression = CheckSupportCompression();
_rawTextureFormat = GetPreferredRenderTextureFormat();
_material = new Material(Shader.Find("Hidden/Image Effects/Cinematic/MotionBlur/FrameBlending"));
_material.hideFlags = HideFlags.DontSave;
_frameList = new Frame[4];
}
示例12: CreateDataTexture
public static RenderTexture CreateDataTexture(int num_data, int num_elements, RenderTextureFormat format)
{
if (num_data == 0) { return null; }
int width = MeshTextureWidth * num_elements;
int height = AlembicUtils.ceildiv(num_data, MeshTextureWidth);
//Debug.Log("CreateDataTexture(): " + width + " x " + height + " " + format);
var r = new RenderTexture(width, height, 0, format);
r.filterMode = FilterMode.Point;
r.wrapMode = TextureWrapMode.Repeat;
r.enableRandomWrite = true;
r.Create();
return r;
}
示例13: MRT
public MRT(int width, int height, RenderTextureFormat format = RenderTextureFormat.ARGBFloat, FilterMode filterMode = FilterMode.Point, TextureWrapMode wrapMode = TextureWrapMode.Repeat)
{
RTs = new RenderTexture[3];
for(int i = 0, n = RTs.Length; i < n; i++) {
int depth = (i == 0) ? 24 : 0;
RTs[i] = new RenderTexture(width, height, depth);
RTs[i].hideFlags = HideFlags.DontSave;
RTs[i].format = format;
RTs[i].filterMode = filterMode;
RTs[i].wrapMode = wrapMode;
RTs[i].Create();
}
}
示例14: EnsureRenderTarget
public void EnsureRenderTarget(ref RenderTexture rt, int width, int height, RenderTextureFormat format, FilterMode filterMode, int depthBits = 0)
{
if (rt != null && (rt.width != width || rt.height != height || rt.format != format || rt.filterMode != filterMode))
{
RenderTexture.ReleaseTemporary(rt);
rt = null;
}
if (rt == null)
{
rt = RenderTexture.GetTemporary(width, height, depthBits, format);
rt.filterMode = filterMode;
rt.wrapMode = TextureWrapMode.Clamp;
}
}
示例15: Create
/// <summary>
/// Creates a GameObject with an OffscreenBuffer and required Camera with the specified properties.
/// </summary>
public static OffscreenBuffer Create(int width, int height, int depth,
RenderTextureFormat format, DepthTextureMode depthMode,
LayerMask layerMask, CameraClearFlags clearFlags,
Color clearColor, Shader replacementShader,
string replacementTag) {
GameObject tmp = new GameObject("Offscreen Buffer Camera");
// we want to do some setup before we activate so things adhere to Monobehaviour execution order.
tmp.SetActive(false);
tmp.AddComponent<Camera>();
OffscreenBuffer c = tmp.AddComponent<OffscreenBuffer>();
c.width = width;
c.height = height;
c.depth = depth;
c.format = format;
c.cullingMask = layerMask.value;
c.clearFlags = clearFlags;
c.clearColor = clearColor;
if (replacementShader != null) {
c.replacementShader = replacementShader;
c.replacementTag = replacementTag;
}
tmp.SetActive(true);
return c;
}