How to use the CubeGeometry function from three
Find comprehensive JavaScript three.CubeGeometry code examples handpicked from public code repositorys.
GitHub: hobuinc/usgs-lidar
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;
GitHub: OpenSlicer/OpenSlicer
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,
+ 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 } ) );
+ 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;
GitHub: twalk4821/kelsiWorld3D
![twalk4821 profile picture](/twalk4821.png?size=40)
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;
+ 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);
+ 3 other calls in file
GitHub: Neticon/webgl-tests
![Neticon profile picture](/Neticon.png?size=40)
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
+ 5 other calls in file
GitHub: zDawnING/MyLearnWebGL
![zDawnING profile picture](/zDawnING.png?size=40)
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) }
three.Vector3 is the most popular function in three (22341 examples)