{ geometries1: (5) [{…}, {…}, {…}, {…}, {…}] images1: (20) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}] materials1: (21) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}] textures1: (20) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {...} }在for(let i = 0; i < aaaa.value.length; i++){}中分为aaaa.value.length份,并添加到aaaa.value中
时间: 2023-07-24 08:44:31 浏览: 55
osgcatch1.rar_osg_osgcatch1_visual c
好的,您想问的是如何将场景数据中的几何体、图像、材质和纹理对象分别添加到另一组同类型的数组中是吗?
可以使用for循环遍历场景数据中的几何体、图像、材质和纹理对象数组,并将它们分别添加到另一组同类型的数组中。代码示例如下:
```javascript
let newGeometries = [];
let newImages = [];
let newMaterials = [];
let newTextures = [];
for(let i = 0; i < sceneData.geometries1.length; i++){
newGeometries.push(sceneData.geometries1[i]);
}
for(let i = 0; i < sceneData.images1.length; i++){
newImages.push(sceneData.images1[i]);
}
for(let i = 0; i < sceneData.materials1.length; i++){
newMaterials.push(sceneData.materials1[i]);
}
for(let i = 0; i < sceneData.textures1.length; i++){
newTextures.push(sceneData.textures1[i]);
}
// 将新的数组赋值给另一组同类型的数组
aaaa.valueGeometries = newGeometries;
aaaa.valueImages = newImages;
aaaa.valueMaterials = newMaterials;
aaaa.valueTextures = newTextures;
```
这样,场景数据中的几何体、图像、材质和纹理对象就会被添加到新的同类型数组中,最后将这些新数组赋值给目标数组即可。
阅读全文