赣州市洪水风险预警系统三维版本
guoshilong
2023-02-27 4d8c6dd77427e8e581fda17b6b65ba86bfb7a815
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import ForEach from './ForEach.js'
import defined from '../../Core/defined.js'
 
    /**
     * Iterate through the objects within the glTF and delete their pipeline extras object.
     *
     * @param {Object} gltf A javascript object containing a glTF asset.
     * @returns {Object} glTF with no pipeline extras.
     *
     * @private
     */
    function removePipelineExtras(gltf) {
        ForEach.shader(gltf, function(shader) {
            removeExtras(shader);
        });
        ForEach.buffer(gltf, function(buffer) {
            removeExtras(buffer);
        });
        ForEach.image(gltf, function (image) {
            removeExtras(image);
            ForEach.compressedImage(image, function(compressedImage) {
                removeExtras(compressedImage);
            });
        });
 
        removeExtras(gltf);
 
        return gltf;
    }
 
    function removeExtras(object) {
        if (!defined(object.extras)) {
            return;
        }
 
        if (defined(object.extras._pipeline)) {
            delete object.extras._pipeline;
        }
 
        if (Object.keys(object.extras).length === 0) {
            delete object.extras;
        }
    }
 
    export default removePipelineExtras;