提交 a18dc1a8 编写于 作者: W WestLangley

Add Texture.updateMatrix() method

上级 e624c9b9
......@@ -154,21 +154,21 @@
<h3>[property:Vector2 center]</h3>
<p>
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).
The point around which rotation occurs. A value of (0.5, 0.5) corresponds to the center of the texture. Default is (0, 0), the lower left.
</p>
<h3>[property:boolean matrixAutoUpdate]</h3>
<p>
Whether to update the texture's uv-transform [property:Matrix3 matrix] based on the [property:Vector2 offset],
[property:Vector2 repeat], and [property:number rotation] settings. True by default.
Whether to update the texture's uv-transform [page:Texture.matrix .matrix] from the texture properties [page:Texture.offset .offset], [page:Texture.repeat .repeat],
[page:Texture.rotation .rotation], and [page:Texture.center .center]. True by default.
Set this to false if you are specifying the uv-transform matrix directly.
</p>
<h3>[property:Matrix3 matrix]</h3>
<p>
The uv-transform matrix for the texture. Updated by the renderer from the texture properties [property:Vector2 offset], [property:Vector2 repeat],
and [property:number rotation] when the texture's [property:boolean matrixAutoUpdate] property is true.
When [property:boolean matrixAutoUpdate] property is false, this matrix may be set manually.
The uv-transform matrix for the texture. Updated by the renderer from the texture properties [page:Texture.offset .offset], [page:Texture.repeat .repeat],
[page:Texture.rotation .rotation], and [page:Texture.center .center] when the texture's [page:Texture.matrixAutoUpdate .matrixAutoUpdate] property is true.
When [page:Texture.matrixAutoUpdate .matrixAutoUpdate] property is false, this matrix may be set manually.
Default is the identity matrix.
</p>
......@@ -228,6 +228,12 @@
<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
<h3>[method:null updateMatrix]()</h3>
<p>
Update the texture's uv-transform [page:Texture.matrix .matrix] from the texture properties [page:Texture.offset .offset], [page:Texture.repeat .repeat],
[page:Texture.rotation .rotation], and [page:Texture.center .center].
</p>
<h3>[method:Texture clone]( [param:Texture texture] )</h3>
<p>
Make copy of the texture. Note this is not a "deep copy", the image is shared.
......@@ -246,7 +252,7 @@
<h3>[method:null transformUv]( uv )</h3>
<p>
Transform the uv based on the value of this texture's [page:Texture.repeat .repeat], [page:Texture.offset .offset],
Transform the uv based on the value of this texture's [page:Texture.offset .offset], [page:Texture.repeat .repeat],
[page:Texture.wrapS .wrapS], [page:Texture.wrapT .wrapT] and [page:Texture.flipY .flipY] properties.
</p>
......
......@@ -2050,12 +2050,7 @@ function WebGLRenderer( parameters ) {
if ( uvScaleMap.matrixAutoUpdate === true ) {
var offset = uvScaleMap.offset;
var repeat = uvScaleMap.repeat;
var rotation = uvScaleMap.rotation;
var center = uvScaleMap.center;
uvScaleMap.matrix.setUvTransform( offset.x, offset.y, repeat.x, repeat.y, rotation, center.x, center.y );
uvScaleMap.updateMatrix();
}
......@@ -2093,12 +2088,7 @@ function WebGLRenderer( parameters ) {
if ( material.map.matrixAutoUpdate === true ) {
var offset = material.map.offset;
var repeat = material.map.repeat;
var rotation = material.map.rotation;
var center = material.map.center;
material.map.matrix.setUvTransform( offset.x, offset.y, repeat.x, repeat.y, rotation, center.x, center.y );
material.map.updateMatrix();
}
......
......@@ -70,6 +70,12 @@ Texture.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
isTexture: true,
updateMatrix: function () {
this.matrix.setUvTransform( this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y );
},
clone: function () {
return new this.constructor().copy( this );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册