Пример #1
0
        private MaterialData ProcessMaterials(Assimp.Mesh assImpMesh, Scene scene)
        {
            Assimp.Material assImpMeshMaterial = scene.Materials[assImpMesh.MaterialIndex];
            TextureData     diffuse            = ProcessTexture(TextureType.Diffuse, scene, assImpMeshMaterial);
            TextureData     normalMap          = ProcessTexture(TextureType.Height, scene, assImpMeshMaterial);
            TextureData     specularMap        = ProcessTexture(TextureType.Specular, scene, assImpMeshMaterial);

            MaterialData material = new MaterialData(diffuse, normalMap, specularMap);

            return(material);
        }
Пример #2
0
        private static TextureData ProcessTexture(TextureType textureType, Scene scene, Assimp.Material assImpMeshMaterial)
        {
            TextureData texture = new TextureData();
            TextureSlot textureSlot;

            assImpMeshMaterial.GetMaterialTexture(textureType, 0, out textureSlot);

            if (textureSlot.FilePath != null)
            {
                texture.fileName = textureSlot.FilePath;
            }

            return(texture);
        }