@@ -15,7 +15,7 @@ export default class VBOMesh {
1515 this . vertex_layout = vertex_layout ;
1616 this . vertex_buffer = this . gl . createBuffer ( ) ;
1717 this . buffer_size = this . vertex_data . byteLength ;
18- this . draw_mode = options . wireframe ? this . gl . LINES : ( options . draw_mode || this . gl . TRIANGLES ) ;
18+ this . draw_mode = options . draw_mode || this . gl . TRIANGLES ;
1919 this . data_usage = options . data_usage || this . gl . STATIC_DRAW ;
2020 this . vertices_per_geometry = 3 ; // TODO: support lines, strip, fan, etc.
2121 this . uniforms = options . uniforms ;
@@ -29,31 +29,7 @@ export default class VBOMesh {
2929 this . vaos = { } ; // map of VertexArrayObjects, keyed by program
3030
3131 this . toggle_element_array = false ;
32-
3332 if ( this . element_data ) {
34- // NB: wireframe mode only works with triangles, provided as element data
35- // undefined results if passing in vertex buffer only, or non-triangle draw mode
36- if ( options . wireframe ) {
37- const wireframe_data = new Uint16Array ( this . element_data . length * 2 ) ;
38- // Draw triangles as lines:
39- // Make a copy of element_data, and for every group of three vertices, duplicate
40- // each vertex according to the following pattern:
41- // [1, 2, 3] => [1, 2, 2, 3, 3, 1]
42- // This takes three vertices which would have been interpreted as a triangle,
43- // and converts them into three 2-vertex line segments.
44- for ( let i = 0 ; i < this . element_data . length ; i += 3 ) {
45- wireframe_data . set ( [
46- this . element_data [ i ] ,
47- this . element_data [ i + 1 ] ,
48- this . element_data [ i + 1 ] ,
49- this . element_data [ i + 2 ] ,
50- this . element_data [ i + 2 ] ,
51- this . element_data [ i ]
52- ] , i * 2
53- ) ;
54- }
55- this . element_data = wireframe_data ;
56- }
5733 this . toggle_element_array = true ;
5834 this . element_count = this . element_data . length ;
5935 this . geometry_count = this . element_count / this . vertices_per_geometry ;
0 commit comments