public Material readMaterial(int materialIndex) throws IOException {
        assertNotNull(materials, "There is no material defined yet a mesh references one");

        JsonObject matData = materials.get(materialIndex).getAsJsonObject();
        JsonObject pbrMat = matData.getAsJsonObject("pbrMetallicRoughness");

        MaterialAdapter adapter = null;

        if (pbrMat != null) {
            adapter = getAdapterForMaterial(info, "pbrMetallicRoughness");
            if (adapter == null) {
                adapter = defaultMaterialAdapters.get("pbrMetallicRoughness");
            }
            adapter.init(info.getManager());
        }

        adapter = customContentManager.readExtensionAndExtras("material", matData, adapter);

        if (adapter == null) {
            logger.log(Level.WARNING,
                    "Couldn't find any matching material definition for material " + materialIndex);
            adapter = defaultMaterialAdapters.get("pbrMetallicRoughness");
            adapter.init(info.getManager());
            setDefaultParams(adapter.getMaterial());
        }

        Integer metallicRoughnessIndex = null;
        if (pbrMat != null) {
            adapter.setParam("baseColorFactor", getAsColor(pbrMat, "baseColorFactor", ColorRGBA.White));
            adapter.setParam("metallicFactor", getAsFloat(pbrMat, "metallicFactor", 1f));
            adapter.setParam("roughnessFactor", getAsFloat(pbrMat, "roughnessFactor", 1f));
            adapter.setParam("baseColorTexture", readTexture(pbrMat.getAsJsonObject("baseColorTexture")));
            adapter.setParam("metallicRoughnessTexture",
                    readTexture(pbrMat.getAsJsonObject("metallicRoughnessTexture")));
            JsonObject metallicRoughnessJson = pbrMat.getAsJsonObject("metallicRoughnessTexture");
            metallicRoughnessIndex = metallicRoughnessJson != null ? getAsInteger(metallicRoughnessJson, "index") : null;            
        }

        adapter.getMaterial().setName(getAsString(matData, "name"));
        adapter.setParam("emissiveFactor", getAsColor(matData, "emissiveFactor", ColorRGBA.Black));
        String alphaMode = getAsString(matData, "alphaMode");
        adapter.setParam("alphaMode", alphaMode);
        if (alphaMode != null && alphaMode.equals("MASK")) {
            adapter.setParam("alphaCutoff", getAsFloat(matData, "alphaCutoff"));
        }
        adapter.setParam("doubleSided", getAsBoolean(matData, "doubleSided"));
        Texture2D normal = readTexture(matData.getAsJsonObject("normalTexture"));
        adapter.setParam("normalTexture", normal);
        if (normal != null) {
            useNormalsFlag = true;

            JsonObject normalTexture = matData.getAsJsonObject("normalTexture");
            Float normalScale = getAsFloat(normalTexture, "scale");
            if (normalScale != null) {
                adapter.setParam("normalScale", normalScale);
            }
        }
        JsonObject occlusionJson = matData.getAsJsonObject("occlusionTexture");
        Integer occlusionIndex = occlusionJson != null ? getAsInteger(occlusionJson, "index") : null;
        if (occlusionIndex != null && occlusionIndex.equals(metallicRoughnessIndex)) {
            adapter.getMaterial().setBoolean("AoPackedInMRMap", true);
        } else {        
            adapter.setParam("occlusionTexture", readTexture(matData.getAsJsonObject("occlusionTexture")));
        }

        Float occlusionStrength = occlusionJson != null ? getAsFloat(occlusionJson, "strength") : null;
        if (occlusionStrength != null) {
            adapter.setParam("occlusionStrength", occlusionStrength);
        }

        adapter.setParam("emissiveTexture", readTexture(matData.getAsJsonObject("emissiveTexture")));

        return adapter.getMaterial();
    }
GLTF 2.0 loader
Created by Nehon on 07/08/2017.
jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfLoader.java