Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript 我可以为索引使用InterleavedBufferAttribute吗?_Typescript_Three.js - Fatal编程技术网

Typescript 我可以为索引使用InterleavedBufferAttribute吗?

Typescript 我可以为索引使用InterleavedBufferAttribute吗?,typescript,three.js,Typescript,Three.js,我有以下代码片段: const geometry = new THREE.BufferGeometry(); const indices = new THREE.InterleavedBufferAttribute(...); geometry.setIndex(indices); // this is invalid 最后一行导致编译器错误: 类型“InterleavedBufferAttribute”缺少类型“Bufferattribute”中的以下属性:dynamic、updateRan

我有以下代码片段:

const geometry = new THREE.BufferGeometry();
const indices = new THREE.InterleavedBufferAttribute(...);
geometry.setIndex(indices); // this is invalid
最后一行导致编译器错误:

类型“InterleavedBufferAttribute”缺少类型“Bufferattribute”中的以下属性:dynamic、updateRange、version、needsUpdate等

我甚至可以使用
InterleavedBufferAttribute
来设置索引吗


旁注:一般情况下,索引可以使用交错数组吗?我是说语言独立。我从来没见过。这显然不是主要问题,但我很感兴趣。

不,一般来说,你不能交错索引。交错索引没有意义

你会用什么来穿插它们

一般来说,你可以交错一些东西,比如位置、法线、纹理坐标、颜色。而不是使用并行数组具有4个属性

position, position, position, position
normal, normal, normal, normal
uv, uv, uv, uv,
color, color, color, color
您有一个交错数组

pos,nrm,uv,clr,pos,nrm,uv,clr,pos,nrm,uv,clr,pos,nrm,uv,clr
现在是指数。假设我们正在制作四边形,所以有4个顶点 和6项指数。如何将6个索引与4个顶点交错?你不能


索引引用属性中的内容,它们本身不是属性。

不,通常不能交错索引。交错索引没有意义

你会用什么来穿插它们

一般来说,你可以交错一些东西,比如位置、法线、纹理坐标、颜色。而不是使用并行数组具有4个属性

position, position, position, position
normal, normal, normal, normal
uv, uv, uv, uv,
color, color, color, color
您有一个交错数组

pos,nrm,uv,clr,pos,nrm,uv,clr,pos,nrm,uv,clr,pos,nrm,uv,clr
现在是指数。假设我们正在制作四边形,所以有4个顶点 和6项指数。如何将6个索引与4个顶点交错?你不能


索引引用属性中的内容,它们本身不是属性。

您计划如何在
索引
属性上交错?它的项目大小为
1
,因此您甚至无法将3个索引打包在一起。选中此项查看如何在同一缓冲区中打包不同类型的数据。不,通常不能交错索引。交错索引毫无意义。您计划如何在
索引
属性上进行交错?它的项目大小为
1
,因此您甚至无法将3个索引打包在一起。选中此项查看如何在同一缓冲区中打包不同类型的数据。不,通常不能交错索引。交错索引没有意义。