Forráskód Böngészése

Merge pull request #7761 from Popov72/fix-instancebug

Instances: master mesh does not have correct instance buffer values
mergify[bot] 5 éve
szülő
commit
0e5d349a76
2 módosított fájl, 3 hozzáadás és 1 törlés
  1. 1 0
      dist/preview release/what's new.md
  2. 2 1
      src/Meshes/instancedMesh.ts

+ 1 - 0
dist/preview release/what's new.md

@@ -35,5 +35,6 @@
 - `QuadraticErrorSimplification` was not exported ([RaananW](https://github.com/Raananw)
 - Fix NME Frames bug where collapsing and moving a frame removed the nodes inside ([Kyle Belfort](https://github.com/belfortk)
 - Fix moving / disappearing controls when freezing/unfreezing the ScrollViewer ([Popov72](https://github.com/Popov72)
+- Fix: when using instances, master mesh (if displayed) does not have correct instance buffer values ([Popov72](https://github.com/Popov72)
 
 ## Breaking changes

+ 2 - 1
src/Meshes/instancedMesh.ts

@@ -535,7 +535,6 @@ Mesh.prototype._processInstancedBuffers = function(visibleInstances: InstancedMe
         // Update data buffer
         let offset = 0;
         if (renderSelf) {
-            offset += stride;
             let value = this.instancedBuffers[kind];
 
             if (value.toArray) {
@@ -543,6 +542,8 @@ Mesh.prototype._processInstancedBuffers = function(visibleInstances: InstancedMe
             } else {
                 value.copyToArray(data, offset);
             }
+
+            offset += stride;
         }
 
         for (var instanceIndex = 0; instanceIndex < instanceCount; instanceIndex++) {