Przeglądaj źródła

Merge pull request #5194 from BabylonJS/instanceLineMesh

For review - do not merge
David Catuhe 7 lat temu
rodzic
commit
8188fc77fe

Plik diff jest za duży
+ 6911 - 6897
Playground/babylon.d.txt


Plik diff jest za duży
+ 6843 - 6829
dist/preview release/babylon.d.ts


Plik diff jest za duży
+ 1 - 1
dist/preview release/babylon.js


Plik diff jest za duży
+ 240 - 197
dist/preview release/babylon.max.js


Plik diff jest za duży
+ 240 - 197
dist/preview release/babylon.no-module.max.js


Plik diff jest za duży
+ 1 - 1
dist/preview release/babylon.worker.js


Plik diff jest za duży
+ 240 - 197
dist/preview release/es6.js


+ 32 - 15
dist/preview release/viewer/babylon.viewer.d.ts

@@ -924,7 +924,7 @@ declare module BabylonViewer {
       * @param name the name of the custom optimizer configuration
       * @param name the name of the custom optimizer configuration
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       */
       */
-    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 }
 declare module BabylonViewer {
 declare module BabylonViewer {
@@ -1558,20 +1558,6 @@ declare module BabylonViewer {
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
 }
 }
 declare module BabylonViewer {
 declare module BabylonViewer {
-    /**
-        * A custom upgrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedUpgrade(sceneManager: SceneManager): boolean;
-    /**
-        * A custom degrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedDegrade(sceneManager: SceneManager): boolean;
-}
-declare module BabylonViewer {
 }
 }
 declare module BabylonViewer {
 declare module BabylonViewer {
     export interface IEnvironmentMapConfiguration {
     export interface IEnvironmentMapConfiguration {
@@ -1598,6 +1584,37 @@ declare module BabylonViewer {
     }
     }
 }
 }
 declare module BabylonViewer {
 declare module BabylonViewer {
+    /**
+        * The EventManager is in charge of registering user interctions with the viewer.
+        * It is used in the TemplateManager
+        */
+    export class EventManager {
+            constructor(_templateManager: TemplateManager);
+            /**
+                * Register a new callback to a specific template.
+                * The best example for the usage can be found in the DefaultViewer
+                *
+                * @param templateName the templateName to register the event to
+                * @param callback The callback to be executed
+                * @param eventType the type of event to register
+                * @param selector an optional selector. if not defined the parent object in the template will be selected
+                */
+            registerCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
+            /**
+                * This will remove a registered event from the defined template.
+                * Each one of the variables apart from the template name are optional, but one must be provided.
+                *
+                * @param templateName the templateName
+                * @param callback the callback to remove (optional)
+                * @param eventType the event type to remove (optional)
+                * @param selector the selector from which to remove the event (optional)
+                */
+            unregisterCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
+            /**
+                * Dispose the event manager
+                */
+            dispose(): void;
+    }
 }
 }
 declare module BabylonViewer {
 declare module BabylonViewer {
     /**
     /**

Plik diff jest za duży
+ 2 - 2
dist/preview release/viewer/babylon.viewer.js


Plik diff jest za duży
+ 2 - 2
dist/preview release/viewer/babylon.viewer.max.js


+ 33 - 19
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -985,14 +985,13 @@ declare module 'babylonjs-viewer/templating/viewerTemplatePlugin' {
 }
 }
 
 
 declare module 'babylonjs-viewer/optimizer/custom' {
 declare module 'babylonjs-viewer/optimizer/custom' {
-    import { extendedUpgrade } from "babylonjs-viewer/optimizer/custom/extended";
     import { SceneManager } from "babylonjs-viewer/managers/sceneManager";
     import { SceneManager } from "babylonjs-viewer/managers/sceneManager";
     /**
     /**
       *
       *
       * @param name the name of the custom optimizer configuration
       * @param name the name of the custom optimizer configuration
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       */
       */
-    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 }
 
 
@@ -1663,22 +1662,6 @@ declare module 'babylonjs-viewer/loader/plugins' {
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
 }
 }
 
 
-declare module 'babylonjs-viewer/optimizer/custom/extended' {
-    import { SceneManager } from 'babylonjs-viewer/managers/sceneManager';
-    /**
-        * A custom upgrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedUpgrade(sceneManager: SceneManager): boolean;
-    /**
-        * A custom degrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedDegrade(sceneManager: SceneManager): boolean;
-}
-
 declare module 'babylonjs-viewer/configuration/interfaces' {
 declare module 'babylonjs-viewer/configuration/interfaces' {
     export * from 'babylonjs-viewer/configuration/interfaces/cameraConfiguration';
     export * from 'babylonjs-viewer/configuration/interfaces/cameraConfiguration';
     export * from 'babylonjs-viewer/configuration/interfaces/colorGradingConfiguration';
     export * from 'babylonjs-viewer/configuration/interfaces/colorGradingConfiguration';
@@ -1723,7 +1706,38 @@ declare module 'babylonjs-viewer/configuration/interfaces/environmentMapConfigur
 }
 }
 
 
 declare module 'babylonjs-viewer/templating/eventManager' {
 declare module 'babylonjs-viewer/templating/eventManager' {
-    
+    import { EventCallback, TemplateManager } from "babylonjs-viewer/templating/templateManager";
+    /**
+        * The EventManager is in charge of registering user interctions with the viewer.
+        * It is used in the TemplateManager
+        */
+    export class EventManager {
+            constructor(_templateManager: TemplateManager);
+            /**
+                * Register a new callback to a specific template.
+                * The best example for the usage can be found in the DefaultViewer
+                *
+                * @param templateName the templateName to register the event to
+                * @param callback The callback to be executed
+                * @param eventType the type of event to register
+                * @param selector an optional selector. if not defined the parent object in the template will be selected
+                */
+            registerCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
+            /**
+                * This will remove a registered event from the defined template.
+                * Each one of the variables apart from the template name are optional, but one must be provided.
+                *
+                * @param templateName the templateName
+                * @param callback the callback to remove (optional)
+                * @param eventType the event type to remove (optional)
+                * @param selector the selector from which to remove the event (optional)
+                */
+            unregisterCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
+            /**
+                * Dispose the event manager
+                */
+            dispose(): void;
+    }
 }
 }
 
 
 declare module 'babylonjs-viewer/labs/viewerLabs' {
 declare module 'babylonjs-viewer/labs/viewerLabs' {

+ 157 - 20
src/Engine/Extensions/babylon.engine.occlusionQuery.ts

@@ -1,4 +1,25 @@
 module BABYLON {
 module BABYLON {
+    /** @hidden */
+    class _OcclusionDataStorage {
+        /** @hidden */
+        public occlusionInternalRetryCounter = 0;
+
+        /** @hidden */
+        public isOcclusionQueryInProgress = false;
+
+        /** @hidden */
+        public isOccluded = false;
+
+        /** @hidden */
+        public occlusionRetryCount = -1;
+
+        /** @hidden */
+        public occlusionType = AbstractMesh.OCCLUSION_TYPE_NONE;
+
+        /** @hidden */
+        public occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
+    }
+
     export interface Engine {       
     export interface Engine {       
         /**
         /**
          * Create a new webGL query (you must be sure that queries are supported by checking getCaps() function)
          * Create a new webGL query (you must be sure that queries are supported by checking getCaps() function)
@@ -248,23 +269,138 @@ module BABYLON {
         return algorithmType === AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE ? this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE : this._gl.ANY_SAMPLES_PASSED;
         return algorithmType === AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE ? this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE : this._gl.ANY_SAMPLES_PASSED;
     }
     }
 
 
+    export interface AbstractMesh {
+        /**
+         * Backing filed 
+         * @hidden 
+         */
+        __occlusionDataStorage: _OcclusionDataStorage;
+
+        /**
+         * Access property
+         * @hidden
+         */
+        _occlusionDataStorage: _OcclusionDataStorage;
+
+        /**
+        * This number indicates the number of allowed retries before stop the occlusion query, this is useful if the occlusion query is taking long time before to the query result is retireved, the query result indicates if the object is visible within the scene or not and based on that Babylon.Js engine decideds to show or hide the object.
+        * The default value is -1 which means don't break the query and wait till the result
+        * @see http://doc.babylonjs.com/features/occlusionquery
+        */
+        occlusionRetryCount: number;
+
+        /**
+         * This property is responsible for starting the occlusion query within the Mesh or not, this property is also used to determine what should happen when the occlusionRetryCount is reached. It has supports 3 values:
+         * * OCCLUSION_TYPE_NONE (Default Value): this option means no occlusion query whith the Mesh.
+         * * OCCLUSION_TYPE_OPTIMISTIC: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken show the mesh.
+         * * OCCLUSION_TYPE_STRICT: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken restore the last state of the mesh occlusion if the mesh was visible then show the mesh if was hidden then hide don't show.
+         * @see http://doc.babylonjs.com/features/occlusionquery
+         */
+        occlusionType: number;
+
+        /**
+        * This property determines the type of occlusion query algorithm to run in WebGl, you can use:
+        * * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE which is mapped to GL_ANY_SAMPLES_PASSED.
+        * * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE (Default Value) which is mapped to GL_ANY_SAMPLES_PASSED_CONSERVATIVE which is a false positive algorithm that is faster than GL_ANY_SAMPLES_PASSED but less accurate.
+        * @see http://doc.babylonjs.com/features/occlusionquery
+        */
+        occlusionQueryAlgorithmType: number; 
+
+        /**
+        * Gets or sets whether the mesh is occluded or not, it is used also to set the intial state of the mesh to be occluded or not
+        * @see http://doc.babylonjs.com/features/occlusionquery
+        */
+       isOccluded: boolean;
+
+        /**
+         * Flag to check the progress status of the query
+         * @see http://doc.babylonjs.com/features/occlusionquery
+         */
+        isOcclusionQueryInProgress: boolean;
+    }
+
+    Object.defineProperty(AbstractMesh.prototype, "isOcclusionQueryInProgress", {
+        get: function (this:AbstractMesh) {
+            return this._occlusionDataStorage.isOcclusionQueryInProgress;
+        },
+        enumerable: false,
+        configurable: true
+    });  
+
+    Object.defineProperty(AbstractMesh.prototype, "_occlusionDataStorage", {
+        get: function (this:AbstractMesh) {
+            if (!this.__occlusionDataStorage) {
+                this.__occlusionDataStorage = new _OcclusionDataStorage();
+            }
+            return this.__occlusionDataStorage;
+        },
+        enumerable: false,
+        configurable: true
+    });     
+
+    Object.defineProperty(AbstractMesh.prototype, "isOccluded", {
+        get: function (this:AbstractMesh) {
+            return this._occlusionDataStorage.isOccluded;
+        },
+        set: function(this:AbstractMesh, value: boolean) {
+            this._occlusionDataStorage.isOccluded = value;
+        },
+        enumerable: true,
+        configurable: true
+    });     
+
+    Object.defineProperty(AbstractMesh.prototype, "occlusionQueryAlgorithmType", {
+        get: function (this:AbstractMesh) {
+            return this._occlusionDataStorage.occlusionQueryAlgorithmType;
+        },
+        set: function(this:AbstractMesh, value: number) {
+            this._occlusionDataStorage.occlusionQueryAlgorithmType = value;
+        },
+        enumerable: true,
+        configurable: true
+    });  
+
+    Object.defineProperty(AbstractMesh.prototype, "occlusionType", {
+        get: function (this:AbstractMesh) {
+            return this._occlusionDataStorage.occlusionType;
+        },
+        set: function(this:AbstractMesh, value: number) {
+            this._occlusionDataStorage.occlusionType = value;
+        },
+        enumerable: true,
+        configurable: true
+    });    
+
+    Object.defineProperty(AbstractMesh.prototype, "occlusionRetryCount", {
+        get: function (this:AbstractMesh) {
+            return this._occlusionDataStorage.occlusionRetryCount;
+        },
+        set: function(this:AbstractMesh, value: number) {
+            this._occlusionDataStorage.occlusionRetryCount = value;
+        },
+        enumerable: true,
+        configurable: true
+    });
+
     // We also need to update AbstractMesh as there is a portion of the code there
     // We also need to update AbstractMesh as there is a portion of the code there
     AbstractMesh.prototype._checkOcclusionQuery = function() {
     AbstractMesh.prototype._checkOcclusionQuery = function() {
-        if (this.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
-            this._isOccluded = false;
-            return;
+        let dataStorage = this._occlusionDataStorage;
+
+        if (dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
+            dataStorage.isOccluded = false;
+            return false;
         }
         }
 
 
         var engine = this.getEngine();
         var engine = this.getEngine();
 
 
         if (engine.webGLVersion < 2) {
         if (engine.webGLVersion < 2) {
-            this._isOccluded = false;
-            return;
+            dataStorage.isOccluded = false;
+            return false;
         }
         }
 
 
         if (!engine.isQueryResultAvailable) { // Occlusion query where not referenced
         if (!engine.isQueryResultAvailable) { // Occlusion query where not referenced
-            this._isOccluded = false;
-            return;
+            dataStorage.isOccluded = false;
+            return false;
         }
         }
 
 
         if (this.isOcclusionQueryInProgress && this._occlusionQuery) {
         if (this.isOcclusionQueryInProgress && this._occlusionQuery) {
@@ -273,26 +409,25 @@ module BABYLON {
             if (isOcclusionQueryAvailable) {
             if (isOcclusionQueryAvailable) {
                 var occlusionQueryResult = engine.getQueryResult(this._occlusionQuery);
                 var occlusionQueryResult = engine.getQueryResult(this._occlusionQuery);
 
 
-                this._isOcclusionQueryInProgress = false;
-                this._occlusionInternalRetryCounter = 0;
-                this._isOccluded = occlusionQueryResult === 1 ? false : true;
+                dataStorage.isOcclusionQueryInProgress = false;
+                dataStorage.occlusionInternalRetryCounter = 0;
+                dataStorage.isOccluded = occlusionQueryResult === 1 ? false : true;
             }
             }
             else {
             else {
 
 
-                this._occlusionInternalRetryCounter++;
+                dataStorage.occlusionInternalRetryCounter++;
 
 
-                if (this.occlusionRetryCount !== -1 && this._occlusionInternalRetryCounter > this.occlusionRetryCount) {
-                    this._isOcclusionQueryInProgress = false;
-                    this._occlusionInternalRetryCounter = 0;
+                if (dataStorage.occlusionRetryCount !== -1 && dataStorage.occlusionInternalRetryCounter > dataStorage.occlusionRetryCount) {
+                    dataStorage.isOcclusionQueryInProgress = false;
+                    dataStorage.occlusionInternalRetryCounter = 0;
 
 
                     // if optimistic set isOccluded to false regardless of the status of isOccluded. (Render in the current render loop)
                     // if optimistic set isOccluded to false regardless of the status of isOccluded. (Render in the current render loop)
                     // if strict continue the last state of the object.
                     // if strict continue the last state of the object.
-                    this._isOccluded = this.occlusionType === AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC ? false : this._isOccluded;
+                    dataStorage.isOccluded = dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC ? false : dataStorage.isOccluded;
                 }
                 }
                 else {
                 else {
-                    return;
+                    return false;
                 }
                 }
-
             }
             }
         }
         }
 
 
@@ -304,10 +439,12 @@ module BABYLON {
                 this._occlusionQuery = engine.createQuery();
                 this._occlusionQuery = engine.createQuery();
             }
             }
 
 
-            engine.beginOcclusionQuery(this.occlusionQueryAlgorithmType, this._occlusionQuery);
+            engine.beginOcclusionQuery(dataStorage.occlusionQueryAlgorithmType, this._occlusionQuery);
             occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);
             occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);
-            engine.endOcclusionQuery(this.occlusionQueryAlgorithmType);
-            this._isOcclusionQueryInProgress = true;
+            engine.endOcclusionQuery(dataStorage.occlusionQueryAlgorithmType);
+            this._occlusionDataStorage.isOcclusionQueryInProgress = true;
         }
         }
+
+        return dataStorage.isOccluded;
     } 
     } 
 }
 }

