cesium着色器學習系列4-primitive

先查看API

geometryInstances Array.<GeometryInstance> | GeometryInstance   optionalThe geometry instances - or a single geometry instance - to render.
appearance Appearance

 

核心屬性就是geometryInstances+appearance

與前文系列着色器方式渲染圖元的參數基本一致,其他暫時不看,appearance在前文中已經學習過了。那麼具體來看

geometryInstances。
geometry Geometry   The geometry to instance.
modelMatrix Matrix4 Matrix4.IDENTITY optionalThe model matrix that transforms to transform the geometry from model to world coordinates.
id Object   optionalA user-defined object to return when the instance is picked with Scene#pick or get/set per-instance attributes with Primitive#getGeometryInstanceAttributes.
attributes Object   optionalPer-instance attributes like a show or color attribute shown in the example below.

 

其他幾個屬性相對簡單,重點是geometry。 geometry的類型包括以下的類型。以立方體爲切入點研究primitive如何封裝底層geometry對象的

幾何圖形 

 說明

BoxGeometry

立方體

BoxOutlineGeometry

僅有輪廓的立方體

CircleGeometry

圓形或者拉伸的圓形

CircleOutlineGeometry

只有輪廓的圓形

CorridorGeometry

走廊:沿着地表的多段線,且具有一定的寬度,可以拉伸到一定的高度

CorridorOutlineGeometry

只有輪廓的走廊

CylinderGeometry

圓柱、圓錐或者截斷的圓錐

CylinderOutlineGeometry

只有輪廓的圓柱、圓錐或者截斷的圓錐

EllipseGeometry

橢圓或者拉伸的橢圓

EllipseOutlineGeometry

只有輪廓的橢圓或者拉伸的橢圓

EllipsoidGeometry

橢球體

EllipsoidOutlineGeometry

只有輪廓的橢球體

RectangleGeometry

矩形或者拉伸的矩形

RectangleOutlineGeometry

只有輪廓的矩形或者拉伸的矩形

PolygonGeometry

多邊形,可以具有空洞或者拉伸一定的高度

PolygonOutlineGeometry

只有輪廓的多邊形

PolylineGeometry

多段線,可以具有一定的寬度

SimplePolylineGeometry

簡單的多段線

PolylineVolumeGeometry

多段線柱體

PolylineVolumeOutlineGeometry

只有輪廓的多段線柱體

SphereGeometry

球體

SphereOutlineGeometry

只有輪廓的球體

WallGeometry

WallOutlineGeometry

只有輪廓的牆

 

查看源碼可知,boxgeometry對原生geometry的封裝存在於createGeometry  函數中,實際上就是按給定的最大最小座標,依次生成72個點,6面*每個面4個頂點*每個頂點由三個座標構成

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章