Exemplo n.º 1
0
        public void CreateBabylonMaterial(BabylonScene scene)
        {
            var babylonMaterial = new BabylonMaterial();
            scene.MaterialsList.Add(babylonMaterial);

            // Guid
            babylonMaterial.id = ID.ToString();

            // Name
            babylonMaterial.name = Name;

            // Data
            babylonMaterial.backFaceCulling = BackFaceCulling;
            babylonMaterial.diffuse = Diffuse.ToArray();
            babylonMaterial.emissive = Emissive.ToArray();
            babylonMaterial.specular = Specular.ToArray();
            babylonMaterial.specularPower = SpecularPower;
            babylonMaterial.alpha = Alpha;

            if (string.IsNullOrEmpty(DiffuseTexture))
            {
                babylonMaterial.diffuseTexture = null;
                return;
            }

            babylonMaterial.diffuseTexture = new BabylonTexture();
            babylonMaterial.diffuseTexture.name = Path.GetFileName(DiffuseTexture);

            scene.AddTexture(DiffuseTexture);
        }