+ 5 - 3
src/Materials/babylon.shaderMaterial.ts

@@ -202,9 +202,6 @@
             var defines = [];
             var defines = [];
             var attribs = [];
             var attribs = [];
             var fallbacks = new EffectFallbacks();
             var fallbacks = new EffectFallbacks();
-            if (useInstances) {
-                defines.push("#define INSTANCES");
-            }
 
 
             for (var index = 0; index < this._options.defines.length; index++) {
             for (var index = 0; index < this._options.defines.length; index++) {
                 defines.push(this._options.defines[index]);
                 defines.push(this._options.defines[index]);
@@ -219,6 +216,11 @@
                 defines.push("#define VERTEXCOLOR");
                 defines.push("#define VERTEXCOLOR");
             }
             }
 
 
+            if (useInstances) {
+                defines.push("#define INSTANCES");
+                MaterialHelper.PrepareAttributesForInstances(attribs, defines);
+            }
+
             // Bones
             // Bones
             if (mesh && mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {
             if (mesh && mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {
                 attribs.push(VertexBuffer.MatricesIndicesKind);
                 attribs.push(VertexBuffer.MatricesIndicesKind);

+ 3 - 55
src/Mesh/babylon.abstractMesh.ts

@@ -196,58 +196,6 @@
          */
          */
         public definedFacingForward = true; 
         public definedFacingForward = true; 
 
 
-        /**
-        * This property determines the type of occlusion query algorithm to run in WebGl, you can use:
-        * * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE which is mapped to GL_ANY_SAMPLES_PASSED.
-        * * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE (Default Value) which is mapped to GL_ANY_SAMPLES_PASSED_CONSERVATIVE which is a false positive algorithm that is faster than GL_ANY_SAMPLES_PASSED but less accurate.
-        * @see http://doc.babylonjs.com/features/occlusionquery
-        */
-        public occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
-
-        /**
-         * This property is responsible for starting the occlusion query within the Mesh or not, this property is also used to determine what should happen when the occlusionRetryCount is reached. It has supports 3 values:
-         * * OCCLUSION_TYPE_NONE (Default Value): this option means no occlusion query whith the Mesh.
-         * * OCCLUSION_TYPE_OPTIMISTIC: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken show the mesh.
-         * * OCCLUSION_TYPE_STRICT: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken restore the last state of the mesh occlusion if the mesh was visible then show the mesh if was hidden then hide don't show.
-         * @see http://doc.babylonjs.com/features/occlusionquery
-         */
-        public occlusionType = AbstractMesh.OCCLUSION_TYPE_NONE;
-
-        /**
-        * This number indicates the number of allowed retries before stop the occlusion query, this is useful if the occlusion query is taking long time before to the query result is retireved, the query result indicates if the object is visible within the scene or not and based on that Babylon.Js engine decideds to show or hide the object.
-        * The default value is -1 which means don't break the query and wait till the result
-        * @see http://doc.babylonjs.com/features/occlusionquery
-        */
-        public occlusionRetryCount = -1;
-        /** @hidden */
-        public _occlusionInternalRetryCounter = 0;
-
-        /** @hidden */
-        public _isOccluded = false;
-
-        /**
-        * Gets or sets whether the mesh is occluded or not, it is used also to set the intial state of the mesh to be occluded or not
-        * @see http://doc.babylonjs.com/features/occlusionquery
-        */
-        public get isOccluded(): boolean {
-            return this._isOccluded;
-        }
-
-        public set isOccluded(value: boolean) {
-            this._isOccluded = value;
-        }
-
-        /** @hidden */
-        public _isOcclusionQueryInProgress = false;
-
-        /**
-         * Flag to check the progress status of the query
-         * @see http://doc.babylonjs.com/features/occlusionquery
-         */
-        public get isOcclusionQueryInProgress(): boolean {
-            return this._isOcclusionQueryInProgress;
-        }
-
         /** @hidden */
         /** @hidden */
         public _occlusionQuery: Nullable<WebGLQuery>;
         public _occlusionQuery: Nullable<WebGLQuery>;
 
 
@@ -1489,7 +1437,7 @@
             // Query
             // Query
             let engine = this.getScene().getEngine();
             let engine = this.getScene().getEngine();
             if (this._occlusionQuery) {
             if (this._occlusionQuery) {
-                this._isOcclusionQueryInProgress = false;
+                this.isOcclusionQueryInProgress = false;
                 engine.deleteQuery(this._occlusionQuery);
                 engine.deleteQuery(this._occlusionQuery);
                 this._occlusionQuery = null;
                 this._occlusionQuery = null;
             }
             }
@@ -1960,8 +1908,8 @@
         }
         }
 
 
         /** @hidden */
         /** @hidden */
-        public _checkOcclusionQuery() { // Will be replaced by correct code if Occlusion queries are referenced
-            this._isOccluded = false;
+        public _checkOcclusionQuery(): boolean { // Will be replaced by correct code if Occlusion queries are referenced
+            return false;
         }
         }
     }
     }
 }
 }

