你好,使用 clearMemoryImmediately 需要设置Cesium.MemoryManager.setCacheSize() 缓存空间大小 ,具体可以在帮助文档搜索
MemoryManager查看详情
http://support.supermap.com.cn:8090/webgl/web/apis/3dwebgl.html 这是帮助文档链接,进去之后搜索 MemoryManager
/*加载单个模型*/ function loadMode(model) { var url = model["sceneUrl"]; var name = model["name"]; var dataurl = model["datasets"]; var destionation; if (model["x"] != undefined) { destionation = new Cesium.Cartesian3.fromDegrees(parseFloat(model["x"]), parseFloat(model["y"]), parseFloat(model[ "z"])); } centerposition = destionation; if (url != null && url.length != 0) { if (urlsadded.indexOf(url) == -1) { var promise = viewer.scene.open(url); Cesium.when(promise, function (layers) { //设置相机位置、方向,定位至模型 layers_all = layers; urlsadded.push(url); layersadded[name] = layers; if (model["x"] != undefined) { flytoposition(model); } for (var i = 0; i < layers.length; i++) { layer[i].visible = true; layers[i].clearMemoryImmediately = false; } }); } else { setLayersVisible(dataurl, name, true); if (model["x"] != undefined) { flytoposition(model); } } } }
现在我是用open()的方法直接载入模型的,但是我也设置了clearMemoryImmediately,你看是不是open这个方法不行,一定要用S3MTilesLayer方法调用模型才能实行不清除内存的效果
能不能帮我看看加在哪个位置 然后参数我该设置多少,有上限吗