浏览代码

Moving engine and starting nullEngine

David Catuhe 7 年之前
父节点
当前提交
af867dc1e5

+ 11 - 2
Tools/Gulp/config.json

@@ -75,7 +75,8 @@
             "probes",
             "layer",
             "textureTools",
-            "cameraBehaviors"
+            "cameraBehaviors",
+            "nullEngine"
         ],
         "minimal": [
             "standardMaterial",
@@ -175,7 +176,7 @@
                 "../../src/States/babylon.alphaCullingState.js",
                 "../../src/States/babylon.depthCullingState.js",
                 "../../src/States/babylon.stencilState.js",
-                "../../src/babylon.engine.js",
+                "../../src/Engine/babylon.engine.js",
                 "../../src/babylon.node.js",
                 "../../src/Culling/babylon.boundingSphere.js",
                 "../../src/Culling/babylon.boundingBox.js",
@@ -220,6 +221,14 @@
                 "particles.fragment"
             ]
         },
+        "nullEngine": {
+            "files": [
+                "../../src/Engine/babylon.nullEngine.js"
+            ],
+            "dependUpon": [
+                "core"
+            ]
+        },        
         "cameraBehaviors": {
             "files": [
                 "../../src/Behaviors/Cameras/babylon.framingBehavior.js",

文件差异内容过多而无法显示
+ 4503 - 4493
dist/preview release/babylon.d.ts


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/babylon.js


文件差异内容过多而无法显示
+ 19 - 0
dist/preview release/babylon.max.js


文件差异内容过多而无法显示
+ 4503 - 4493
dist/preview release/babylon.module.d.ts


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/babylon.worker.js


文件差异内容过多而无法显示
+ 2243 - 2233
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


文件差异内容过多而无法显示
+ 3 - 3
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


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

@@ -7793,6 +7793,9 @@ var BABYLON;
             };
             var canvas;
             Engine.Instances.push(this);
+            if (!canvasOrContext) {
+                return;
+            }
             options = options || {};
             if (canvasOrContext.getContext) {
                 canvas = canvasOrContext;

文件差异内容过多而无法显示
+ 2243 - 2233
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


+ 6 - 1
src/babylon.engine.ts

@@ -628,7 +628,7 @@
         public onVRRequestPresentStart = new Observable<Engine>();
 
         private _hardwareScalingLevel: number;
-        private _caps: EngineCapabilities;
+        protected _caps: EngineCapabilities;
         private _pointerLockRequested: boolean;
         private _alphaTest: boolean;
         private _isStencilEnable: boolean;
@@ -761,6 +761,11 @@
         constructor(canvasOrContext: HTMLCanvasElement | WebGLRenderingContext, antialias?: boolean, options?: EngineOptions, adaptToDeviceRatio = false) {
             var canvas: HTMLCanvasElement;
             Engine.Instances.push(this);
+
+            if (!canvasOrContext) {
+                return;
+            }
+
             options = options || {};
 
             if ((<HTMLCanvasElement>canvasOrContext).getContext) {

+ 57 - 0
src/Engine/babylon.nullEngine.ts

@@ -0,0 +1,57 @@
+module BABYLON {
+   
+    /**
+     * The null engine class provides support for headless version of babylon.js.
+     * This can be used in server side scenario or for testing purposes
+     */
+    export class NullEngine extends Engine {     
+        public constructor() {
+            super(null);
+
+            // Init caps
+            // We consider we are on a webgl1 capable device
+
+            this._caps = new EngineCapabilities();
+            this._caps.maxTexturesImageUnits = 16;
+            this._caps.maxVertexTextureImageUnits = 16;
+            this._caps.maxTextureSize = 512;
+            this._caps.maxCubemapTextureSize = 512;
+            this._caps.maxRenderTextureSize = 512;
+            this._caps.maxVertexAttribs = 16;
+            this._caps.maxVaryingVectors = 16;
+            this._caps.maxFragmentUniformVectors = 16;
+            this._caps.maxVertexUniformVectors = 16;
+
+            // Extensions
+            this._caps.standardDerivatives = false;
+
+            this._caps.astc = null;
+            this._caps.s3tc = null;
+            this._caps.pvrtc = null;
+            this._caps.etc1 = null;
+            this._caps.etc2 = null;
+
+            this._caps.textureAnisotropicFilterExtension = null;
+            this._caps.maxAnisotropy = 0;
+            this._caps.uintIndices = false;
+            this._caps.fragmentDepthSupported = false;
+            this._caps.highPrecisionShaderSupported = true;
+
+            this._caps.colorBufferFloat = false;
+            this._caps.textureFloat = false;
+            this._caps.textureFloatLinearFiltering = false;
+            this._caps.textureFloatRender = false;
+
+            this._caps.textureHalfFloat = false;
+            this._caps.textureHalfFloatLinearFiltering = false;
+            this._caps.textureHalfFloatRender = false;
+
+            this._caps.textureLOD = false;
+            this._caps.drawBuffersExtension = false;
+
+            this._caps.depthTextureExtension = false;
+            this._caps.vertexArrayObject = false;
+            this._caps.instancedArrays = false;
+        }
+    }
+}

src/babylon.webgl2.ts → src/Engine/babylon.webgl2.ts