.new TextureModule(texturesopt)
A TextureModule can be applied to any Mesh or Model.
- Source:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
textures |
Array
|
<optional> |
array of texture objects |
Examples
Creating an instance. url takes a path, or a data object.
var woodTexture = new TextureModule({
url: `${process.assetsPath}/textures/wood.jpg`
});
More comprehensive example, wood texture applied to a Box.
new Box({
geometry: {
width: 2,
height: 2,
depth: 2
},
modules: [
new TextureModule({
url: `path/to/texture.jpg`,
repeat: new THREE.Vector2(1, 1) // optional
})
],
material: new THREE.MeshBasicMaterial({
color: 0xffffff
}),
position: [50, 60, 70]
}).addTo(app);