2017-01-08 29 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上的代碼以提高效率。

相關問題