Trying to apply a rotated texture onto a PlaneGeometry has been a bit of a challenge for me.
I have a 44x44 diamond-shaped texture that you can view here:
https://i.sstatic.net/Babx0.png
My goal is to map this diamond texture onto the plane geometry using UVs. Would it be feasible to achieve this using Three.js? Specifically, I want to map texel (0, 22) to uv (0, 0), texel (22, 0) to uv (1.0, 0), and so on. Is this possible?
Below is the code snippet I'm currently working with: https://jsfiddle.net/mxLt0bun/2/
geometry = new THREE.PlaneGeometry(1, 1);
texture = loader.load("https://i.imgur.com/DPZiMyK.png")
texture.minFilter = THREE.NearestFilter;
texture.magFilter = THREE.NearestFilter;
material = new THREE.MeshBasicMaterial({
map: texture
});
mesh = new THREE.Mesh(geometry, material);
// draw edges
var geo = new THREE.WireframeGeometry(mesh.geometry);
var mat = new THREE.LineBasicMaterial({
color: 0x00FF00,
linewidth: 1
});
var wireframe = new THREE.LineSegments(geo, mat);
mesh.add(wireframe);
scene.add(mesh);