Skip to content

Instantly share code, notes, and snippets.

@AndrewRayCode
Created June 21, 2013 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndrewRayCode/5829806 to your computer and use it in GitHub Desktop.
Save AndrewRayCode/5829806 to your computer and use it in GitHub Desktop.
var size = 100,
uvMat = mesh.geometry.faceVertexUvs[0],
faceVerts, fi, vi;
for( fi = 0; faceVerts = uvMat[fi++]; ) {
for( vi = 0; vi < faceVerts.length; vi++ ) {
var pos = mesh.localToWorld( mesh.geometry.vertices[ vi ].clone() );
faceVerts[ vi ] = new THREE.Vector2(
((100000 + pos.x) % size) / size,
((100000 + pos.y) % size) / size
);
}
}
mesh.geometry.uvsNeedUpate = true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment