Cesium provides developers with rich graphics rendering and spatial data management APIs, which can be divided into two categories: one is a low-level API for graphics developers, usually called Primitive API; the other is used to drive data visualization API, called Entity API.
1、Primitive
Primitive usually consists of two parts:
-
Geometry: defines the Primitive structure, such as triangles, lines, points, etc.
-
Appearance: defines Primitive Shading, including OpenGL Shading.
Advantages of using Geometry and Primitive:
-
high performance
-
flexibility
-
low level access
Disadvantages:
-
Achieving the same functionality requires more code than the Entity API
-
Developers are required to have a deeper understanding of graphics programming, especially the knowledge of OpenGL.
2. Geometric shapes merged
Combining multiple GeometryInstances into a single Primitive can greatly improve processing performance. The following sample code creates 2592 rectangles of different colors, covering the entire surface of the earth, the effect is as follows:
code writing
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HelloCesium</title>