github
2751 of 3655 branches covered (75.27%)
Branch coverage included in aggregate %.
23927 of 26953 relevant lines covered (88.77%)
1044.58 hits per line
1 |
const MODES = { |
1✔ |
2 |
FINAL: 0, // final color |
1✔ |
3 |
DEPTH: 1, // depth buffer |
1✔ |
4 |
ID: 2, // id object |
1✔ |
5 |
}; |
1✔ |
6 |
|
1✔ |
7 |
function push(object3d, mode) { |
|
8 |
const _mode = object3d.mode ?? MODES.FINAL; |
116✔ |
9 |
if (_mode == mode) {
|
|
10 |
return () => { };
|
× |
11 |
} |
× |
12 |
|
116✔ |
13 |
const setMode = m => ((node) => { |
|
14 |
const material = node.material; |
232✔ |
15 |
if (material) {
|
232✔ |
16 |
material.mode = m; |
232✔ |
17 |
} |
232✔ |
18 |
}); |
116✔ |
19 |
|
116✔ |
20 |
object3d.traverse(setMode(mode)); |
116✔ |
21 |
return () => { object3d.traverse(setMode(_mode)); };
|
|
22 |
} |
116✔ |
23 |
|
1✔ |
24 |
// Rendering mode
|
1✔ |
25 |
// According to the rendering mode, the material's object switches
|
1✔ |
26 |
// the mode property of the materials
|
1✔ |
27 |
export default { MODES, push }; |
1✔ |
28 |
|