Skip to content

Commit

Permalink
Set tileOffsets from atlaspack top UV
Browse files Browse the repository at this point in the history
  • Loading branch information
deathcap committed Jan 12, 2014
1 parent fcab718 commit 505e0de
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,10 @@ Texture.prototype.paint = function(mesh, materials) {
}
*/

var topUV = atlasuv[0], rightUV = atlasuv[1], bottomUV = atlasuv[2], leftUV = atlasuv[3];

var faceIndex = 3 - face.normal.z - 2*face.normal.x - 3*face.normal.y;
mesh.surfaceMesh.material.materials[0].uniforms.tileOffsets.value[faceIndex] = new self.game.THREE.Vector2(0.28125*faceIndex, 0.96875); // TODO: set actual material
mesh.surfaceMesh.material.materials[0].uniforms.tileOffsets.value[faceIndex] = new self.game.THREE.Vector2(topUV[0], 1.0 - topUV[1]); // TODO: set dimensions from other UV coords (vs tileSize)
//mesh.surfaceMesh.material.materials[0].uniforms.tileOffsets.value[faceIndex] = new self.game.THREE.Vector2(atlasuv[0][0], atlasuv[0][1]);
});
};
Expand Down

0 comments on commit 505e0de

Please sign in to comment.