Skip to content
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

Cache Source instead of Texture instances in material system #5455

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions src/components/material.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,13 @@ function parseBlending (blending) {
function disposeMaterial (material, system) {
material.dispose();
system.unregisterMaterial(material);

// Dispose textures on this material
Object.keys(material)
.filter(function (propName) {
return material[propName] && material[propName].isTexture;
})
.forEach(function (mapName) {
material[mapName].dispose();
});
}
3 changes: 0 additions & 3 deletions src/core/shader.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,6 @@ Shader.prototype = {
color = new THREE.Color(value);
return new THREE.Vector3(color.r, color.g, color.b);
}
case 'map': {
return THREE.ImageUtils.loadTexture(value);
}
default: {
return value;
}
Expand Down
Loading
Loading