瀏覽代碼

[threejs] Closes #1412, added dispose() method to SkeletonMesh and required underlying code.

badlogic 6 年之前
父節點
當前提交
2b5e521c34

+ 2 - 0
spine-ts/build/spine-all.d.ts

@@ -1807,6 +1807,7 @@ declare module spine.threejs {
 		private indices;
 		private indicesLength;
 		constructor(maxVertices?: number);
+		dispose(): void;
 		clear(): void;
 		begin(): void;
 		canBatch(verticesLength: number, indicesLength: number): boolean;
@@ -1836,6 +1837,7 @@ declare module spine.threejs {
 		private tempColor;
 		constructor(skeletonData: SkeletonData);
 		update(deltaTime: number): void;
+		dispose(): void;
 		private clearBatches();
 		private nextBatch();
 		private updateGeometry();

+ 9 - 0
spine-ts/build/spine-all.js

@@ -11048,6 +11048,10 @@ var spine;
 				_this.material = new threejs.SkeletonMeshMaterial();
 				return _this;
 			}
+			MeshBatcher.prototype.dispose = function () {
+				this.geometry.dispose();
+				this.material.dispose();
+			};
 			MeshBatcher.prototype.clear = function () {
 				var geo = this.geometry;
 				geo.drawRange.start = 0;
@@ -11159,6 +11163,11 @@ var spine;
 				skeleton.updateWorldTransform();
 				this.updateGeometry();
 			};
+			SkeletonMesh.prototype.dispose = function () {
+				for (var i = 0; i < this.batches.length; i++) {
+					this.batches[i].dispose();
+				}
+			};
 			SkeletonMesh.prototype.clearBatches = function () {
 				for (var i = 0; i < this.batches.length; i++) {
 					this.batches[i].clear();

文件差異過大導致無法顯示
+ 0 - 0
spine-ts/build/spine-all.js.map


+ 2 - 0
spine-ts/build/spine-threejs.d.ts

@@ -1341,6 +1341,7 @@ declare module spine.threejs {
 		private indices;
 		private indicesLength;
 		constructor(maxVertices?: number);
+		dispose(): void;
 		clear(): void;
 		begin(): void;
 		canBatch(verticesLength: number, indicesLength: number): boolean;
@@ -1370,6 +1371,7 @@ declare module spine.threejs {
 		private tempColor;
 		constructor(skeletonData: SkeletonData);
 		update(deltaTime: number): void;
+		dispose(): void;
 		private clearBatches();
 		private nextBatch();
 		private updateGeometry();

+ 9 - 0
spine-ts/build/spine-threejs.js

@@ -8166,6 +8166,10 @@ var spine;
 				_this.material = new threejs.SkeletonMeshMaterial();
 				return _this;
 			}
+			MeshBatcher.prototype.dispose = function () {
+				this.geometry.dispose();
+				this.material.dispose();
+			};
 			MeshBatcher.prototype.clear = function () {
 				var geo = this.geometry;
 				geo.drawRange.start = 0;
@@ -8277,6 +8281,11 @@ var spine;
 				skeleton.updateWorldTransform();
 				this.updateGeometry();
 			};
+			SkeletonMesh.prototype.dispose = function () {
+				for (var i = 0; i < this.batches.length; i++) {
+					this.batches[i].dispose();
+				}
+			};
 			SkeletonMesh.prototype.clearBatches = function () {
 				for (var i = 0; i < this.batches.length; i++) {
 					this.batches[i].clear();

文件差異過大導致無法顯示
+ 0 - 0
spine-ts/build/spine-threejs.js.map


+ 1 - 1
spine-ts/threejs/example/index.html

@@ -2,7 +2,7 @@
 <head>
 <meta charset="UTF-8">
 <title>spine-threejs</title>
-<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r79/three.js"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/106/three.min.js"></script>
 <script src="../../build/spine-threejs.js"></script>
 </head>
 <style>

+ 5 - 0
spine-ts/threejs/src/MeshBatcher.ts

@@ -55,6 +55,11 @@ module spine.threejs {
 			this.material = new SkeletonMeshMaterial();
 		}
 
+		dispose () {
+			this.geometry.dispose();
+			this.material.dispose();
+		}
+
 		clear () {
 			let geo = (<THREE.BufferGeometry>this.geometry);
 			geo.drawRange.start = 0;

+ 6 - 0
spine-ts/threejs/src/SkeletonMesh.ts

@@ -102,6 +102,12 @@ module spine.threejs {
 			this.updateGeometry();
 		}
 
+		dispose () {
+			for (var i = 0; i < this.batches.length; i++) {
+				this.batches[i].dispose();
+			}
+		}
+
 		private clearBatches () {
 			for (var i = 0; i < this.batches.length; i++) {
 				this.batches[i].clear();

部分文件因文件數量過多而無法顯示