Skip to content

Instantly share code, notes, and snippets.

@BABAK0T0
Last active March 1, 2021 23:27
Show Gist options
  • Save BABAK0T0/005479fbd90f7dd5e236a0f6f04e11b3 to your computer and use it in GitHub Desktop.
Save BABAK0T0/005479fbd90f7dd5e236a0f6f04e11b3 to your computer and use it in GitHub Desktop.
// Create an empty BufferGeometry
const geometry = new THREE.BufferGeometry()
// Create a Float32Array containing the vertices position (3 by 3)
const positionsArray = new Float32Array([
0, 0, 0, // First vertex
0, 1, 0, // Second vertex
1, 0, 0 // Third vertex
])
// Create the attribute and name it 'position'
const positionsAttribute = new THREE.BufferAttribute(positionsArray, 3)
geometry.setAttribute('position', positionsAttribute)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment