[Cesium]Cesium基礎學習——Primitive

Cesium開發高級篇 | 01空間數據可視化之Primitive - 知乎

Primitive由兩部分組成:幾何體(Geometry)和外觀(Appearance)幾何體定義了幾何類型、位置和顏色,例如三角形、多邊形、折線、點、標簽等;外觀則定義了Primitive的著色或渲染(Shading),包括GLSL(OpenGL著色語言,OpenGL Shading Language)頂點著色器和片元著色器( vertex and fragment shaders),以及渲染狀態(render state)。?粗略地說,幾何實例定義了結構和位置,外觀定義了視覺特征。

1.幾何類型

2.外觀

?

Cesium開發高級篇 | 02材質設置 - 知乎

Cesium中的Material類的內部機制是通過一種json格式的Fabric對象來表達物體的外觀特征,而這些外觀特征是由漫反射(diffuse)、鏡面反射(specular)、法向量(normal)、自發光(emission)以及透明度(alpha)組合(即一個Components)而成?。可通過兩種方式去獲取并設置幾何對象材質:

  • Material.fromType方法
  • Fabric方法
?
// Create a color material with fromType:
polygon.material = Cesium.Material.fromType('Color');
polygon.material.uniforms.color = new Cesium.Color(1.0, 1.0, 0.0, 1.0);-----------------------------------------------------------------------------
// Create the default material:
polygon.material = new Cesium.Material();
// Create a color material with full Fabric notation:
polygon.material = new Cesium.Material({fabric : {type : 'Color',uniforms : {color : new Cesium.Color(1.0, 1.0, 0.0, 1.0)}}
});?

兩種MaterialProperty

  • ImageMaterialProperty 貼圖材質可以給幾何對象表面貼上一張圖片。
