I'm working on applying a simple material with a texture map to a custom mesh. I couldn't find any examples that I could understand, so I made this fiddle to demonstrate what I'm trying to achieve.
/// MATERIAL
var texture = new THREE.TextureLoader().load( "https://raw.githubusercontent.com/mrdoob/three.js/master/examples/textures/crate.gif" );
var material = new THREE.MeshBasicMaterial( {
map: texture,
side: THREE.DoubleSide
} );
// TRIANGLE
var geometry2 = new THREE.Geometry();
var v1 = new THREE.Vector3(0,200,0);
var v2 = new THREE.Vector3(0,0,-100);
var v3 = new THREE.Vector3(0,0,100);
geometry2.vertices.push(v1);
geometry2.vertices.push(v2);
geometry2.vertices.push(v3);
geometry2.faces.push( new THREE.Face3( 0, 1, 2 ) );
meshCustom = new THREE.Mesh(geometry2, material);
scene.add(meshCustom);
// CUBE
var geometry = new THREE.BoxBufferGeometry( 100, 100, 100 );
mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
https://jsfiddle.net/benaloney/L7js807k/8/
I just want the triangle to have the same texture as the cube, I understand there needs to be UV coordinates on the mesh for this to work, but am unsure of how to implement this.