之前顯示3d tiles的代碼都是,scene.primitives.add(xxx);都是加到場(chǎng)景下的primitives里面;
看一下什么是場(chǎng)景的primitives屬性;
看一下手冊(cè),
primitives : PrimitiveCollectione
Gets the collection of primitives.
primitives是PrimitiveCollectione,集合類型;
new Cesium.PrimitiveCollection(options)
A collection of primitives. This is most often used with Scene#primitives, but PrimitiveCollection is also a primitive itself so collections can be added to collections forming a hierarchy.
一個(gè)primitives的集合。多數(shù)情況使用的是Scene.primitives,。。。。。。;
new Cesium.Primitive(options)
A primitive represents geometry in the Scene. The geometry can be from a single GeometryInstance as shown in example 1 below, or from an array of instances, even if the geometry is from different geometry types, e.g., an RectangleGeometry and an EllipsoidGeometry as shown in Code Example 2.
一個(gè)primitive表示場(chǎng)景中的幾何圖形。幾何圖形可以是一個(gè)單獨(dú)的如例1顯示的幾何實(shí)例,或者是幾何實(shí)例的數(shù)組,也可以是不同的幾何圖形類型,如例2的RectangleGeometry和EllipsoidGeometry。
A primitive combines geometry instances with an Appearance that describes the full shading, including Material and RenderState. Roughly, the geometry instance defines the structure and placement, and the appearance defines the visual characteristics. Decoupling geometry and appearance allows us to mix and match most of them and add a new geometry or appearance independently of each other.
一個(gè)primitive組合多個(gè)幾何圖形實(shí)例,包括材質(zhì),一次性渲染顯示。
geometry
n:幾何,幾何學(xué)
Primitive由兩個(gè)部分組成:
? ? 幾何形狀(Geometry):定義了Primitive的結(jié)構(gòu),例如三角形、線條、點(diǎn)等
? ? 外觀(Appearance ):定義Primitive的著色(Sharding),包括GLSL(OpenGL著色語言,OpenGL Shading Language)頂點(diǎn)著色器和片段著色器( vertex and fragment shaders),以及渲染狀態(tài)(render state)文章來源:http://www.zghlxwxcb.cn/news/detail-607024.html
可以用如下代碼枚舉primitives中的單個(gè)primitive,
const primitives = scene.primitives;
const length = primitives.length;
for (let i = 0; i < length; ++i) {
? const p = primitives.get(i);
......
}文章來源地址http://www.zghlxwxcb.cn/news/detail-607024.html
到了這里,關(guān)于了解Cesium場(chǎng)景的primitives屬性的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!