var imgUrl = "./images/bumpmap.png";var imgMaterial = new Cesium.ImageMaterialProperty({image: imgUrl,repeat: new Cesium.Cartesian2(4, 4),color: Cesium.Color.BLUE,});viewer.entities.add({position: Cesium.Cartesian3.fromDegrees(-65.0, 40.0, 100000.0),ellipse: {semiMajorAxis: 300000.0, // 長半軸距離semiMinorAxis: 200000.0, // 短半軸距離height: 20000.0,material: imgMaterial,},});
  • PolylineArrowMaterialProperty 帶有箭頭的線

官方案例Cesium Sandcastle

3.常見方法

getGeometryInstanceAttributes(id)

Returns the modifiable per-instance attributes for a?GeometryInstance.

返回一個GeometryInstance的可修改的每個實例屬性。

const attributes = primitive.getGeometryInstanceAttributes('an id');
attributes.color = Cesium.ColorGeometryInstanceAttribute.toValue(Cesium.Color.AQUA);
attributes.show = Cesium.ShowGeometryInstanceAttribute.toValue(true);
attributes.distanceDisplayCondition = Cesium.DistanceDisplayConditionGeometryInstanceAttribute.toValue(100.0, 10000.0);
attributes.offset = Cesium.OffsetGeometryInstanceAttribute.toValue(Cartesian3.IDENTITY);

4.貼地或貼模型特性

Cesium Sandcastle?線貼模型

Cesium Sandcastle

Cesium貼地設置_primitive貼地-CSDN博客

Entity[HeightReference]類似,Primitive也支持貼地或貼模型的特性,但不一樣的是,Primitive是通過classificationType屬性控制的。其中GroundPolylineGeometry、GroundPolylinePrimitive結合實現貼地線

GroundPrimitive實現貼地幾何形狀,包括CircleGeometry、CorridorGeometry、EllipseGeometry、PolygonGeometry、RectangleGeometry;ClassificationPrimitive可實現貼地或貼模型,包括BoxGeometry、CylinderGeometry、EllipsoidGeometry、PolylineVolumeGeometry、SphereGeometry幾何形狀。

5.GroupPrimitive

GroupPrimitive表示場景中覆蓋在Terrain或3DTiles上的幾何體

  • ?Support for the WEBGL_depth_texture extension is required to use GeometryInstances with different PerInstanceColors or materials besides PerInstanceColorAppearance.

(支持WEBGL_depth_texture擴展需要使用不同的PerInstanceColors或PerInstanceColor Appearance?材料的GeometryInstances。)

  • Textured GroundPrimitives were designed for notional patterns and are not meant for precisely mapping textures to terrain - for that use case, use?SingleTileImageryProvider

Textured GroundPrimitives是為空想模式設計的,并不是為了精確地將紋理映射到地形。對于這種情況,使用SingleTileImageryProvider。

  • For correct rendering, this feature requires the EXT_frag_depth WebGL extension. For hardware that do not support this extension, there will be rendering artifacts for some viewing angles.

為了正確渲染,這個特性需要EXT_frag_depth WebGL擴展。對于不支持此擴展的硬件,將會有一些視角的渲染工件。

  • Valid geometries are?CircleGeometry,?CorridorGeometry,?EllipseGeometry,?PolygonGeometry, and?RectangleGeometry.

常見方法 :

Cesium.GroundPrimitive.initializeTerrainHeights()?

  • Initializes the minimum and maximum terrain heights. This only needs to be called if you are creating the GroundPrimitive synchronously.
  • Return:A promise that will resolve once the terrain heights have been loaded.

Cesium.GroundPrimitive.isSupported(scene)

Cesium.GroundPrimitive.supportsMaterials(scene)

  • Checks if the given Scene supports materials on GroundPrimitives. Materials on GroundPrimitives require support for the WEBGL_depth_texture extension.
  • Return:Checks if the given Scene supports materials on GroundPrimitives. Materials on GroundPrimitives require support for the WEBGL_depth_texture extension.

getGeometryInstanceAttributes(id)

6.PrimtiveCollection

常見方法:

7.Property

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/12278.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/12278.shtml
英文地址,請注明出處:http://en.pswp.cn/web/12278.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

EM算法與變分推斷

符號說明 x x x:已觀測變量的集合 { x 1 , x 2 , x 3 , . . . , x N } \{x_1,x_2,x_3,...,x_N\} {x1?,x2?,x3?,...,xN?},長度為 N N N z z z:隱變量(未觀測變量) θ \theta θ:分布參數 ( x , z ) (x,…

pdffactory pro8.0虛擬打印機(附注冊碼)

PdfFactory pro是一款非常受歡迎的PDF虛擬打印機,可以幫助用戶將你的其他文檔保存為PDF格式。請為用戶提供打印/發送/加密等多種實用功能,以及一套完善的PDF打印方案。 使用說明 下載pdfFactory Pro壓縮包,解壓后,雙擊exe文件&am…

LeetCode_LCR002做題總結(可變字符序列使用)

LCR 002. 二進制求和 方法一方法二遺落知識點字符串長度stringStringBuffer && StringBuilder 方法一 轉換成十進制數,求和之后再轉換成二進制數 class Solution {public String addBinary(String a, String b) {return Integer.toBinaryString(Integer.p…

算法提高之木棒

算法提高之木棒 核心思想:dfs 剪枝優化 1.搜索順序優化:len從小到大遍歷2**.剪枝(失敗后):** (1) 跳過所有和第i根木棍相同長度的木棍(2) 如果當前木棍是新木棒的第一根就失敗了 則之后不會搜到方案 return false(3) 下一根失敗但是上一根成…

java獲取到泛型信息后,需要包裝到另一個父類型中。比如讀取類型R,包裝成Res<R>

問題 對于json解析來說&#xff0c;我們一般是通過jackson的TypeReference或者XXX.class來制定類型&#xff08;其他json框架同理&#xff09;&#xff0c;比如下列代碼&#xff1a; ResponseBody<XxxClass> body JsonUtils.parseObject(response, new TypeReference&…

vue + element-plus項目做管理系統常用的組件,以及一些方便開發的設置

1.簡化路徑 //vite.consfig.ts import { defineConfig, ConfigEnv } from vite import vue from vitejs/plugin-vue import path from path export default defineConfig(({ command }: ConfigEnv) > {return {plugins: [vue(),],resolve: {alias: {: path.resolve(__dirn…

EEL中 python端的函數名是如何傳遞給js端的

python端的函數名是如何傳遞給js端的 核心步驟&#xff1a;將函數名列表注入到動態生成的 eel.js 中&#xff0c;這樣前端一開始引用的eel.js本身已經包含有py_function的函數名列表了。你打開開發者工具看看瀏覽器中的 eel.js文件源代碼就知道了。 具體實現&#xff1a; # 讀…

全面解析OpenAI的新作——GPT-4o

5月14日凌晨1點、太平洋時間的上午 10 點&#xff0c;OpenAI的GPT-4o的橫空出世&#xff0c;再次鞏固了其作為行業顛覆者的地位。GPT-4o的發布不僅僅是一個產品的揭曉&#xff0c;它更像是向世界宣告AI技術已邁入了一個全新的紀元&#xff0c;連OpenAI的領航者薩姆奧特曼也不禁…

樓宇智慧公廁建設新方案-集成更簡單!成本價更低!

在當今的大廈和寫字樓中&#xff0c;公廁面臨著諸多痛點。 辦公樓公廁常常存在廁位難找的問題&#xff0c;使用者不得不花費時間逐一查看&#xff0c;導致效率低下&#xff1b;環境質量也令人擔憂&#xff0c;異味、臟污等情況時有發生&#xff0c;影響使用者的心情和健康&…

【simulink】Scrambling 加擾

https://ww2.mathworks.cn/help/comm/ug/additive-scrambling-of-input-data-in-simulink.html 草圖 simulink 代碼圖

leetcode-11. 盛最多水的容器(雙指針)

11. 盛最多水的容器 /*** param {number[]} height* return {number}*/ var maxArea function (height) {// 時間復雜度 O(n)// 空間復雜度 O(1)let len height.length;let left 0,right len - 1;let res 0;while (left < right) {let area Math.min(height[left], h…

QT狀態機10-QKeyEventTransition和QMouseEventTransition的使用

1、QMouseEventTransition的使用 首先明白 QMouseEventTransition 繼承自 QEventTransition類。 關于QEventTransition類的使用,可參考 QT狀態機9-QEventTransition和QSignalTransition的使用 回顧 QT狀態機9-QEventTransition和QSignalTransition的使用 中的狀態切換代碼,如…

零基礎10 天入門 Web3之第3天

10 天入門 Web3之第3天 什么是以太坊&#xff0c;以太坊能做什么&#xff1f;Web3 是互聯網的下一代&#xff0c;它將使人們擁有自己的數據并控制自己的在線體驗。Web3 基于區塊鏈技術&#xff0c;該技術為安全、透明和可信的交易提供支持。我準備做一個 10 天的學習計劃&…

AI+新能源充電樁數據集

需要的同學私信聯系&#xff0c;推薦關注上面圖片右下角的訂閱號平臺 自取下載。 隨著我國新能源汽車市場的蓬勃發展&#xff0c;充電樁的需求量日益增加&#xff0c;充電樁的智能化程度不僅影響充電站運營商的經營效益&#xff0c;也大大影響著用戶的充電體驗。AI技術可以涵蓋…

Flutter 中的 Listener 小部件:全面指南

Flutter 中的 Listener 小部件&#xff1a;全面指南 在Flutter中&#xff0c;Listener是一個可以監聽多種類型事件的通用組件&#xff0c;它可以用來監聽如滾動、震動、焦點等事件。Listener通常與GestureDetector等組件結合使用&#xff0c;以實現對用戶交互的響應。本文將提…

python “名稱空間和作用域” 以及 “模塊的導入和使用”

七、名稱空間和作用域 可以簡單理解為存放變量名和變量值之間綁定關系的地方。 1、名稱空間 在 Python 中有各種各樣的名稱空間&#xff1a; 全局名稱空間&#xff1a;每個程序的主要部分定義了全局的變量名和變量值的對應關系&#xff0c;這樣就叫做全局名稱空間 局部名稱…

04-單片機商業項目編程,從零搭建低功耗系統設計

一、本文內容 上一節《03-單片機商業項目編程&#xff0c;從零搭建低功耗系統設計-CSDN博客》我們確定了設計思路&#xff0c;并如何更有效的保持低功耗&#xff0c;這節我們就準備來做軟件框架設計。在AI飛速發展的時代&#xff0c;我們也會利AI來輔助我們完成&#xff0c;讓自…

淺談C++ overload(重載) override(覆蓋) overwrite(重寫)

目錄 1. 名詞辨析2 含義解析1 overload重載2 override覆蓋3 overwrite重寫 3 區別4 代碼示例 1. 名詞辨析 關于這3個名詞的中文翻譯&#xff1a; overload翻譯為重載&#xff0c;基本是沒有歧義的&#xff1b;override和overwrite的翻譯&#xff0c;我在參考了cppreference中…

.NET周刊【5月第2期 2024-05-12】

國內文章 C#在工業數字孿生中的開發路線實踐 https://mp.weixin.qq.com/s/b_Pjt2oii0Xa_sZp_9wYWg 這篇文章探討了C#在工業數字孿生技術中的應用&#xff0c;介紹了三種基于C#的數字孿生系統實現方案&#xff1a; WPF Unity&#xff1a;結合WPF技術和Unity引擎&#xff0c…

接口、會話控制

文章目錄 接口介紹RESTful APIjson-server接口測試工具apipost公共參數和文檔功能 會話控制cookie介紹和使用運行流程瀏覽器中操作Cookieexpress中cookie操作 Sessionsession運行流程&#xff1a;session中間件配置session 和 cookie 的區別CSRF跨站請求偽造 tokenJWT介紹與演示…