qd-changjing/public/static/Build/Documentation/Primitive.html

2411 lines
86 KiB
HTML
Raw Normal View History

2022-07-05 16:56:29 +08:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Primitive - Cesium Documentation</title>
<!--[if lt IE 9]>
<script src="javascript/html5.js"></script>
<![endif]-->
<link href="styles/jsdoc-default.css" rel="stylesheet">
<link href="styles/prism.css" rel="stylesheet">
</head>
<body>
<div id="main">
<h1 class="page-title">
<a href="index.html"><img src="Images/CesiumLogo.png" class="cesiumLogo"></a>
Primitive
<div class="titleCenterer"></div>
</h1>
<section>
<header>
</header>
<article>
<div class="container-overview">
<div class="nameContainer">
<h4 class="name" id="Primitive">
<a href="#Primitive" class="doc-link"></a>
new Cesium.Primitive<span class="signature">(<span class="optional">options</span>)</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L155">Scene/Primitive.js 155</a>
</div>
</h4>
</div>
<div class="description">
A primitive represents geometry in the <a href="Scene.html"><code>Scene</code></a>. The geometry can be from a single <a href="GeometryInstance.html"><code>GeometryInstance</code></a>
as shown in example 1 below, or from an array of instances, even if the geometry is from different
geometry types, e.g., an <a href="RectangleGeometry.html"><code>RectangleGeometry</code></a> and an <a href="EllipsoidGeometry.html"><code>EllipsoidGeometry</code></a> as shown in Code Example 2.
<p>
A primitive combines geometry instances with an <a href="Appearance.html"><code>Appearance</code></a> that describes the full shading, including
<a href="Material.html"><code>Material</code></a> and <code>RenderState</code>. 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.
</p>
<p>
Combining multiple instances into one primitive is called batching, and significantly improves performance for static data.
Instances can be individually picked; <a href="Scene.html#pick"><code>Scene#pick</code></a> returns their <a href="GeometryInstance.html#id"><code>GeometryInstance#id</code></a>. Using
per-instance appearances like <a href="PerInstanceColorAppearance.html"><code>PerInstanceColorAppearance</code></a>, each instance can also have a unique color.
</p>
<p>
<a href="Geometry.html"><code>Geometry</code></a> can either be created and batched on a web worker or the main thread. The first two examples
show geometry that will be created on a web worker by using the descriptions of the geometry. The third example
shows how to create the geometry on the main thread by explicitly calling the <code>createGeometry</code> method.
</p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">
<span class="optional">optional</span>
Object with the following properties:
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometryInstances</code></td>
<td class="type">
<span class="param-type">Array.&lt;<a href="GeometryInstance.html">GeometryInstance</a>></span>
|
<span class="param-type"><a href="GeometryInstance.html">GeometryInstance</a></span>
</td>
<td class="default">
</td>
<td class="description last">
<span class="optional">optional</span>
The geometry instances - or a single geometry instance - to render.</td>
</tr>
<tr>
<td class="name"><code>appearance</code></td>
<td class="type">
<span class="param-type"><a href="Appearance.html">Appearance</a></span>
</td>
<td class="default">
</td>
<td class="description last">
<span class="optional">optional</span>
The appearance used to render the primitive.</td>
</tr>
<tr>
<td class="name"><code>depthFailAppearance</code></td>
<td class="type">
<span class="param-type"><a href="Appearance.html">Appearance</a></span>
</td>
<td class="default">
</td>
<td class="description last">
<span class="optional">optional</span>
The appearance used to shade this primitive when it fails the depth test.</td>
</tr>
<tr>
<td class="name"><code>show</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="default">
<code class="language-javascript">true</code>
</td>
<td class="description last">
<span class="optional">optional</span>
Determines if this primitive will be shown.</td>
</tr>
<tr>
<td class="name"><code>modelMatrix</code></td>
<td class="type">
<span class="param-type"><a href="Matrix4.html">Matrix4</a></span>
</td>
<td class="default">
<code class="language-javascript">Matrix4.IDENTITY</code>
</td>
<td class="description last">
<span class="optional">optional</span>
The 4x4 transformation matrix that transforms the primitive (all geometry instances) from model to world coordinates.</td>
</tr>
<tr>
<td class="name"><code>vertexCacheOptimize</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="default">
<code class="language-javascript">false</code>
</td>
<td class="description last">
<span class="optional">optional</span>
When <code>true</code>, geometry vertices are optimized for the pre and post-vertex-shader caches.</td>
</tr>
<tr>
<td class="name"><code>interleave</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="default">
<code class="language-javascript">false</code>
</td>
<td class="description last">
<span class="optional">optional</span>
When <code>true</code>, geometry vertex attributes are interleaved, which can slightly improve rendering performance but increases load time.</td>
</tr>
<tr>
<td class="name"><code>compressVertices</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="default">
<code class="language-javascript">true</code>
</td>
<td class="description last">
<span class="optional">optional</span>
When <code>true</code>, the geometry vertices are compressed, which will save memory.</td>
</tr>
<tr>
<td class="name"><code>releaseGeometryInstances</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="default">
<code class="language-javascript">true</code>
</td>
<td class="description last">
<span class="optional">optional</span>
When <code>true</code>, the primitive does not keep a reference to the input <code>geometryInstances</code> to save memory.</td>
</tr>
<tr>
<td class="name"><code>allowPicking</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="default">
<code class="language-javascript">true</code>
</td>
<td class="description last">
<span class="optional">optional</span>
When <code>true</code>, each geometry instance will only be pickable with <a href="Scene.html#pick"><code>Scene#pick</code></a>. When <code>false</code>, GPU memory is saved.</td>
</tr>
<tr>
<td class="name"><code>cull</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="default">
<code class="language-javascript">true</code>
</td>
<td class="description last">
<span class="optional">optional</span>
When <code>true</code>, the renderer frustum culls and horizon culls the primitive's commands based on their bounding volume. Set this to <code>false</code> for a small performance gain if you are manually culling the primitive.</td>
</tr>
<tr>
<td class="name"><code>asynchronous</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="default">
<code class="language-javascript">true</code>
</td>
<td class="description last">
<span class="optional">optional</span>
Determines if the primitive will be created asynchronously or block until ready.</td>
</tr>
<tr>
<td class="name"><code>debugShowBoundingVolume</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="default">
<code class="language-javascript">false</code>
</td>
<td class="description last">
<span class="optional">optional</span>
For debugging only. Determines if this primitive's commands' bounding spheres are shown.</td>
</tr>
<tr>
<td class="name"><code>shadows</code></td>
<td class="type">
<span class="param-type"><a href="global.html#ShadowMode">ShadowMode</a></span>
</td>
<td class="default">
<code class="language-javascript">ShadowMode.DISABLED</code>
</td>
<td class="description last">
<span class="optional">optional</span>
Determines whether this primitive casts or receives shadows from light sources.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<h5>Examples:</h5>
<pre><code class="language-javascript">// 1. Draw a translucent ellipse on the surface with a checkerboard pattern
const instance = new Cesium.GeometryInstance({
geometry : new Cesium.EllipseGeometry({
center : Cesium.Cartesian3.fromDegrees(-100.0, 20.0),
semiMinorAxis : 500000.0,
semiMajorAxis : 1000000.0,
rotation : Cesium.Math.PI_OVER_FOUR,
vertexFormat : Cesium.VertexFormat.POSITION_AND_ST
}),
id : 'object returned when this instance is picked and to get/set per-instance attributes'
});
scene.primitives.add(new Cesium.Primitive({
geometryInstances : instance,
appearance : new Cesium.EllipsoidSurfaceAppearance({
material : Cesium.Material.fromType('Checkerboard')
})
}));</code></pre>
<pre><code class="language-javascript">// 2. Draw different instances each with a unique color
const rectangleInstance = new Cesium.GeometryInstance({
geometry : new Cesium.RectangleGeometry({
rectangle : Cesium.Rectangle.fromDegrees(-140.0, 30.0, -100.0, 40.0),
vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT
}),
id : 'rectangle',
attributes : {
color : new Cesium.ColorGeometryInstanceAttribute(0.0, 1.0, 1.0, 0.5)
}
});
const ellipsoidInstance = new Cesium.GeometryInstance({
geometry : new Cesium.EllipsoidGeometry({
radii : new Cesium.Cartesian3(500000.0, 500000.0, 1000000.0),
vertexFormat : Cesium.VertexFormat.POSITION_AND_NORMAL
}),
modelMatrix : Cesium.Matrix4.multiplyByTranslation(Cesium.Transforms.eastNorthUpToFixedFrame(
Cesium.Cartesian3.fromDegrees(-95.59777, 40.03883)), new Cesium.Cartesian3(0.0, 0.0, 500000.0), new Cesium.Matrix4()),
id : 'ellipsoid',
attributes : {
color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.AQUA)
}
});
scene.primitives.add(new Cesium.Primitive({
geometryInstances : [rectangleInstance, ellipsoidInstance],
appearance : new Cesium.PerInstanceColorAppearance()
}));</code></pre>
<pre><code class="language-javascript">// 3. Create the geometry on the main thread.
scene.primitives.add(new Cesium.Primitive({
geometryInstances : new Cesium.GeometryInstance({
geometry : Cesium.EllipsoidGeometry.createGeometry(new Cesium.EllipsoidGeometry({
radii : new Cesium.Cartesian3(500000.0, 500000.0, 1000000.0),
vertexFormat : Cesium.VertexFormat.POSITION_AND_NORMAL
})),
modelMatrix : Cesium.Matrix4.multiplyByTranslation(Cesium.Transforms.eastNorthUpToFixedFrame(
Cesium.Cartesian3.fromDegrees(-95.59777, 40.03883)), new Cesium.Cartesian3(0.0, 0.0, 500000.0), new Cesium.Matrix4()),
id : 'ellipsoid',
attributes : {
color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.AQUA)
}
}),
appearance : new Cesium.PerInstanceColorAppearance(),
asynchronous : false
}));</code></pre>
<h5>See:</h5>
<ul class="see-list">
<li><a href="GeometryInstance.html">GeometryInstance</a></li>
<li><a href="Appearance.html">Appearance</a></li>
<li><a href="ClassificationPrimitive.html">ClassificationPrimitive</a></li>
<li><a href="GroundPrimitive.html">GroundPrimitive</a></li>
</ul>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<div class="nameContainer">
<h4 class="name" id="allowPicking">
<a href="#allowPicking" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> allowPicking<span class="type-signature"> : Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L426">Scene/Primitive.js 426</a>
</div>
</h4>
</div>
<div class="description">
When <code>true</code>, each geometry instance will only be pickable with <a href="Scene.html#pick"><code>Scene#pick</code></a>. When <code>false</code>, GPU memory is saved. *
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">true</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="appearance">
<a href="#appearance" class="doc-link"></a>
appearance<span class="type-signature"> : <a href="Appearance.html">Appearance</a></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L183">Scene/Primitive.js 183</a>
</div>
</h4>
</div>
<div class="description">
The <a href="Appearance.html"><code>Appearance</code></a> used to shade this primitive. Each geometry
instance is shaded with the same appearance. Some appearances, like
<a href="PerInstanceColorAppearance.html"><code>PerInstanceColorAppearance</code></a> allow giving each instance unique
properties.
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">undefined</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="asynchronous">
<a href="#asynchronous" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> asynchronous<span class="type-signature"> : Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L442">Scene/Primitive.js 442</a>
</div>
</h4>
</div>
<div class="description">
Determines if the geometry instances will be created and batched on a web worker.
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">true</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="compressVertices">
<a href="#compressVertices" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> compressVertices<span class="type-signature"> : Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L458">Scene/Primitive.js 458</a>
</div>
</h4>
</div>
<div class="description">
When <code>true</code>, geometry vertices are compressed, which will save memory.
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">true</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="cull">
<a href="#cull" class="doc-link"></a>
cull<span class="type-signature"> : Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L262">Scene/Primitive.js 262</a>
</div>
</h4>
</div>
<div class="description">
When <code>true</code>, the renderer frustum culls and horizon culls the primitive's commands
based on their bounding volume. Set this to <code>false</code> for a small performance gain
if you are manually culling the primitive.
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">true</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="debugShowBoundingVolume">
<a href="#debugShowBoundingVolume" class="doc-link"></a>
debugShowBoundingVolume<span class="type-signature"> : Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L274">Scene/Primitive.js 274</a>
</div>
</h4>
</div>
<div class="description">
This property is for debugging only; it is not for production use nor is it optimized.
<p>
Draws the bounding sphere for each draw command in the primitive.
</p>
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">false</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="depthFailAppearance">
<a href="#depthFailAppearance" class="doc-link"></a>
depthFailAppearance<span class="type-signature"> : <a href="Appearance.html">Appearance</a></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L206">Scene/Primitive.js 206</a>
</div>
</h4>
</div>
<div class="description">
The <a href="Appearance.html"><code>Appearance</code></a> used to shade this primitive when it fails the depth test. Each geometry
instance is shaded with the same appearance. Some appearances, like
<a href="PerInstanceColorAppearance.html"><code>PerInstanceColorAppearance</code></a> allow giving each instance unique
properties.
<p>
When using an appearance that requires a color attribute, like PerInstanceColorAppearance,
add a depthFailColor per-instance attribute instead.
</p>
<p>
Requires the EXT_frag_depth WebGL extension to render properly. If the extension is not supported,
there may be artifacts.
</p>
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">undefined</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="geometryInstances">
<a href="#geometryInstances" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> geometryInstances<span class="type-signature"> : Array.&lt;<a href="GeometryInstance.html">GeometryInstance</a>>|<a href="GeometryInstance.html">GeometryInstance</a></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L171">Scene/Primitive.js 171</a>
</div>
</h4>
</div>
<div class="description">
The geometry instances rendered with this primitive. This may
be <code>undefined</code> if <code>options.releaseGeometryInstances</code>
is <code>true</code> when the primitive is constructed.
<p>
Changing this property after the primitive is rendered has no effect.
</p>
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">undefined</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="interleave">
<a href="#interleave" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> interleave<span class="type-signature"> : Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L394">Scene/Primitive.js 394</a>
</div>
</h4>
</div>
<div class="description">
Determines if geometry vertex attributes are interleaved, which can slightly improve rendering performance.
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">false</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="modelMatrix">
<a href="#modelMatrix" class="doc-link"></a>
modelMatrix<span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L228">Scene/Primitive.js 228</a>
</div>
</h4>
</div>
<div class="description">
The 4x4 transformation matrix that transforms the primitive (all geometry instances) from model to world coordinates.
When this is the identity matrix, the primitive is drawn in world coordinates, i.e., Earth's WGS84 coordinates.
Local reference frames can be used by providing a different transformation matrix, like that returned
by <a href="Transforms.html#.eastNorthUpToFixedFrame"><code>Transforms.eastNorthUpToFixedFrame</code></a>.
<p>
This property is only supported in 3D mode.
</p>
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">Matrix4.IDENTITY</code>
<h5>Example:</h5>
<pre><code class="language-javascript">const origin = Cesium.Cartesian3.fromDegrees(-95.0, 40.0, 200000.0);
p.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(origin);</code></pre>
</dl>
<div class="nameContainer">
<h4 class="name" id="ready">
<a href="#ready" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> ready<span class="type-signature"> : Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L474">Scene/Primitive.js 474</a>
</div>
</h4>
</div>
<div class="description">
Determines if the primitive is complete and ready to render. If this property is
true, the primitive will be rendered the next time that <a href="Primitive.html#update"><code>Primitive#update</code></a>
is called.
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="readyPromise">
<a href="#readyPromise" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> readyPromise<span class="type-signature"> : Promise.&lt;<a href="Primitive.html">Primitive</a>></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L486">Scene/Primitive.js 486</a>
</div>
</h4>
</div>
<div class="description">
Gets a promise that resolves when the primitive is ready to render.
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="releaseGeometryInstances">
<a href="#releaseGeometryInstances" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> releaseGeometryInstances<span class="type-signature"> : Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L410">Scene/Primitive.js 410</a>
</div>
</h4>
</div>
<div class="description">
When <code>true</code>, the primitive does not keep a reference to the input <code>geometryInstances</code> to save memory.
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">true</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="shadows">
<a href="#shadows" class="doc-link"></a>
shadows<span class="type-signature"> : <a href="global.html#ShadowMode">ShadowMode</a></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L304">Scene/Primitive.js 304</a>
</div>
</h4>
</div>
<div class="description">
Determines whether this primitive casts or receives shadows from light sources.
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">ShadowMode.DISABLED</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="show">
<a href="#show" class="doc-link"></a>
show<span class="type-signature"> : Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L241">Scene/Primitive.js 241</a>
</div>
</h4>
</div>
<div class="description">
Determines if the primitive will be shown. This affects all geometry
instances in the primitive.
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">true</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="vertexCacheOptimize">
<a href="#vertexCacheOptimize" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> vertexCacheOptimize<span class="type-signature"> : Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L378">Scene/Primitive.js 378</a>
</div>
</h4>
</div>
<div class="description">
When <code>true</code>, geometry vertices are optimized for the pre and post-vertex-shader caches.
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">true</code>
</dl>
<h3 class="subsection-title">Methods</h3>
<div class="nameContainer">
<h4 class="name" id="destroy">
<a href="#destroy" class="doc-link"></a>
destroy<span class="signature">()</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L2479">Scene/Primitive.js 2479</a>
</div>
</h4>
</div>
<div class="description">
Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
release of WebGL resources, instead of relying on the garbage collector to destroy this object.
<p>
Once an object is destroyed, it should not be used; calling any function other than
<code>isDestroyed</code> will result in a <a href="DeveloperError.html"><code>DeveloperError</code></a> exception. Therefore,
assign the return value (<code>undefined</code>) to the object as done in the example.
</p>
</div>
<h5>Throws:</h5>
<ul>
<li>
<div class="param-desc">
<span class="param-type"><a href="DeveloperError.html">DeveloperError</a></span>
: This object was destroyed, i.e., destroy() was called.
</div>
</li>
</ul>
<dl class="details">
<h5>Example:</h5>
<pre><code class="language-javascript">e = e &amp;&amp; e.destroy();</code></pre>
<h5>See:</h5>
<ul class="see-list">
<li><a href="Primitive.html#isDestroyed">Primitive#isDestroyed</a></li>
</ul>
</dl>
<div class="nameContainer">
<h4 class="name" id="getGeometryInstanceAttributes">
<a href="#getGeometryInstanceAttributes" class="doc-link"></a>
getGeometryInstanceAttributes<span class="signature">(id)</span> &rarr; <span class="type-signature returnType">Object</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L2390">Scene/Primitive.js 2390</a>
</div>
</h4>
</div>
<div class="description">
Returns the modifiable per-instance attributes for a <a href="GeometryInstance.html"><code>GeometryInstance</code></a>.
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>id</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last">
The id of the <a href="GeometryInstance.html"><code>GeometryInstance</code></a>.</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
The typed array in the attribute's format or undefined if the is no instance with id.
</div>
<h5>Throws:</h5>
<ul>
<li>
<div class="param-desc">
<span class="param-type"><a href="DeveloperError.html">DeveloperError</a></span>
: must call update before calling getGeometryInstanceAttributes.
</div>
</li>
</ul>
<dl class="details">
<h5>Example:</h5>
<pre><code class="language-javascript">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);</code></pre>
</dl>
<div class="nameContainer">
<h4 class="name" id="isDestroyed">
<a href="#isDestroyed" class="doc-link"></a>
isDestroyed<span class="signature">()</span> &rarr; <span class="type-signature returnType">Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L2458">Scene/Primitive.js 2458</a>
</div>
</h4>
</div>
<div class="description">
Returns true if this object was destroyed; otherwise, false.
<p>
If this object was destroyed, it should not be used; calling any function other than
<code>isDestroyed</code> will result in a <a href="DeveloperError.html"><code>DeveloperError</code></a> exception.
</p>
</div>
<h5>Returns:</h5>
<div class="param-desc">
<code>true</code> if this object was destroyed; otherwise, <code>false</code>.
</div>
<dl class="details">
<h5>See:</h5>
<ul class="see-list">
<li><a href="Primitive.html#destroy">Primitive#destroy</a></li>
</ul>
</dl>
<div class="nameContainer">
<h4 class="name" id="update">
<a href="#update" class="doc-link"></a>
update<span class="signature">()</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Primitive.js#L2091">Scene/Primitive.js 2091</a>
</div>
</h4>
</div>
<div class="description">
Called when <a href="Viewer.html"><code>Viewer</code></a> or <a href="CesiumWidget.html"><code>CesiumWidget</code></a> render the scene to
get the draw commands needed to render this primitive.
<p>
Do not call this function directly. This is documented just to
list the exceptions that may be propagated when the scene is rendered:
</p>
</div>
<h5>Throws:</h5>
<ul>
<li>
<div class="param-desc">
<span class="param-type"><a href="DeveloperError.html">DeveloperError</a></span>
: All instance geometries must have the same primitiveType.
</div>
</li>
<li>
<div class="param-desc">
<span class="param-type"><a href="DeveloperError.html">DeveloperError</a></span>
: Appearance and material have a uniform with the same name.
</div>
</li>
<li>
<div class="param-desc">
<span class="param-type"><a href="DeveloperError.html">DeveloperError</a></span>
: Primitive.modelMatrix is only supported in 3D mode.
</div>
</li>
<li>
<div class="param-desc">
<span class="param-type"><a href="RuntimeError.html">RuntimeError</a></span>
: Vertex texture fetch support is required to render primitives with per-instance attributes. The maximum number of vertex texture image units must be greater than zero.
</div>
</li>
</ul>
<dl class="details">
</dl>
</article>
</section>
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a>
</footer>
</div>
<div class="nav">
<div class="menu">
<input type="text" class="classFilter" id="ClassFilter" placeholder="Search">
<ul id="ClassList"><li data-name="Animation"><a href="Animation.html">Animation</a></li><li data-name="AnimationViewModel"><a href="AnimationViewModel.html">AnimationViewModel</a></li><li data-name="Appearance"><a href="Appearance.html">Appearance</a></li><li data-name="ArcGisMapServerImageryProvider"><a href="ArcGisMapServerImageryProvider.html">ArcGisMapServerImageryProvider</a></li><li data-name="ArcGISTiledElevationTerrainProvider"><a href="ArcGISTiledElevationTerrainProvider.html">ArcGISTiledElevationTerrainProvider</a></li><li data-name="ArcType"><a href="global.html#ArcType">ArcType</a></li><li data-name="AssociativeArray"><a href="AssociativeArray.html">AssociativeArray</a></li><li data-name="Axis"><a href="global.html#Axis">Axis</a></li><li data-name="AxisAlignedBoundingBox"><a href="AxisAlignedBoundingBox.html">AxisAlignedBoundingBox</a></li><li data-name="backFaceCulling"><a href="global.html#backFaceCulling">backFaceCulling</a></li><li data-name="barycentricCoordinates"><a href="global.html#barycentricCoordinates">barycentricCoordinates</a></li><li data-name="BaseLayerPicker"><a href="BaseLayerPicker.html">BaseLayerPicker</a></li><li data-name="BaseLayerPickerViewModel"><a href="BaseLayerPickerViewModel.html">BaseLayerPickerViewModel</a></li><li data-name="Billboard"><a href="Billboard.html">Billboard</a></li><li data-name="BillboardCollection"><a href="BillboardCollection.html">BillboardCollection</a></li><li data-name="BillboardGraphics"><a href="BillboardGraphics.html">BillboardGraphics</a></li><li data-name="BillboardVisualizer"><a href="BillboardVisualizer.html">BillboardVisualizer</a></li><li data-name="binarySearch"><a href="global.html#binarySearch">binarySearch</a></li><li data-name="binarySearchComparator"><a href="global.html#binarySearchComparator">binarySearchComparator</a></li><li data-name="BingMapsGeocoderService"><a href="BingMapsGeocoderService.html">BingMapsGeocoderService</a></li><li data-name="BingMapsImageryProvider"><a href="BingMapsImageryProvider.html">BingMapsImageryProvider</a></li><li data-name="BingMapsStyle"><a href="global.html#BingMapsStyle">BingMapsStyle</a></li><li data-name="BlendEquation"><a href="global.html#BlendEquation">BlendEquation</a></li><li data-name="BlendFunction"><a href="global.html#BlendFunction">BlendFunction</a></li><li data-name="BlendingState"><a href="BlendingState.html">BlendingState</a></li><li data-name="BlendOption"><a href="global.html#BlendOption">BlendOption</a></li><li data-name="BoundingRectangle"><a href="BoundingRectangle.html">BoundingRectangle</a></li><li data-name="BoundingSphere"><a href="BoundingSphere.html">BoundingSphere</a></li><li data-name="boundingSphere"><a href="global.html#boundingSphere">boundingSphere</a></li><li data-name="BoxEmitter"><a href="BoxEmitter.html">BoxEmitter</a></li><li data-name="BoxGeometry"><a href="BoxGeometry.html">BoxGeometry</a></li><li data-name="BoxGeometryUpdater"><a href="BoxGeometryUpdater.html">BoxGeometryUpdater</a></li><li data-name="BoxGraphics"><a href="BoxGraphics.html">BoxGraphics</a></li><li data-name="BoxOutlineGeometry"><a href="BoxOutlineGeometry.html">BoxOutlineGeometry</a></li><li data-name="buildModuleUrl"><a href="global.html#buildModuleUrl">buildModuleUrl</a></li><li data-name="CallbackProperty"><a href="CallbackProperty.html">CallbackProperty</a></li><li data-name="Camera"><a href="Camera.html">Camera</a></li><li data-name="CameraEventAggregator"><a href="CameraEventAggregator.html">CameraEventAggregator</a></li><li data-name="CameraEventType"><a href="global.html#CameraEventType">CameraEventType</a></li><li data-name="cancelAnimationFrame"><a href="global.html#cancelAnimationFrame">cancelAnimationFrame</a></li><li data-name="Cartesian2"><a href="Cartesian2.html">Cartesian2</a></li><li data-name="Cartesian3"><a href="Cartesian3.html">Cartesian3</a></li><li data-name="Cartesian4"><a href="Cartesian4.html">Cartesian4</a></li><li data-name="Cartographic"><a href="Cartographic.html">Cartographic</a></li><li data-name="CartographicGeocoderService"><a href="CartographicGeocoderServic
</div>
</div>
<script>
if (window.frameElement) {
document.body.className = 'embedded';
var ele = document.createElement('a');
ele.className = 'popout';
ele.target = '_blank';
ele.href = window.location.href;
ele.title = 'Pop out';
document.getElementById('main').appendChild(ele);
}
// Set targets on external links. Sandcastle and GitHub shouldn't be embedded in any iframe.
Array.prototype.forEach.call(document.getElementsByTagName('a'), function(a) {
if (/^https?:/i.test(a.getAttribute('href'))) {
a.target='_blank';
}
});
</script>
<script src="javascript/prism.js"></script>
<script src="javascript/cesiumDoc.js"></script>
</body>
</html>