Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to load a single model in Cesium

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to load a single model in Cesium", the content is simple and clear, hoping to help you solve your doubts, let the editor lead you to study and learn "how to load a single model in Cesium" this article.

Cesium supports loading a single 3D model, the commonly used model format is: gltf,glb, these models can be converted from 3dmax, obj and other 3D model format. The official website of Cesium also lists the ways to load a single 3D model, according to the detailed code.

The detailed code is in the Cesium example: 3D Models.html page

The model file for the sample is in the folder of: SampleData

The following is the detailed code for loading the model:

/ / location information, x, y, height information

Var position = Cesium.Cartesian3.fromDegrees (- 123.0744619, 44.0503706, height)

/ / the three directions of the model and the three directions of the three corners in the three-dimensional space can be seen in the figure above.

/ / schematic diagram of small aircraft (where direction corresponds to heading and tilt corresponds to pitch)

Var heading = Cesium.Math.toRadians

Var pitch = 0

Var roll = 0

Var hpr = new Cesium.HeadingPitchRoll (heading, pitch, roll)

/ / to make a conversion according to the position and the set corner information

Var orientation = Cesium.Transforms.headingPitchRollQuaternion (position, hpr)

/ / A single object is usually placed in an entity, and a solid object is added

Var entity = viewer.entities.add ({

/ / set position and steering information

Name: url

Position: position

Orientation: orientation

Model: {

/ / the path of the model

Uri: url

/ / scale of the model

Scale:1.0

/ / the smallest pixel size

MinimumPixelSize: 128

/ / maximum display scale

MaximumScale: 20000

}

});

The loading effect of the model, when the code is used, remove the comment information:

These are all the contents of the article "how to load a single model in Cesium". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report