[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.mzph.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介绍与演示…