TextureModule
A TextureModule can be applied to any Mesh or Model.
Creating an instance. url takes a path, or a data object.
var woodTexture = new WHS.mesh.TextureModule({
url: `${process.assetsPath}/textures/wood.jpg`
});
Example of wood texture applied to a Box.
const box = new WHS.Box({
geometry: {
width: 2,
height: 2,
depth: 2
},
modules: [
new WHS.mesh.TextureModule({
url: `${process.assetsPath}/textures/wood.jpg`,
repeat: new THREE.Vector2(1, 1) // optional
})
],
material: new THREE.MeshBasicMaterial({
color: 0xffffff
}),
position: [50, 60, 70]
});
box.addTo(world);
Updated over 7 years ago