コード例 #1
0
        public void UpdateFromModel()
        {
            var material = Controller.Material;

            if (material.Diffuse.Albedo is Texture)
            {
                diffuseTexture.Image = TextureConverter.Convert(material.Diffuse.Albedo as Texture);
            }
            else
            {
                diffuseTexture.BackColor = material.Diffuse.Albedo[0, 0].ToSystemDrawing();
                diffuseTexture.Image     = null;
            }

            if (material.Emissive.Albedo is Texture)
            {
                emissiveTexture.Image = TextureConverter.Convert(material.Emissive.Albedo as Texture);
            }
            else
            {
                emissiveTexture.BackColor = material.Emissive.Albedo[0, 0].ToSystemDrawing();
                emissiveTexture.Image     = null;
            }

            if (material.Reflective.Albedo is Texture)
            {
                reflectiveTexture.Image = TextureConverter.Convert(material.Reflective.Albedo as Texture);
            }
            else
            {
                reflectiveTexture.BackColor = material.Reflective.Albedo[0, 0].ToSystemDrawing();
                reflectiveTexture.Image     = null;
            }

            if (material.Refractive.Albedo is Texture)
            {
                refractiveTexture.Image = TextureConverter.Convert(material.Refractive.Albedo as Texture);
            }
            else
            {
                refractiveTexture.BackColor = material.Refractive.Albedo[0, 0].ToSystemDrawing();
                refractiveTexture.Image     = null;
            }

            refractiveIndexUpDown.Value       = (decimal)material.Refractive.RefractiveIndex;
            reflectiveDisturbanceUpDown.Value = (decimal)material.Reflective.Disturbance;
            diffuseShareUpDown.Value          = (decimal)material.Parts.diffuse;
            reflectiveShareUpDown.Value       = (decimal)material.Parts.reflective;
            refractiveShareUpDown.Value       = (decimal)material.Parts.refractive;
            emissiveShareUpDown.Value         = (decimal)material.Parts.emissive;
            ampUpDown.Value = (decimal)material.Emissive.Amplification;
        }
コード例 #2
0
        private void refractiveFile_Click(object sender, EventArgs e)
        {
            var texturePath = ChooseTexture();

            if (string.IsNullOrEmpty(texturePath))
            {
                return;
            }

            var texture = new Texture(texturePath);

            Controller.Material.Refractive.Albedo = texture;
            refractiveTexture.Image = TextureConverter.Convert(texture);
        }