Skip to content

Remove material cache, some materials seem not work when cloned #2255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -619,11 +619,6 @@ protected byte[] getBytes(int bufferIndex, String uri, Integer bufferLength) thr
public Material readMaterial(int materialIndex) throws IOException {
assertNotNull(materials, "There is no material defined yet a mesh references one");

Material material = fetchFromCache("materials", materialIndex, Material.class);
if (material != null) {
return material.clone();
}

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

Expand Down Expand Up @@ -693,10 +688,7 @@ public Material readMaterial(int materialIndex) throws IOException {

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

material = adapter.getMaterial();
addToCache("materials", materialIndex, material, materials.size());

return material;
return adapter.getMaterial();
}

public void readCameras() throws IOException {
Expand Down