+ 2 - 6
src/Mesh/babylon.linesMesh.ts

@@ -46,7 +46,7 @@
 
 
             var defines: String[] = [];
             var defines: String[] = [];
             var options = {
             var options = {
-                attributes: [VertexBuffer.PositionKind],
+                attributes: [VertexBuffer.PositionKind, "world0", "world1", "world2", "world3"],
                 uniforms: ["world", "viewProjection"],
                 uniforms: ["world", "viewProjection"],
                 needAlphaBlending: true,
                 needAlphaBlending: true,
                 defines: defines
                 defines: defines
@@ -95,10 +95,6 @@
             return false;
             return false;
         }
         }
 
 
-        public createInstance(name: string): InstancedMesh {
-            throw new Error("LinesMeshes do not support createInstance.");
-        }
-
         /** @hidden */
         /** @hidden */
         public _bind(subMesh: SubMesh, effect: Effect, fillMode: number): LinesMesh {
         public _bind(subMesh: SubMesh, effect: Effect, fillMode: number): LinesMesh {
             if (!this._geometry) {
             if (!this._geometry) {
@@ -123,7 +119,7 @@
             var engine = this.getScene().getEngine();
             var engine = this.getScene().getEngine();
 
 
             // Draw order
             // Draw order
-            engine.drawElementsType(Material.LineListDrawMode, subMesh.indexStart, subMesh.indexCount);
+            engine.drawElementsType(Material.LineListDrawMode, subMesh.indexStart, subMesh.indexCount, instancesCount);
             return this;
             return this;
         }
         }
 
 

+ 1 - 3
src/Mesh/babylon.mesh.ts

@@ -1480,9 +1480,7 @@
          * @returns the current mesh
          * @returns the current mesh
          */
          */
         public render(subMesh: SubMesh, enableAlphaMode: boolean): Mesh {
         public render(subMesh: SubMesh, enableAlphaMode: boolean): Mesh {
-
-            this._checkOcclusionQuery();
-            if (this._isOccluded) {
+            if (this._checkOcclusionQuery()) {
                 return this;
                 return this;
             }
             }
 
 

+ 3 - 2
src/Shaders/color.vertex.fx

@@ -8,8 +8,9 @@ attribute vec4 color;
 #include<bonesDeclaration>
 #include<bonesDeclaration>
 
 
 // Uniforms
 // Uniforms
+
+#include<instancesDeclaration>
 uniform mat4 viewProjection;
 uniform mat4 viewProjection;
-uniform mat4 world;
 
 
 // Output
 // Output
 #ifdef VERTEXCOLOR
 #ifdef VERTEXCOLOR
@@ -17,7 +18,7 @@ varying vec4 vColor;
 #endif
 #endif
 
 
 void main(void) {
 void main(void) {
-    mat4 finalWorld = world;
+#include<instancesVertex>
 #include<bonesVertex>
 #include<bonesVertex>
 	gl_Position = viewProjection * finalWorld * vec4(position, 1.0);
 	gl_Position = viewProjection * finalWorld * vec4(position, 1.0);