how do drawcalls work in three.js?

后端 未结 1 1012
感动是毒
感动是毒 2021-01-14 16:50

I have numerous potentially long polylines (or short, vertices count is highly volatile) to display, so I was thinking about packing them in a bunch of fixed size (let\'s sa

相关标签:
1条回答
  • 2021-01-14 17:00

    BufferGeometry.groups is now used to support multiple materials ( formerly MultiMaterial or MeshFaceMaterial ). For example,

    geometry.clearGroups();
    geometry.addGroup( start1, count1, 0 ); // materialIndex 0
    geometry.addGroup( start2, count2, 1 ); // materialIndex 1
    
    var mesh = new THREE.Mesh( geometry, materialsArray );
    

    Setting geometry.drawRange will render a sub-range of the geometry.

    geometry.setDrawRange( start, count );
    
    var material = new THREE.LineBasicMaterial( { color: 0xff0000 } );
    var line = new THREE.Line( geometry, material );
    

    fiddle: http://jsfiddle.net/w67tzfhx/

    three.js r.91

    0 讨论(0)
提交回复
热议问题