| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- /**
- * @author mrdoob / http://mrdoob.com/
- */
- function WebGLBufferRenderer( gl, extensions, info ) {
- var mode;
- function setMode( value ) {
- mode = value;
- }
- function render( start, count ) {
- gl.drawArrays( mode, start, count );
- info.update( count, mode );
- }
- function renderInstances( geometry, start, count ) {
- var extension;
- if ( gl.isWebGL2 ) {
- extension = gl;
- } else {
- extension = extensions.get( 'ANGLE_instanced_arrays' );
- if ( extension === null ) {
- console.error( 'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );
- return;
- }
- }
- extension[ gl.isWebGL2 ? 'drawArraysInstanced' : 'drawArraysInstancedANGLE' ]( mode, start, count, geometry.maxInstancedCount );
- info.update( count, mode, geometry.maxInstancedCount );
- }
- //
- this.setMode = setMode;
- this.render = render;
- this.renderInstances = renderInstances;
- }
- export { WebGLBufferRenderer };
|