Axiverse
Axiverse

Reputation: 1674

Transforming Geometry to BufferGeometry

As I understand it, Geometry stores a javascript object structure of the vertices and faces and BufferGeometry just stores the raw gl data via Float32Arrays, etc.

Is there any way to turn standard Geometry into BufferGeometry, which is a lot more memory compact with less objects? For example if I create a new SphereGeometry, is there a way to easily transform that to a BufferGeometry?

Upvotes: 29

Views: 15745

Answers (1)

WestLangley
WestLangley

Reputation: 104833

This answer only applies to versions of three.js prior to r.125.

The Legacy Geometry class has been removed.


var bufferGeometry = new THREE.BufferGeometry().fromGeometry( geometry );

three.js r.124

Upvotes: 41

Related Questions