<commit_before>﻿using SharpDX;
using SharpDX.Direct3D11;
using System.IO;
using System.Linq;
using System;
using System.Collections.ObjectModel;

#if NETFX_CORE
using Windows.UI.Xaml;
namespace HelixToolkit.UWP
#else
using System.Windows;
namespace HelixToolkit.Wpf.SharpDX
#endif
{
    using Model;
    using Shaders;
    using System.ComponentModel;
    using Utilities;


    public sealed class DiffuseMaterial : Material
    {
        /// <summary>
        /// The diffuse color property
        /// </summary>
        public static readonly DependencyProperty DiffuseColorProperty =
            DependencyProperty.Register("DiffuseColor", typeof(Color4), typeof(DiffuseMaterial), new PropertyMetadata((Color4)Color.White,
                (d, e) =>
                {
                    ((d as Material).Core as DiffuseMaterialCore).DiffuseColor = (Color4)e.NewValue;
                }));

        /// <summary>
        /// Gets or sets the diffuse color for the material.
        /// For details see: http://msdn.microsoft.com/en-us/library/windows/desktop/bb147175(v=vs.85).aspx
        /// </summary>
#if !NETFX_CORE
        [TypeConverter(typeof(Color4Converter))]
#endif
        public Color4 DiffuseColor
        {
            get { return (Color4)this.GetValue(DiffuseColorProperty); }
            set { this.SetValue(DiffuseColorProperty, value); }
        }

        /// <summary>
        /// 
        /// </summary>
        public static readonly DependencyProperty DiffuseMapProperty =
            DependencyProperty.Register("DiffuseMap", typeof(Stream), typeof(DiffuseMaterial), new PropertyMetadata(null,
                (d, e) => { ((d as Material).Core as DiffuseMaterialCore).DiffuseMap = e.NewValue as Stream; }));

        /// <summary>
        /// Gets or sets the diffuse map.
        /// </summary>
        /// <value>
        /// The diffuse map.
        /// </value>
        public Stream DiffuseMap
        {
            get { return (Stream)this.GetValue(DiffuseMapProperty); }
            set { this.SetValue(DiffuseMapProperty, value); }
        }

        /// <summary>
        /// 
        /// </summary>
        public static readonly DependencyProperty DiffuseMapSamplerProperty =
            DependencyProperty.Register("DiffuseMapSampler", typeof(SamplerStateDescription), typeof(DiffuseMaterial), new PropertyMetadata(DefaultSamplers.LinearSamplerWrapAni4,
                (d, e) => { ((d as Material).Core as DiffuseMaterialCore).DiffuseMapSampler = (SamplerStateDescription)e.NewValue; }));
        /// <summary>
        /// 
        /// </summary>
        public SamplerStateDescription DiffuseMapSampler
        {
            get { return (SamplerStateDescription)this.GetValue(DiffuseMapSamplerProperty); }
            set { this.SetValue(DiffuseMapSamplerProperty, value); }
        }
        /// <summary>
        /// The uv transform property
        /// </summary>
        public static readonly DependencyProperty UVTransformProperty =
            DependencyProperty.Register("UVTransform", typeof(Matrix), typeof(DiffuseMaterial), new PropertyMetadata(Matrix.Identity, (d, e) =>
            {
                ((d as Material).Core as DiffuseMaterialCore).UVTransform = (Matrix)e.NewValue;
            }));
        /// <summary>
        /// Gets or sets the texture uv transform.
        /// </summary>
        /// <value>
        /// The uv transform.
        /// </value>
        public Matrix UVTransform
        {
            get { return (Matrix)GetValue(UVTransformProperty); }
            set { SetValue(UVTransformProperty, value); }
        }


        /// <summary>
        /// Gets or sets a value indicating whether whether disable lighting. Directly render diffuse color and diffuse map.
        /// </summary>
        /// <value>
        ///   <c>true</c> if [enable un lit]; otherwise, <c>false</c>.
        /// </value>
        public bool EnableUnLit
        {
            get { return (bool)GetValue(EnableUnLitProperty); }
            set { SetValue(EnableUnLitProperty, value); }
        }

        /// <summary>
        /// The enable un lit property
        /// </summary>
        public static readonly DependencyProperty EnableUnLitProperty =
            DependencyProperty.Register("EnableUnLit", typeof(bool), typeof(DiffuseMaterial), new PropertyMetadata(false,
                (d,e)=> 
                {
                    ((d as Material).Core as DiffuseMaterialCore).EnableUnLit = (bool)e.NewValue;
                }));


        protected override MaterialCore OnCreateCore()
        {
            return new DiffuseMaterialCore()
            {
                DiffuseColor = DiffuseColor,
                DiffuseMap = DiffuseMap,
                UVTransform = UVTransform,
                DiffuseMapSampler = DiffuseMapSampler
            };
        }

#if !NETFX_CORE
        protected override Freezable CreateInstanceCore()
        {
            return new DiffuseMaterial()
            {
                DiffuseColor = DiffuseColor,
                DiffuseMap = DiffuseMap,
                DiffuseMapSampler = DiffuseMapSampler,
                UVTransform = UVTransform,
                Name = Name
            };
        }
#endif
    }
<commit_msg>Add property assign on create material core.<commit_after>﻿using SharpDX;
using SharpDX.Direct3D11;
using System.IO;
using System.Linq;
using System;
using System.Collections.ObjectModel;

#if NETFX_CORE
using Windows.UI.Xaml;
namespace HelixToolkit.UWP
#else
using System.Windows;
namespace HelixToolkit.Wpf.SharpDX
#endif
{
    using Model;
    using Shaders;
    using System.ComponentModel;
    using Utilities;


    public sealed class DiffuseMaterial : Material
    {
        /// <summary>
        /// The diffuse color property
        /// </summary>
        public static readonly DependencyProperty DiffuseColorProperty =
            DependencyProperty.Register("DiffuseColor", typeof(Color4), typeof(DiffuseMaterial), new PropertyMetadata((Color4)Color.White,
                (d, e) =>
                {
                    ((d as Material).Core as DiffuseMaterialCore).DiffuseColor = (Color4)e.NewValue;
                }));

        /// <summary>
        /// Gets or sets the diffuse color for the material.
        /// For details see: http://msdn.microsoft.com/en-us/library/windows/desktop/bb147175(v=vs.85).aspx
        /// </summary>
#if !NETFX_CORE
        [TypeConverter(typeof(Color4Converter))]
#endif
        public Color4 DiffuseColor
        {
            get { return (Color4)this.GetValue(DiffuseColorProperty); }
            set { this.SetValue(DiffuseColorProperty, value); }
        }

        /// <summary>
        /// 
        /// </summary>
        public static readonly DependencyProperty DiffuseMapProperty =
            DependencyProperty.Register("DiffuseMap", typeof(Stream), typeof(DiffuseMaterial), new PropertyMetadata(null,
                (d, e) => { ((d as Material).Core as DiffuseMaterialCore).DiffuseMap = e.NewValue as Stream; }));

        /// <summary>
        /// Gets or sets the diffuse map.
        /// </summary>
        /// <value>
        /// The diffuse map.
        /// </value>
        public Stream DiffuseMap
        {
            get { return (Stream)this.GetValue(DiffuseMapProperty); }
            set { this.SetValue(DiffuseMapProperty, value); }
        }

        /// <summary>
        /// 
        /// </summary>
        public static readonly DependencyProperty DiffuseMapSamplerProperty =
            DependencyProperty.Register("DiffuseMapSampler", typeof(SamplerStateDescription), typeof(DiffuseMaterial), new PropertyMetadata(DefaultSamplers.LinearSamplerWrapAni4,
                (d, e) => { ((d as Material).Core as DiffuseMaterialCore).DiffuseMapSampler = (SamplerStateDescription)e.NewValue; }));
        /// <summary>
        /// 
        /// </summary>
        public SamplerStateDescription DiffuseMapSampler
        {
            get { return (SamplerStateDescription)this.GetValue(DiffuseMapSamplerProperty); }
            set { this.SetValue(DiffuseMapSamplerProperty, value); }
        }
        /// <summary>
        /// The uv transform property
        /// </summary>
        public static readonly DependencyProperty UVTransformProperty =
            DependencyProperty.Register("UVTransform", typeof(Matrix), typeof(DiffuseMaterial), new PropertyMetadata(Matrix.Identity, (d, e) =>
            {
                ((d as Material).Core as DiffuseMaterialCore).UVTransform = (Matrix)e.NewValue;
            }));
        /// <summary>
        /// Gets or sets the texture uv transform.
        /// </summary>
        /// <value>
        /// The uv transform.
        /// </value>
        public Matrix UVTransform
        {
            get { return (Matrix)GetValue(UVTransformProperty); }
            set { SetValue(UVTransformProperty, value); }
        }


        /// <summary>
        /// Gets or sets a value indicating whether whether disable lighting. Directly render diffuse color and diffuse map.
        /// </summary>
        /// <value>
        ///   <c>true</c> if [enable un lit]; otherwise, <c>false</c>.
        /// </value>
        public bool EnableUnLit
        {
            get { return (bool)GetValue(EnableUnLitProperty); }
            set { SetValue(EnableUnLitProperty, value); }
        }

        /// <summary>
        /// The enable un lit property
        /// </summary>
        public static readonly DependencyProperty EnableUnLitProperty =
            DependencyProperty.Register("EnableUnLit", typeof(bool), typeof(DiffuseMaterial), new PropertyMetadata(false,
                (d,e)=> 
                {
                    ((d as Material).Core as DiffuseMaterialCore).EnableUnLit = (bool)e.NewValue;
                }));


        protected override MaterialCore OnCreateCore()
        {
            return new DiffuseMaterialCore()
            {
                DiffuseColor = DiffuseColor,
                DiffuseMap = DiffuseMap,
                UVTransform = UVTransform,
                DiffuseMapSampler = DiffuseMapSampler,
                EnableUnLit = EnableUnLit,
            };
        }

#if !NETFX_CORE
        protected override Freezable CreateInstanceCore()
        {
            return new DiffuseMaterial()
            {
                DiffuseColor = DiffuseColor,
                DiffuseMap = DiffuseMap,
                DiffuseMapSampler = DiffuseMapSampler,
                UVTransform = UVTransform,
                Name = Name,
                EnableUnLit = EnableUnLit,
            };
        }
#endif
    }

{'fraction_non_alphanumeric': 0.10714622864155575, 'fraction_numerical': 0.0033984706881903144, 'mean_word_length': 1.8977024070021882, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 73, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7321351', 'n_tokens_mistral': 2815, 'n_tokens_neox': 2662, 'n_words': 624}