Browse Source

enable undinexed linesMesh

Julien Barrois 6 years ago
parent
commit
c7fcc2cb07
2 changed files with 10 additions and 3 deletions
  1. 9 2
      src/Meshes/linesMesh.ts
  2. 1 1
      src/Meshes/mesh.ts

+ 9 - 2
src/Meshes/linesMesh.ts

@@ -172,7 +172,8 @@ export class LinesMesh extends Mesh {
         const colorEffect = this._colorShader.getEffect();
         const colorEffect = this._colorShader.getEffect();
 
 
         // VBOs
         // VBOs
-        this._geometry._bind(colorEffect);
+        const indexToBind = this.isUnIndexed ? null : this._geometry.getIndexBuffer();
+        this._geometry._bind(colorEffect, indexToBind);
 
 
         // Color
         // Color
         if (!this.useVertexColor) {
         if (!this.useVertexColor) {
@@ -193,7 +194,13 @@ export class LinesMesh extends Mesh {
         var engine = this.getScene().getEngine();
         var engine = this.getScene().getEngine();
 
 
         // Draw order
         // Draw order
-        engine.drawElementsType(Material.LineListDrawMode, subMesh.indexStart, subMesh.indexCount, instancesCount);
+
+        if (this._unIndexed) {
+            engine.drawArraysType(Material.LineListDrawMode, subMesh.verticesStart, subMesh.verticesCount, instancesCount);
+        }
+        else {
+            engine.drawElementsType(Material.LineListDrawMode, subMesh.indexStart, subMesh.indexCount, instancesCount);
+        }
         return this;
         return this;
     }
     }
 
 

+ 1 - 1
src/Meshes/mesh.ts

@@ -1289,7 +1289,7 @@ export class Mesh extends AbstractMesh implements IGetSetVerticesData {
                     break;
                     break;
                 default:
                 default:
                 case Material.TriangleFillMode:
                 case Material.TriangleFillMode:
-                    indexToBind = this._unIndexed ? null : this._geometry.getIndexBuffer();
+                    indexToBind = this._geometry.getIndexBuffer();
                     break;
                     break;
             }
             }
         }
         }