Create a Cube with Textures

The following snippet will create a cube with textures 1.png through 6.png on the faces.

var materials = [
    new THREE.MeshLambertMaterial({
        ambient: 0xffffff,
        map: THREE.ImageUtils.loadTexture( '1.png' ) }),
    new THREE.MeshLambertMaterial({
        ambient: 0xffffff,
        map: THREE.ImageUtils.loadTexture( '2.png' ) }),
    new THREE.MeshLambertMaterial({
        ambient: 0xffffff,
        map: THREE.ImageUtils.loadTexture( '3.png' ) }),
    new THREE.MeshLambertMaterial({
        ambient: 0xffffff,
        map: THREE.ImageUtils.loadTexture( '4.png' ) }),
    new THREE.MeshLambertMaterial({
        ambient: 0xffffff,
        map: THREE.ImageUtils.loadTexture( '5.png' ) }),
    new THREE.MeshLambertMaterial( {
        ambient: 0xffffff,
        map: THREE.ImageUtils.loadTexture( '6.png' ) })
];
 
var boxGeometry = 
    new THREE.BoxGeometry(80, 80, 80, 3, 3, 3),
var cubeMesh = new THREE.Mesh(
    boxGeometry, 
    new THREE.MeshFaceMaterial(materials)
);
 
cubeMesh.position.set( 0, 0, 0 );
 
var scene = new THREE.Scene();
scene.add(cubeMesh);

fuss/three.js.txt ยท Last modified: 2022/04/19 08:28 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.