Browse Source

Merge pull request #12189 from tentone/Texture-center-docs

Texture center serialization, copy() and documentation.
Mr.doob 7 years ago
parent
commit
12f4ac35ca
3 changed files with 9 additions and 1 deletions
  1. 6 1
      docs/api/textures/Texture.html
  2. 1 0
      src/loaders/ObjectLoader.js
  3. 2 0
      src/textures/Texture.js

+ 6 - 1
docs/api/textures/Texture.html

@@ -149,7 +149,12 @@
 
 
 		<h3>[property:number rotation]</h3>
 		<h3>[property:number rotation]</h3>
 		<div>
 		<div>
-		How much the texture is rotated around the center point ( 0.5, 0.5 ), in radians. Postive values are counter-clockwise. Default is *0*.
+		How much the texture is rotated around the center point, in radians. Postive values are counter-clockwise. Default is *0*.
+		</div>
+
+		<h3>[property:Vector2 center]</h3>
+		<div>
+		Indicates where the center of rotation is. To rotate around the center point set this value to (0.5, 0.5). Default value is (0.0, 0.0).
 		</div>
 		</div>
 
 
 		<h3>[property:boolean matrixAutoUpdate]</h3>
 		<h3>[property:boolean matrixAutoUpdate]</h3>

+ 1 - 0
src/loaders/ObjectLoader.js

@@ -496,6 +496,7 @@ Object.assign( ObjectLoader.prototype, {
 
 
 				if ( data.offset !== undefined ) texture.offset.fromArray( data.offset );
 				if ( data.offset !== undefined ) texture.offset.fromArray( data.offset );
 				if ( data.repeat !== undefined ) texture.repeat.fromArray( data.repeat );
 				if ( data.repeat !== undefined ) texture.repeat.fromArray( data.repeat );
+				if ( data.center !== undefined ) texture.center.fromArray( data.center );
 				if ( data.rotation !== undefined ) texture.rotation = data.rotation;
 				if ( data.rotation !== undefined ) texture.rotation = data.rotation;
 
 
 				if ( data.wrap !== undefined ) {
 				if ( data.wrap !== undefined ) {

+ 2 - 0
src/textures/Texture.js

@@ -108,6 +108,7 @@ Object.assign( Texture.prototype, EventDispatcher.prototype, {
 
 
 		this.offset.copy( source.offset );
 		this.offset.copy( source.offset );
 		this.repeat.copy( source.repeat );
 		this.repeat.copy( source.repeat );
+		this.center.copy( source.center );
 		this.rotation = source.rotation;
 		this.rotation = source.rotation;
 
 
 		this.matrixAutoUpdate = source.matrixAutoUpdate;
 		this.matrixAutoUpdate = source.matrixAutoUpdate;
@@ -185,6 +186,7 @@ Object.assign( Texture.prototype, EventDispatcher.prototype, {
 
 
 			repeat: [ this.repeat.x, this.repeat.y ],
 			repeat: [ this.repeat.x, this.repeat.y ],
 			offset: [ this.offset.x, this.offset.y ],
 			offset: [ this.offset.x, this.offset.y ],
+			center: [ this.center.x, this.center.y ],
 			rotation: this.rotation,
 			rotation: this.rotation,
 
 
 			wrap: [ this.wrapS, this.wrapT ],
 			wrap: [ this.wrapS, this.wrapT ],