How to use the OctahedronGeometry function from three

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

164
165
166
167
168
169
170
171
172
173
  texture.needsUpdate = true;
  return texture;
};

var createCommet = function() {
  var base_geometry = new THREE.OctahedronGeometry(comet_radius, 2);
  var geometry = new THREE.BufferGeometry();
  var material = new THREE.MeshPhongMaterial({
    color: new THREE.Color('hsl(' + comet_color_h + ', 100%, 100%)'),
    flatShading: true
fork icon260
star icon0
watch icon0

+ 7 other calls in file

7
8
9
10
11
12
13
14
15

//--TorusGeometry(radius, tube, radialSegments, tubularSegments, arc)
geometries.hexagon = new THREE.TorusGeometry(50, 10, 3, 3);

//--OctahedronGeometry(radius, detail)
geometries.functionDeclaration = new THREE.OctahedronGeometry(50);

//--IcosahedronGeometry(radius, detail)
geometries.objectDeclaration = new THREE.IcosahedronGeometry(50);
fork icon9
star icon26
watch icon5

79
80
81
82
83
84
85
86
87
88
89


function getRandomGeometryShape() {
  var randomInt = getRandomInt(0, 3);
  switch (randomInt) {
    case 0: 
      return new THREE.OctahedronGeometry();
      break;
    case 1: 
      return new THREE.BoxGeometry( 1, 1, 1 );
      break;
fork icon14
star icon4
watch icon0

+ 5 other calls in file

39
40
41
42
43
44
45
46
47

// Array geometries (the platonic solids!)
const geoms = [
  new THREE.IcosahedronGeometry(size),
  new THREE.BoxGeometry(size, size, size),
  new THREE.OctahedronGeometry(size),
  new THREE.TetrahedronGeometry(size),
  new THREE.DodecahedronGeometry(size)
]
fork icon0
star icon3
watch icon1

21
22
23
24
25
26
27
28
29
this.geometrySleeve = []
this.geometryLength = 100
this.geometryType = [
  new THREE.TetrahedronGeometry(50, 0),
  new THREE.IcosahedronGeometry(40, 0),
  new THREE.OctahedronGeometry(40, 0)
]

this.composer = null
fork icon11
star icon0
watch icon1

22
23
24
25
26
27
28
29
30
31
    },
  };
  this.obj = this.createObj();
}
createObj() {
  const geometry = new THREE.OctahedronGeometry(90, 20);
  const positions = geometry.attributes.position.array;
  const faceNormalsBase = [];
  const centersBase = [];
  const delaysBase = [];
fork icon0
star icon0
watch icon0

8
9
10
11
12
13
14
15
16
17
    },
  };
  this.obj = this.createObj();
}
createObj() {
  const geometry = new THREE.OctahedronGeometry(150, 20);
  return new THREE.Mesh(
    geometry,
    new THREE.RawShaderMaterial({
      uniforms: this.uniforms,
fork icon0
star icon0
watch icon0

22
23
24
25
26
27
28
29
30
31
}
createObj() {
  const geometry = new THREE.InstancedBufferGeometry();

  // Setting BufferAttribute
  const baseGeometry = new THREE.OctahedronGeometry(30, 4);
  geometry.copy(baseGeometry);

  // Setting InstancedBufferAttribute
  const radian = new THREE.InstancedBufferAttribute(new Float32Array(this.instances), 1);
fork icon0
star icon0
watch icon0

14
15
16
17
18
19
20
21
22
23
  };
  this.obj;
}
createObj() {
  // Define Geometry
  const geometry = new THREE.OctahedronGeometry(50, 30);

  // Define Material
  const material = new THREE.RawShaderMaterial({
    uniforms: this.uniforms,
fork icon0
star icon0
watch icon0

25
26
27
28
29
30
31
32
33
34
init(renderer) {
  this.obj = this.createObj(renderer);
}
createObj(renderer) {
  const detail = (window.innerWidth > 768) ? 200 : 150;
  const geometry = new THREE.OctahedronGeometry(100, detail);
  const verticesBase = geometry.attributes.position.array;
  const vertices = [];
  for (var i = 0; i < verticesBase.length; i+= 3) {
    vertices[i + 0] = verticesBase[i + 0] + (Math.random() * 2 - 1) * 10;
fork icon0
star icon0
watch icon0

10
11
12
13
14
15
16
17
18
19
  };
  this.obj;
}
createObj() {
  // Define Geometry
  const geometry = new THREE.OctahedronGeometry(450, 10);

  // Define Material
  const material = new THREE.RawShaderMaterial({
    uniforms: this.uniforms,
fork icon0
star icon0
watch icon0

8
9
10
11
12
13
14
15
16
17
 * Represents the 'obstacle' 'diamond' (that can be collected)
 * @param {Object} diamond - structure as in levelX.js
 * @constructor
 */
constructor(diamond) {
    this.geometry = new THREE.OctahedronGeometry(size, 0);
    this.material = new THREE.MeshLambertMaterial({
        color: 0xffffff,
        transparent: true,
        opacity: 0.6
fork icon0
star icon0
watch icon0

Other functions in three

Sorted by popularity

function icon

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