[英]How to create indices for icosahedronbuffergeometry in three.js
我遇到了麻烦,不知道如何解决或处理这种情况。 我只想要一个替代的纹理球体,而不是在three.js中使用spherebuffergeometry,我想使用icosahedronbuffergeometry和一些附加代码来生成索引,因为我使用drawelement而不是drawarray进行渲染。 但是结果与预期不符,请参见下面的链接。
修改在PolyhedronBufferGeometry函数上,如下所示:
1. var idx = []; // line 24097
2. this.setIndex( new ( Uint16Attribute )( idx, 1 ) ); // line 24119
3. var iv = []; // line 24157 to store temp indices
4. var iCount = idx.length; // line 24157
5. iv[ i ][ j ] = ij ; ij++; // in the loop in line 24174
6. idx.push( iCount+ iv[ i ][ k + 1 ]); // in the loop in line 24194
当使用spherebuffergeometry是如下球体缓冲器纹理
经过几天的分析,我知道其他一些代码是错误的。 我现在知道,顶点缓冲区位置被复制了多次以设置三角形,因此不需要创建索引或索引。 只需替换代码即可创建索引。 6以上
6. idx.push( idx.length + counter); // in the loop in line 24194
代码编号 3到无。 5不再需要。 可以在上面的链接上看到结果,不再有丢失的三角形面。
我认为可以重新创建PolyhedronBufferGeometry上的代码,以提高效率。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.