How to use the CubeGeometry function from three

Find comprehensive JavaScript three.CubeGeometry code examples handpicked from public code repositorys.

132
133
134
135
136
137
138
139
140
141
};

RegionsController.prototype.drawRegions = function(renderer, camera, target, forceClear) {
	// draw the regions
	//
	var geom = new THREE.CubeGeometry(1, 1, 1);
	var v = new THREE.Vector3();
	var vmid = new THREE.Vector3();

	var o = this;
fork icon13
star icon110
watch icon0

425
426
427
428
429
430
431
432
433
434
435
436




function boundingBox(bb, color, opacity) {
    bb = bb.clone()
    let d = bb.max.clone().sub(bb.min)
    let geom = new THREE.CubeGeometry(d.x, d.y, d.z)
    geom = new THREE.EdgesGeometry(geom)
    let mat = new THREE.LineBasicMaterial({
        color: color,
        linewidth: 2,
fork icon2
star icon14
watch icon0

+ 2 other calls in file

78
79
80
81
82
83
84
85
86
87
  splitX: 6,
  splitY: 6,
  splitZ: 20
};
boundingBox = new THREE.Mesh(
  new THREE.CubeGeometry(
    boundingBoxConfig.width, boundingBoxConfig.height, boundingBoxConfig.depth,
    boundingBoxConfig.splitX, boundingBoxConfig.splitY, boundingBoxConfig.splitZ),
  new THREE.MeshBasicMaterial( { color: 0xffaa00, wireframe: true } )
);
fork icon1
star icon0
watch icon1

+ 3 other calls in file

96
97
98
99
100
101
102
103
104
105
document.body.appendChild( renderer.domElement );


// Put in the floor
var floor = new THREE.Mesh(
  new THREE.CubeGeometry(world.dimensions * world.tileSize, world.dimensions * world.tileSize, world.tileSize),
  new THREE.MeshLambertMaterial({color: 0x4F4F4F})
);
floor.receiveShadow = true;
floor.castShadow = true;
fork icon0
star icon1
watch icon2

100
101
102
103
104
105
106
107
108
109
const renderer = new THREE.WebGLRenderer();

camera.add(listener);
renderer.setSize( window.innerWidth, window.innerHeight );

const storyGeom = new THREE.CubeGeometry(4, 4, .1);
const story = new THREE.Mesh(storyGeom, storyMats);
story.position.y += 5;
scene.add(story);
this.story = story;
fork icon0
star icon0
watch icon1

+ 3 other calls in file

52
53
54
55
56
57
58
59
60
61
var cubeMaterial = new THREE.MeshLambertMaterial({color: 0xa3a3a3});
var plateMaterial = new THREE.MeshLambertMaterial({color: 0xD7DFE5});

// Set Geometry
var cubeGeometry = new THREE.CubeGeometry(4, 4, 4);
var plateGeometry = new THREE.CubeGeometry(7, 7, 1);

// Set Cube & Plate with Geometry & Material
var cube = new THREE.Mesh(cubeGeometry, cubeMaterial);
var plate = new THREE.Mesh(plateGeometry, plateMaterial);
fork icon0
star icon0
watch icon5

+ 3 other calls in file

52
53
54
55
56
57
58
59
60
61
const sphere = new THREE.Mesh(sphereGeo, sphereMat)
sphere.receiveShadow = true
sphere.castShadow = false
scene.add(sphere)

const cubeGeo = new THREE.CubeGeometry(1, 1, 1)
const cubeMat = new THREE.MeshPhongMaterial({ color: 0xababab })
const cube = new THREE.Mesh(cubeGeo, cubeMat)
cube.castShadow = true
cube.receiveShadow = true
fork icon0
star icon0
watch icon4

+ 5 other calls in file

45
46
47
48
49
50
51
52
53
        let material = new THREE.LineBasicMaterial( {color: 0xFFFFFF} )
        return new THREE.Line( geometry, material )
}

export const createCube = () => {
        let geometry = new THREE.CubeGeometry( 8, 2, 4 )
        let material = new THREE.MeshNormalMaterial()
        return new THREE.Mesh(geometry, material)
}
fork icon0
star icon0
watch icon1

Other functions in three

Sorted by popularity

function icon

three.Vector3 is the most popular function in three (22341 examples)