浏览代码

AmmoPhysics: Moved drawUsage logic to example.

Mr.doob 4 年之前
父节点
当前提交
1da44f66f1
共有 2 个文件被更改,包括 2 次插入1 次删除
  1. 0 1
      examples/jsm/physics/AmmoPhysics.js
  2. 2 0
      examples/physics_ammo_instancing.html

+ 0 - 1
examples/jsm/physics/AmmoPhysics.js

@@ -137,7 +137,6 @@ async function AmmoPhysics() {
 
 		if ( mass > 0 ) {
 
-			mesh.instanceMatrix.setUsage( 35048 ); // THREE.DynamicDrawUsage = 35048
 			meshes.push( mesh );
 
 			meshMap.set( mesh, bodies );

+ 2 - 0
examples/physics_ammo_instancing.html

@@ -72,6 +72,7 @@
 
 				const geometryBox = new THREE.BoxGeometry( 0.1, 0.1, 0.1 );
 				boxes = new THREE.InstancedMesh( geometryBox, material, 100 );
+				boxes.instanceMatrix.setUsage( THREE.DynamicDrawUsage ); // will be updated every frame
 				boxes.castShadow = true;
 				boxes.receiveShadow = true;
 				scene.add( boxes );
@@ -90,6 +91,7 @@
 
 				const geometrySphere = new THREE.IcosahedronGeometry( 0.075, 3 );
 				spheres = new THREE.InstancedMesh( geometrySphere, material, 100 );
+				spheres.instanceMatrix.setUsage( THREE.DynamicDrawUsage ); // will be updated every frame
 				spheres.castShadow = true;
 				spheres.receiveShadow = true;
 				scene.add( spheres );