提交 df3a92e8 编写于 作者: M Mr.doob

InstancedMesh: Exposed count property.

上级 b3ebbe46
......@@ -13,6 +13,7 @@
import * as THREE from '../build/three.module.js';
import Stats from './jsm/libs/stats.module.js';
import { GUI } from './jsm/libs/dat.gui.module.js';
var camera, scene, renderer, stats;
......@@ -36,7 +37,6 @@
// check overdraw
// var material = new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.1, transparent: true } );
var loader = new THREE.BufferGeometryLoader();
loader.load( 'models/json/suzanne_buffergeometry.json', function ( geometry ) {
......@@ -46,6 +46,11 @@
mesh = new THREE.InstancedMesh( geometry, material, count );
scene.add( mesh );
//
var gui = new GUI();
gui.add( mesh, 'count', 0, count );
} );
//
......
......@@ -11,6 +11,8 @@ function InstancedMesh( geometry, material, count ) {
this.instanceMatrix = new BufferAttribute( new Float32Array( count * 16 ), 16 );
this.count = count;
}
InstancedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), {
......
......@@ -865,7 +865,7 @@ function WebGLRenderer( parameters ) {
if ( object.isInstancedMesh ) {
renderer.renderInstances( geometry, drawStart, drawCount, object.instanceMatrix.count );
renderer.renderInstances( geometry, drawStart, drawCount, object.count );
} else if ( geometry.isInstancedBufferGeometry ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册