未验证 提交 669396fc 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #13552 from takahirox/GLTFExporterWeakMap

GLTFExporter: Use Map for cache.
......@@ -102,8 +102,8 @@ THREE.GLTFExporter.prototype = {
var skins = [];
var cachedData = {
materials: {},
textures: {}
materials: new Map(),
textures: new Map()
};
......@@ -593,9 +593,9 @@ THREE.GLTFExporter.prototype = {
*/
function processTexture( map ) {
if ( cachedData.textures[ map.uuid ] !== undefined ) {
if ( cachedData.textures.has( map ) ) {
return cachedData.textures[ map.uuid ];
return cachedData.textures.get( map );
}
......@@ -615,7 +615,7 @@ THREE.GLTFExporter.prototype = {
outputJSON.textures.push( gltfTexture );
var index = outputJSON.textures.length - 1;
cachedData.textures[ map.uuid ] = index;
cachedData.textures.set( map, index );
return index;
......@@ -628,9 +628,9 @@ THREE.GLTFExporter.prototype = {
*/
function processMaterial( material ) {
if ( cachedData.materials[ material.uuid ] !== undefined ) {
if ( cachedData.materials.has( material ) ) {
return cachedData.materials[ material.uuid ];
return cachedData.materials.get( material );
}
......@@ -810,7 +810,7 @@ THREE.GLTFExporter.prototype = {
outputJSON.materials.push( gltfMaterial );
var index = outputJSON.materials.length - 1;
cachedData.materials[ material.uuid ] = index;
cachedData.materials.set( material, index );
return index;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册