Esempio n. 1
0
 public static int ToSerializedVersion(Version version)
 {
     // VertexFormat enum has been changed
     if (VertexFormatExtensions.VertexFormat2019Relevant(version))
     {
         return(3);
     }
     // ShaderChannel enum has been changed
     if (ShaderChannelExtensions.ShaderChannel2018Relevant(version))
     {
         return(2);
     }
     return(1);
 }
Esempio n. 2
0
 public VertexFormat GetVertexFormat(Version version)
 {
     if (VertexFormatExtensions.VertexFormat2019Relevant(version))
     {
         return(((VertexFormat2019)Format).ToVertexFormat());
     }
     else if (VertexFormatExtensions.VertexFormat2017Relevant(version))
     {
         return(((VertexFormat2017)Format).ToVertexFormat());
     }
     else
     {
         return(((VertexChannelFormat)Format).ToVertexFormat());
     }
 }
Esempio n. 3
0
        public static VertexFormat GetVertexFormat(this ShaderChannel _this, Version version)
        {
            switch (_this)
            {
            case ShaderChannel.Vertex:
                return(VertexFormat.Float);

            case ShaderChannel.Normal:
                return(VertexFormat.Float);

            case ShaderChannel.Tangent:
                return(VertexFormat.Float);

            case ShaderChannel.Color:
                return(VertexFormatExtensions.VertexFormat2019Relevant(version) ? VertexFormat.Byte : VertexFormat.Color);

            case ShaderChannel.UV0:
            case ShaderChannel.UV1:
            case ShaderChannel.UV2:
            case ShaderChannel.UV3:
            case ShaderChannel.UV4:
            case ShaderChannel.UV5:
            case ShaderChannel.UV6:
            case ShaderChannel.UV7:
                return(VertexFormat.Float);

            case ShaderChannel.SkinWeight:
                return(VertexFormat.Float);

            case ShaderChannel.SkinBoneIndex:
                return(VertexFormat.Int);

            default:
                throw new Exception($"Unsupported channel type {_this}");
            }
        }