Skip to content
This repository has been archived by the owner on Jul 20, 2020. It is now read-only.

Commit

Permalink
[Texture] Add offset property to texture
Browse files Browse the repository at this point in the history
Also add docs for both offset and repeat

Fixes #25
  • Loading branch information
toxicFork committed Feb 9, 2016
1 parent 84d9fc9 commit c938e4f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
7 changes: 6 additions & 1 deletion docs/src/internalComponents/texture.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ class texture extends DocInfo {

getAttributesText() {
return {
repeat: '',
repeat: 'Sets the [repeat property of the ' +
'Texture](http://threejs.org/docs/#Reference/Textures/Texture.repeat).\n\n' +
'Default: `(1, 1)`.',
offset: 'Sets the [offset property of the ' +
'Texture](http://threejs.org/docs/#Reference/Textures/Texture.offset).\n\n' +
'Default: `(0, 0)`.',
wrapS: '',
wrapT: '',
anisotropy: '',
Expand Down
13 changes: 13 additions & 0 deletions src/lib/descriptors/Material/TextureDescriptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ class TextureDescriptor extends THREEElementDescriptor {
default: new THREE.Vector2(1, 1),
});

this.hasProp('offset', {
type: propTypeInstanceOf(THREE.Vector2),
updateInitial: true,
update(threeObject, offset) {
if (offset) {
threeObject.offset.copy(offset);
} else {
threeObject.offset.set(0, 0);
}
},
default: new THREE.Vector2(0, 0),
});

[
'wrapS',
'wrapT',
Expand Down
2 changes: 1 addition & 1 deletion wiki
Submodule wiki updated from e37dd5 to 67637c

0 comments on commit c938e4f

Please sign in to comment.