Pārlūkot izejas kodu

Move transformFeedback out of base engine

David Catuhe 7 gadi atpakaļ
vecāks
revīzija
5a7654de82

+ 13 - 2
Tools/Gulp/config.json

@@ -121,7 +121,8 @@
             "photoDome",
             "behaviors",
             "imageProcessing",
-            "occlusionQuery"     
+            "occlusionQuery",
+            "transformFeedback"     
         ],
         "minimal": [
             "meshBuilder",
@@ -235,6 +236,15 @@
                 "fogFragment"
             ]
         },
+        "transformFeedback": {
+            "files": [
+                "../../src/Engine/Extensions/babylon.engine.transformFeedback.js"
+            ],
+            "dependUpon": [
+                "core",
+                "debug"
+            ]
+        },          
         "occlusionQuery": {
             "files": [
                 "../../src/Engine/Extensions/babylon.engine.occlusionQuery.js"
@@ -285,7 +295,8 @@
             ],
             "dependUpon": [
                 "core",
-                "particles"
+                "particles",
+                "transformFeedback"
             ],
             "shaders": [
                 "gpuRenderParticles.vertex",

+ 74 - 0
src/Engine/Extensions/babylon.engine.transformFeedback.ts

@@ -0,0 +1,74 @@
+module BABYLON {
+    export interface Engine {
+        /**
+         * Creates a webGL transform feedback object
+         * Please makes sure to check webGLVersion property to check if you are running webGL 2+
+         * @returns the webGL transform feedback object
+         */
+        createTransformFeedback(): WebGLTransformFeedback;      
+        
+        /**
+         * Delete a webGL transform feedback object 
+         * @param value defines the webGL transform feedback object to delete
+         */
+        deleteTransformFeedback(value: WebGLTransformFeedback): void; 
+
+        /**
+         * Bind a webGL transform feedback object to the webgl context
+         * @param value defines the webGL transform feedback object to bind
+         */        
+        bindTransformFeedback(value: Nullable<WebGLTransformFeedback>): void;
+
+        /**
+         * Begins a transform feedback operation
+         * @param usePoints defines if points or triangles must be used
+         */              
+        beginTransformFeedback(usePoints: boolean): void;
+
+        /**
+         * Ends a transform feedback operation
+         */           
+        endTransformFeedback(): void;
+
+        /**
+         * Specify the varyings to use with transform feedback
+         * @param program defines the associated webGL program
+         * @param value defines the list of strings representing the varying names
+         */
+        setTranformFeedbackVaryings(program: WebGLProgram, value: string[]): void;
+        
+        /**
+         * Bind a webGL buffer for a transform feedback operation
+         * @param value defines the webGL buffer to bind
+         */          
+        bindTransformFeedbackBuffer(value: Nullable<WebGLBuffer>): void;
+    }
+
+    Engine.prototype.createTransformFeedback = function(): WebGLTransformFeedback {
+        return this._gl.createTransformFeedback();
+    }
+
+    Engine.prototype.deleteTransformFeedback = function(value: WebGLTransformFeedback): void {
+        this._gl.deleteTransformFeedback(value);
+    }
+
+    Engine.prototype.bindTransformFeedback = function(value: Nullable<WebGLTransformFeedback>): void {
+        this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK, value);
+    }
+
+    Engine.prototype.beginTransformFeedback = function(usePoints: boolean = true): void {
+        this._gl.beginTransformFeedback(usePoints ? this._gl.POINTS : this._gl.TRIANGLES);
+    }
+
+    Engine.prototype.endTransformFeedback = function(): void {
+        this._gl.endTransformFeedback();
+    }
+
+    Engine.prototype.setTranformFeedbackVaryings = function(program: WebGLProgram, value: string[]): void {
+        this._gl.transformFeedbackVaryings(program, value, this._gl.INTERLEAVED_ATTRIBS);
+    }
+
+    Engine.prototype.bindTransformFeedbackBuffer = function(value: Nullable<WebGLBuffer>): void {
+        this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER, 0, value);
+    }
+}

+ 0 - 59
src/Engine/babylon.engine.ts

@@ -7219,65 +7219,6 @@
             return this._gl.RGBA8;
         };
 
-        // Transform feedback
-
-        /**
-         * Creates a webGL transform feedback object
-         * Please makes sure to check webGLVersion property to check if you are running webGL 2+
-         * @returns the webGL transform feedback object
-         */
-        public createTransformFeedback(): WebGLTransformFeedback {
-            return this._gl.createTransformFeedback();
-        }
-
-        /**
-         * Delete a webGL transform feedback object 
-         * @param value defines the webGL transform feedback object to delete
-         */
-        public deleteTransformFeedback(value: WebGLTransformFeedback): void {
-            this._gl.deleteTransformFeedback(value);
-        }
-
-        /**
-         * Bind a webGL transform feedback object to the webgl context
-         * @param value defines the webGL transform feedback object to bind
-         */        
-        public bindTransformFeedback(value: Nullable<WebGLTransformFeedback>): void {
-            this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK, value);
-        }
-
-        /**
-         * Begins a transform feedback operation
-         * @param usePoints defines if points or triangles must be used
-         */              
-        public beginTransformFeedback(usePoints: boolean = true): void {
-            this._gl.beginTransformFeedback(usePoints ? this._gl.POINTS : this._gl.TRIANGLES);
-        }
-
-        /**
-         * Ends a transform feedback operation
-         */           
-        public endTransformFeedback(): void {
-            this._gl.endTransformFeedback();
-        }
-
-        /**
-         * Specify the varyings to use with transform feedback
-         * @param program defines the associated webGL program
-         * @param value defines the list of strings representing the varying names
-         */
-        public setTranformFeedbackVaryings(program: WebGLProgram, value: string[]): void {
-            this._gl.transformFeedbackVaryings(program, value, this._gl.INTERLEAVED_ATTRIBS);
-        }
-
-        /**
-         * Bind a webGL buffer for a transform feedback operation
-         * @param value defines the webGL buffer to bind
-         */          
-        public bindTransformFeedbackBuffer(value: Nullable<WebGLBuffer>): void {
-            this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER, 0, value);
-        }
-
         /** @hidden */
         public _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, database?: Database, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest {
             let request = Tools.LoadFile(url, onSuccess, onProgress, database, useArrayBuffer, onError);