当前位置: 首页>>代码示例>>C#>>正文


C# RenderTextureFormat类代码示例

本文整理汇总了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;
        }
开发者ID:WhiteRavensGame,项目名称:JRPGTownPrototype,代码行数:28,代码来源:TexturePool.cs

示例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);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:33,代码来源:OpaqueCapture.cs

示例3: Awake

 protected virtual void Awake() {
   Assert.SupportsRenderTextures(this);
   Assert.NotNull<Shader>(this, replacementShader, "replacementShader");
   if (!Assert.SupportsRenderTextureFormats(this, rtFormat)) {
     rtFormat = RenderTextureFormat.Default;
   }
 }
开发者ID:MaTriXy,项目名称:cardboard-unity,代码行数:7,代码来源:ImageFXBase.cs

示例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;
 }
开发者ID:Cam582,项目名称:Top-Hats,代码行数:9,代码来源:RenderTextureFactory.cs

示例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;
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:9,代码来源:RenderTexureUtility.cs

示例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;
 }
开发者ID:ymfact,项目名称:railgun,代码行数:9,代码来源:RenderTexureUtility.cs

示例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);
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:17,代码来源:RenderTexture.cs

示例8: CheckSupport

 bool CheckSupport()
 {
     if (!Supported ()) {
         enabled = false;
         return false;
     }
     rtFormat = SystemInfo.SupportsRenderTextureFormat (RenderTextureFormat.RGB565) ? RenderTextureFormat.RGB565 : RenderTextureFormat.Default;
     return true;
 }
开发者ID:cn00,项目名称:U3D5_CSharp_AngryBots,代码行数:9,代码来源:MobileBloom.cs

示例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;
 }
开发者ID:garytyler,项目名称:AlembicImporter,代码行数:9,代码来源:AlembicPointsRenderer.cs

示例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;
 }
开发者ID:nicegary,项目名称:Unity5Effects,代码行数:10,代码来源:GBufferUtils.cs

示例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];
            }
开发者ID:Arafo,项目名称:Syncopia,代码行数:10,代码来源:FrameBlendingFilter.cs

示例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;
 }
开发者ID:efwff,项目名称:AlembicImporter,代码行数:13,代码来源:AlembicMesh.cs

示例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();
     }
 }
开发者ID:mattatz,项目名称:unity-mrt-example,代码行数:13,代码来源:MRT.cs

示例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;
     }
 }
开发者ID:NeonPandaSp,项目名称:ValenceGame,代码行数:14,代码来源:EffectBase.cs

示例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;
 }
开发者ID:2954722256,项目名称:gvr-unity-sdk,代码行数:27,代码来源:OffscreenBuffer.cs


注:本文中的RenderTextureFormat类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。