瀏覽代碼

strictNullChecks step 6

David Catuhe 7 年之前
父節點
當前提交
b052b46c2a

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


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


+ 2 - 2
src/Lights/Shadows/babylon.shadowGenerator.ts

@@ -561,7 +561,7 @@
 
                 // Bones
                 if (mesh.useBones && mesh.computeBonesUsingShaders) {
-                    this._effect.setMatrices("mBones", mesh.skeleton.getTransformMatrices(mesh));
+                    this._effect.setMatrices("mBones", (<Skeleton>mesh.skeleton).getTransformMatrices((mesh));
                 }
 
                 if (this.forceBackFacesOnly) {
@@ -687,7 +687,7 @@
                     attribs.push(VertexBuffer.MatricesWeightsExtraKind);
                 }
                 defines.push("#define NUM_BONE_INFLUENCERS " + mesh.numBoneInfluencers);
-                defines.push("#define BonesPerMesh " + (mesh.skeleton.bones.length + 1));
+                defines.push("#define BonesPerMesh " + ((<Skeleton>mesh.skeleton).bones.length + 1));
             } else {
                 defines.push("#define NUM_BONE_INFLUENCERS 0");
             }

+ 1 - 1
src/Mesh/babylon.csg.ts

@@ -563,7 +563,7 @@
             mesh.setVerticesData(VertexBuffer.PositionKind, vertices);
             mesh.setVerticesData(VertexBuffer.NormalKind, normals);
             mesh.setVerticesData(VertexBuffer.UVKind, uvs);
-            mesh.setIndices(indices);
+            mesh.setIndices(indices, null);
 
             if (keepSubMeshes) {
                 // We offset the materialIndex by the previous number of materials in the CSG mixed meshes

+ 2 - 2
src/Mesh/babylon.geometry.ts

@@ -911,7 +911,7 @@
 
                 if (binaryInfo.indicesAttrDesc && binaryInfo.indicesAttrDesc.count > 0) {
                     var indicesData = new Int32Array(parsedGeometry, binaryInfo.indicesAttrDesc.offset, binaryInfo.indicesAttrDesc.count);
-                    mesh.setIndices(indicesData);
+                    mesh.setIndices(indicesData, null);
                 }
 
                 if (binaryInfo.subMeshesAttrDesc && binaryInfo.subMeshesAttrDesc.count > 0) {
@@ -1010,7 +1010,7 @@
                     mesh.setVerticesData(VertexBuffer.MatricesWeightsExtraKind, parsedGeometry.matricesWeightsExtra, parsedGeometry.matricesWeights._updatable);
                 }
 
-                mesh.setIndices(parsedGeometry.indices);
+                mesh.setIndices(parsedGeometry.indices, null);
             }
 
             // SubMeshes

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

@@ -84,7 +84,7 @@
         */
         public onBeforeDrawObservable = new Observable<Mesh>();
 
-        private _onBeforeDrawObserver: Observer<Mesh>;
+        private _onBeforeDrawObserver: Nullable<Observer<Mesh>>;
         public set onBeforeDraw(callback: () => void) {
             if (this._onBeforeDrawObserver) {
                 this.onBeforeDrawObservable.remove(this._onBeforeDrawObserver);
@@ -160,7 +160,7 @@
          *                  This will make creation of children, recursive.
          * @param {boolean} clonePhysicsImpostor When cloning, include cloning mesh physics impostor, default True.
          */
-        constructor(name: string, scene: Scene, parent: Node = null, source?: Mesh, doNotCloneChildren?: boolean, clonePhysicsImpostor: boolean = true) {
+        constructor(name: string, scene: Scene, parent: Nullable<Node> = null, source?: Mesh, doNotCloneChildren?: boolean, clonePhysicsImpostor: boolean = true) {
             super(name, scene);
 
             if (source) {
@@ -840,7 +840,7 @@
          * This method creates a new index buffer each call.  
          * Returns the Mesh.  
          */
-        public setIndices(indices: IndicesArray, totalVertices?: number, updatable?: boolean): Mesh {
+        public setIndices(indices: IndicesArray, totalVertices: Nullable<number>, updatable?: boolean): Mesh {
             if (!this._geometry) {
                 var vertexData = new VertexData();
                 vertexData.indices = indices;

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

@@ -6,7 +6,7 @@
         isVerticesDataPresent(kind: string): boolean;
         getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): Nullable<number[] | Float32Array>;
         getIndices(copyWhenShared?: boolean): Nullable<IndicesArray>;
-        setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean): void;
+        setVerticesData(kind: string, data: number[] | Float32Array, updatable: boolean): void;
         updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): void;
         setIndices(indices: IndicesArray, totalVertices: Nullable<number>, updatable?: boolean): void;
     }

+ 6 - 6
src/Physics/babylon.physicsImpostor.ts

@@ -9,11 +9,11 @@ module BABYLON {
 
     export interface IPhysicsEnabledObject {
         position: Vector3;
-        rotationQuaternion: Quaternion;
+        rotationQuaternion: Nullable<Quaternion>;
         scaling: Vector3;
         rotation?: Vector3;
         parent?: any;
-        getBoundingInfo?(): BoundingInfo;
+        getBoundingInfo(): Nullable<BoundingInfo>;
         computeWorldMatrix?(force: boolean): void;
         getWorldMatrix?(): Matrix;
         getChildMeshes?(directDecendantsOnly?: boolean): Array<AbstractMesh>;
@@ -29,7 +29,7 @@ module BABYLON {
 
         public static IDENTITY_QUATERNION = Quaternion.Identity();
 
-        private _physicsEngine: PhysicsEngine;
+        private _physicsEngine: Nullable<PhysicsEngine>;
         //The native cannon/oimo/energy physics body object.
         private _physicsBody: any;
         private _bodyUpdateRequired: boolean = false;
@@ -55,7 +55,7 @@ module BABYLON {
         }
 
         get mass(): number {
-            return this._physicsEngine.getPhysicsPlugin().getBodyMass(this);
+            return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyMass(this) : 0;
         }
 
         set mass(value: number) {
@@ -63,7 +63,7 @@ module BABYLON {
         }
 
         get friction(): number {
-            return this._physicsEngine.getPhysicsPlugin().getBodyFriction(this);
+            return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyFriction(this) : 0;
         }
 
         set friction(value: number) {
@@ -141,7 +141,7 @@ module BABYLON {
             }
         }
 
-        private _getPhysicsParent(): PhysicsImpostor {
+        private _getPhysicsParent(): Nullable<PhysicsImpostor> {
             if (this.object.parent instanceof AbstractMesh) {
                 var parentMesh: AbstractMesh = <AbstractMesh>this.object.parent;
                 return parentMesh.physicsImpostor;