Sfoglia il codice sorgente

Fixed issue with isntances and wireframe

David Catuhe 8 anni fa
parent
commit
8edec11f80

File diff suppressed because it is too large
+ 1789 - 1789
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 11 - 11
dist/preview release/babylon.js


+ 5 - 3
dist/preview release/babylon.max.js

@@ -21291,7 +21291,7 @@ var BABYLON;
                         engine.drawUnIndexed(false, subMesh.verticesStart, subMesh.verticesCount, instancesCount);
                     }
                     else {
-                        engine.draw(false, 0, instancesCount > 0 ? subMesh.linesIndexCount / 2 : subMesh.linesIndexCount, instancesCount);
+                        engine.draw(false, 0, subMesh.linesIndexCount, instancesCount);
                     }
                     break;
                 default:
@@ -21410,7 +21410,7 @@ var BABYLON;
             else {
                 instancesBuffer.updateDirectly(this._instancesData, 0, instancesCount);
             }
-            this.geometry._bind(effect);
+            this._bind(subMesh, effect, fillMode);
             this._draw(subMesh, fillMode, instancesCount);
             engine.unbindInstanceAttributes();
             return this;
@@ -21498,7 +21498,9 @@ var BABYLON;
             effectiveMaterial._preBind(effect);
             // Bind
             var fillMode = scene.forcePointsCloud ? BABYLON.Material.PointFillMode : (scene.forceWireframe ? BABYLON.Material.WireFrameFillMode : effectiveMaterial.fillMode);
-            this._bind(subMesh, effect, fillMode);
+            if (!hardwareInstancedRendering) {
+                this._bind(subMesh, effect, fillMode);
+            }
             var world = this.getWorldMatrix();
             if (effectiveMaterial.storeEffectOnSubMeshes) {
                 effectiveMaterial.bindForSubMesh(world, this, subMesh);

File diff suppressed because it is too large
+ 1789 - 1789
dist/preview release/babylon.module.d.ts


File diff suppressed because it is too large
+ 11 - 11
dist/preview release/babylon.worker.js


File diff suppressed because it is too large
+ 1900 - 1900
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


File diff suppressed because it is too large
+ 16 - 16
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 5 - 3
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -21291,7 +21291,7 @@ var BABYLON;
                         engine.drawUnIndexed(false, subMesh.verticesStart, subMesh.verticesCount, instancesCount);
                     }
                     else {
-                        engine.draw(false, 0, instancesCount > 0 ? subMesh.linesIndexCount / 2 : subMesh.linesIndexCount, instancesCount);
+                        engine.draw(false, 0, subMesh.linesIndexCount, instancesCount);
                     }
                     break;
                 default:
@@ -21410,7 +21410,7 @@ var BABYLON;
             else {
                 instancesBuffer.updateDirectly(this._instancesData, 0, instancesCount);
             }
-            this.geometry._bind(effect);
+            this._bind(subMesh, effect, fillMode);
             this._draw(subMesh, fillMode, instancesCount);
             engine.unbindInstanceAttributes();
             return this;
@@ -21498,7 +21498,9 @@ var BABYLON;
             effectiveMaterial._preBind(effect);
             // Bind
             var fillMode = scene.forcePointsCloud ? BABYLON.Material.PointFillMode : (scene.forceWireframe ? BABYLON.Material.WireFrameFillMode : effectiveMaterial.fillMode);
-            this._bind(subMesh, effect, fillMode);
+            if (!hardwareInstancedRendering) {
+                this._bind(subMesh, effect, fillMode);
+            }
             var world = this.getWorldMatrix();
             if (effectiveMaterial.storeEffectOnSubMeshes) {
                 effectiveMaterial.bindForSubMesh(world, this, subMesh);

File diff suppressed because it is too large
+ 1900 - 1900
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


+ 6 - 4
src/Mesh/babylon.mesh.ts

@@ -918,7 +918,7 @@
                     if (this._unIndexed) {
                         engine.drawUnIndexed(false, subMesh.verticesStart, subMesh.verticesCount, instancesCount);
                     } else {
-                        engine.draw(false, 0, instancesCount > 0 ? subMesh.linesIndexCount / 2 : subMesh.linesIndexCount, instancesCount);
+                        engine.draw(false, 0, subMesh.linesIndexCount, instancesCount);
                     }
                     break;
 
@@ -1058,8 +1058,7 @@
                 instancesBuffer.updateDirectly(this._instancesData, 0, instancesCount);
             }
 
-            this.geometry._bind(effect);
-
+            this._bind(subMesh, effect, fillMode);
             this._draw(subMesh, fillMode, instancesCount);
 
             engine.unbindInstanceAttributes();
@@ -1166,7 +1165,10 @@
 
             // Bind
             var fillMode = scene.forcePointsCloud ? Material.PointFillMode : (scene.forceWireframe ? Material.WireFrameFillMode : effectiveMaterial.fillMode);
-            this._bind(subMesh, effect, fillMode);
+
+            if (!hardwareInstancedRendering) { // Binding will be done later because we need to add more info to the VB
+                this._bind(subMesh, effect, fillMode);
+            }
 
             var world = this.getWorldMatrix();