예제 #1
0
        public static void CopyTo(this MaterialChannelView srcChannel, Materials.MaterialChannelBuilder dstChannel)
        {
            dstChannel.Factor = srcChannel.Factor;

            if (srcChannel.Texture == null)
            {
                dstChannel.Texture = null; return;
            }

            if (srcChannel.Texture == null)
            {
                dstChannel.Texture = new Materials.TextureBuilder();
            }

            dstChannel.Texture.CoordinateSet = srcChannel.Set;
            dstChannel.Texture.MinFilter     = srcChannel.Sampler.MinFilter;
            dstChannel.Texture.MagFilter     = srcChannel.Sampler.MagFilter;
            dstChannel.Texture.WrapS         = srcChannel.Sampler.WrapS;
            dstChannel.Texture.WrapT         = srcChannel.Sampler.WrapT;

            /*
             * dstChannel.Texture.Rotation = srcChannel.Transform?.Rotation ?? 0;
             * dstChannel.Texture.Offset = srcChannel.Transform?.Offset ?? Vector2.Zero;
             * dstChannel.Texture.Scale = srcChannel.Transform?.Scale ?? Vector2.One;
             */

            dstChannel.Texture.ImageContent = srcChannel.Image.GetImageContent();
        }
예제 #2
0
        public static void CopyTo(this Materials.MaterialChannelBuilder srcChannel, MaterialChannelView dstChannel)
        {
            if (srcChannel == null)
            {
                return;
            }

            dstChannel.SetFactor(srcChannel.Factor);

            var srcTex = srcChannel.Texture;

            if (srcTex == null)
            {
                return;
            }

            var image = dstChannel.LogicalParent.LogicalParent.UseImageWithContent(srcTex.ImageContent.ToArray());

            dstChannel.SetTexture(srcTex.CoordinateSet, image, srcTex.MinFilter, srcTex.MagFilter, srcTex.WrapS, srcTex.WrapT);

            // dstChannel.SetTransform(srcTex.CoordinateSet, srcTex.Offset, srcTex.Scale, srcTex.Rotation);
        }