在Three.js的這個方法中可以觀察各個Geometry的轉換
從目前爲止的觀察,所有的Geometry都會到projectObject進行轉換,最後轉換成BufferGeometry。
function projectObject( object, camera, groupOrder, sortObjects )
Geometry
Geometry轉換成BufferGeometry
BoxGeometry
BoxGeometry轉換成BufferGeometry
CubeGeometry
CubeGeometry轉換成BufferGeometry
但有些Geometry並不會轉換成BufferGeometry
XXXXBufferGeometry就是了
比如ShapeBufferGeometry和ExtrudeBufferGeometry並沒有轉換成BufferGeometry
ShapeBufferGeometry
ExtrudeBufferGeometry
比ShapeBufferGeometry多了個groups
Threejs的computeBoundingSphere方法
不管是Geometry還是BufferGeometry都有computeBoundingSphere方法,而且是初始化中必須執行。
兩者的區別:BufferGeometry的方法computeBoundingSphere認爲一定存在attributes,然後對attributes的一些數據進行操作。
而Geometry不管是否存在attributes,也不操作attributes的數據操作。
執行computeBoundingSphere的地方【intersectsObject: function ()】
Geometry的computeBoundingSphere方法
BufferGeometry的computeBoundingSphere方法
結論
最後結論是隻要掌握好BufferGeometry的attributes以及其他屬性的用法,用BufferGeometry可以全部搞定,不需要其他的Geometry。