コード例 #1
0
ファイル: Material.cs プロジェクト: JWEC/SharpDX_Demo
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="material">Material loaded</param>
        public Material(MaterialData material)
        {
            Diffuse = material.Diffuse;
            Ambient = material.Ambient;
            Specular = material.Specular;
            SpecularPower = material.SpecularPower;
            Emissive = material.Emissive;

            DiffuseTextureName = Path.GetFileName(material.DiffuseTexture);
        }
コード例 #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="material">Material loaded</param>
        public Material(MaterialData material)
        {
            Diffuse       = material.Diffuse;
            Ambient       = material.Ambient;
            Specular      = material.Specular;
            SpecularPower = material.SpecularPower;
            Emissive      = material.Emissive;

            DiffuseTextureName = Path.GetFileName(material.DiffuseTexture);
        }
コード例 #3
0
        private static MaterialData GetMaterial(XDocument document, string materialName)
        {
            MaterialData matData = new MaterialData();

            XElement mate = document.GetByID(materialName);
            if (mate == null)
                return matData;
            XElement node = mate.GetNode("instance_effect");
            if (node == null)
                return matData;

            XElement effect = document.GetReference(node);
            //Get Data from Standard Material
            if (effect != null)
            {
                matData.Ambient = GetColor(effect, "ambient");
                matData.Diffuse = GetColor(effect, "diffuse");
                matData.DiffuseTexture = GetTextureName(effect, "diffuse");
                matData.Ambient = GetColor(effect, "ambient");
                matData.Emissive = GetColor(effect, "emission");
                matData.Specular = GetColor(effect, "specular");
                matData.SpecularPower = GetValue(effect, "shininess");
            }

            return matData;
        }