示例#1
0
        public static void CreateTestPng(string childPath, string fileName, TextureColor color)
        {
            var path      = UnityPathUtility.GetUnityAbsoluteFullPath(childPath, fileName, GetExtension(FileType.Png));
            var texture2D = Texture2D.normalTexture;

            switch (color)
            {
            case TextureColor.black:
                texture2D = Texture2D.blackTexture;
                break;

            case TextureColor.white:
                texture2D = Texture2D.whiteTexture;
                break;

            default:
                texture2D = Texture2D.normalTexture;
                break;
            }

            var bytes = texture2D.EncodeToPNG();

            File.WriteAllBytes(path, bytes);
            RefreshAsset();
        }
 public void Dispose()
 {
     fixed(uint *FrameBufferPtr = &FrameBufferId)
     {
         GL.glDeleteFramebuffers(1, FrameBufferPtr);
         if ((RenderTargetLayers & RenderTargetLayers.Color) != 0)
         {
             TextureColor.Dispose();
         }
         if ((RenderTargetLayers & RenderTargetLayers.Depth) != 0)
         {
             TextureDepth.Dispose();
         }
         if ((RenderTargetLayers & RenderTargetLayers.Stencil) != 0)
         {
             RenderBufferStencil.Dispose();
         }
     }
 }
示例#3
0
 public override string ToString() => String.Format("Color: {0} RepeatU: {1} RepeatV: {2} OffsetU: {3} OffsetV: {4} " +
                                                    "Rotation: {5} Bump: {6} Shiny: {7} Fullbright: {8} Mapping: {9} Media: {10} Glow: {11} ID: {12} MaterialID: {13}",
                                                    TextureColor.ToString(), RepeatU, RepeatV, OffsetU, OffsetV, Rotation, Bump.ToString(), Shiny.ToString(), FullBright, TexMapType.ToString(),
                                                    MediaFlags, Glow, TextureID.ToString(), MaterialID.ToString());