2017-01-08 30 views
0

我有麻烦,不知道如何解决或管理这种情况。 我只想得到一个另类纹理球面而是采用three.js所我想用一些附加码使用icosahedronbuffergeometry spherebuffergeometry生成指数以来我渲染使用drawelement代替drawarray。但结果不符合预期,请参阅下面的链接。如何在three.js中为二十面体缓冲区几何建立索引

修改都在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 

下面是使用改性icosahedronbuffergeometry icosahedron texturing

结果当使用spherebuffergeometry是如下 sphere buffer texturing

回答

0

做内的分析后几天后,我知道一些额外的代码是错误的。我现在明白,顶点缓冲区位置被复制多次以设置三角形,因此不需要创建索引或索引。可以通过替换代码来创建索引。 6以上与

6. idx.push(idx.length + counter); // in the loop in line 24194 

代码no。 3至no。 5不再需要。结果可以在上面的链接中看到,没有更多的缺失三角形面孔。

我认为可以重新创建PolyhedronBufferGeometry上的代码以提高效率。

相关问题