将几何转换为BufferGeometry [英] Transforming Geometry to BufferGeometry

查看:715
本文介绍了将几何转换为BufferGeometry的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我了解,Geometry存储顶点和面的javascript对象结构,BufferGeometry只通过Float32Arrays等存储原始gl数据。

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.

有没有将标准几何转换为BufferGeometry的方法,这是一个更小的内存紧凑与更少的对象?例如,如果我创建一个新的SphereGeometry,有没有办法轻松将其转换为BufferGeometry?

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?

推荐答案

你很幸运。

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

编辑:更新为three.js r.76

updated to three.js r.76

这篇关于将几何转换为BufferGeometry的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