Browse Source

Skeleton: Clarify properties and clean up TS.

Mugen87 4 năm trước cách đây
mục cha
commit
ee7de4a981

+ 4 - 0
docs/api/en/objects/Skeleton.html

@@ -79,6 +79,10 @@
 		The [page:DataTexture] holding the bone data when using a vertex texture.
 		</p>
 
+		<h3>[property:Integer boneTextureSize]</h3>
+		<p>
+		The size of the [page:.boneTexture].
+		</p>
 
 		<h2>Methods</h2>
 

+ 4 - 0
docs/api/zh/objects/Skeleton.html

@@ -76,6 +76,10 @@
 		当使用顶点纹理时,[page:DataTexture]保存着骨骼数据。
 		</p>
 
+		<h3>[property:Integer boneTextureSize]</h3>
+		<p>
+		The size of the [page:.boneTexture].
+		</p>
 
 		<h2>方法</h2>
 

+ 11 - 7
src/objects/Skeleton.d.ts

@@ -6,21 +6,25 @@ export class Skeleton {
 
 	constructor( bones: Bone[], boneInverses?: Matrix4[] );
 
-	/**
-	 * @deprecated This property has been removed completely.
-	 */
-	useVertexTexture: boolean;
+	uuid: string;
 	bones: Bone[];
-	boneMatrices: Float32Array;
-	boneTexture: undefined | DataTexture;
 	boneInverses: Matrix4[];
+	boneMatrices: Float32Array;
+	boneTexture: null | DataTexture;
+	boneTextureSize: number;
+	frame: number;
 
+	init(): void;
 	calculateInverses( bone: Bone ): void;
 	pose(): void;
 	update(): void;
 	clone(): Skeleton;
 	getBoneByName( name: string ): undefined | Bone;
+	dispose() :void;
 
-	dispose() :void ;
+	/**
+	 * @deprecated This property has been removed completely.
+	 */
+	useVertexTexture: boolean;
 
 }

+ 7 - 3
src/objects/Skeleton.js

@@ -11,6 +11,10 @@ function Skeleton( bones = [], boneInverses = [] ) {
 
 	this.bones = bones.slice( 0 );
 	this.boneInverses = boneInverses;
+	this.boneMatrices = null;
+
+	this.boneTexture = null;
+	this.boneTextureSize = 0;
 
 	this.frame = - 1;
 
@@ -138,7 +142,7 @@ Object.assign( Skeleton.prototype, {
 
 		}
 
-		if ( boneTexture !== undefined ) {
+		if ( boneTexture !== null ) {
 
 			boneTexture.needsUpdate = true;
 
@@ -172,11 +176,11 @@ Object.assign( Skeleton.prototype, {
 
 	dispose: function ( ) {
 
-		if ( this.boneTexture ) {
+		if ( this.boneTexture !== null ) {
 
 			this.boneTexture.dispose();
 
-			this.boneTexture = undefined;
+			this.boneTexture = null;
 
 		}
 

+ 1 - 1
src/renderers/WebGLRenderer.js

@@ -1597,7 +1597,7 @@ function WebGLRenderer( parameters ) {
 
 				if ( capabilities.floatVertexTextures ) {
 
-					if ( skeleton.boneTexture === undefined ) {
+					if ( skeleton.boneTexture === null ) {
 
 						// layout (1 matrix = 4 pixels)
 						//      RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)