diff --git a/docs/api/en/core/BufferGeometry.html b/docs/api/en/core/BufferGeometry.html index b6abaef06c73e9..1fa73c9c0893c3 100644 --- a/docs/api/en/core/BufferGeometry.html +++ b/docs/api/en/core/BufferGeometry.html @@ -20,18 +20,20 @@
const geometry = new THREE.BufferGeometry();
+
// create a simple square shape. We duplicate the top left and bottom right
// vertices because each vertex needs to appear once per triangle.
const vertices = new Float32Array( [
- -1.0, -1.0, 1.0,
- 1.0, -1.0, 1.0,
- 1.0, 1.0, 1.0,
+ -1.0, -1.0, 1.0, // v0
+ 1.0, -1.0, 1.0, // v1
+ 1.0, 1.0, 1.0, // v2
- 1.0, 1.0, 1.0,
- -1.0, 1.0, 1.0,
- -1.0, -1.0, 1.0
+ 1.0, 1.0, 1.0, // v3
+ -1.0, 1.0, 1.0, // v4
+ -1.0, -1.0, 1.0 // v5
] );
// itemSize = 3 because there are 3 values (components) per vertex
@@ -40,6 +42,29 @@ Code Example
const mesh = new THREE.Mesh( geometry, material );
+
+ const geometry = new THREE.BufferGeometry();
+
+ const vertices = new Float32Array( [
+ -1.0, -1.0, 1.0, // v0
+ 1.0, -1.0, 1.0, // v1
+ 1.0, 1.0, 1.0, // v2
+ -1.0, 1.0, 1.0, // v3
+ ] );
+ geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
+
+ const indices = [
+ 0, 1, 2,
+ 2, 3, 0,
+ ];
+ geometry.setIndex( indices );
+
+ const material = new THREE.MeshBasicMaterial( { color: 0x00ffff } );
+ const mesh = new THREE.Mesh( geometry, material );
+
+
[example:webgl_buffergeometry Mesh with non-indexed faces]