Appearance
KBE3D / KBCore / Cesium / CloudCollection
类: CloudCollection
A renderable collection of clouds in the 3D scene. <br /><br /> <div align='center'> <img src='/Images/CumulusCloud.png' width='400' height='300' /><br /> Example cumulus clouds </div> <br /><br /> Clouds are added and removed from the collection using CloudCollection#add and CloudCollection#remove.
示例
ts
// Create a cloud collection with two cumulus clouds
const clouds = scene.primitives.add(new Cesium.CloudCollection());
clouds.add({
position : new Cesium.Cartesian3(1.0, 2.0, 3.0),
maximumSize: new Cesium.Cartesian3(20.0, 12.0, 8.0)
});
clouds.add({
position : new Cesium.Cartesian3(4.0, 5.0, 6.0),
maximumSize: new Cesium.Cartesian3(15.0, 9.0, 9.0),
slice: 0.5
});参数
Object with the following properties:
参数
Whether to display the clouds.
参数
Desired amount of detail in the noise texture.
参数
Desired translation of data in noise texture.
参数
For debugging only. Determines if the billboards are rendered with an opaque color.
参数
For debugging only. Determines if the clouds will be rendered as opaque ellipsoids.
属性
noiseDetail
noiseDetail:
number
<p> Controls the amount of detail captured in the precomputed noise texture used to render the cumulus clouds. In order for the texture to be tileable, this must be a power of two. For best results, set this to be a power of two between <code>8.0</code> and <code>32.0</code> (inclusive). </p>
<div align='center'> <table border='0' cellpadding='5'><tr> <td align='center'> <code>clouds.noiseDetail = 8.0;</code><br/> <img src='/Images/CloudCollection.noiseDetail8.png' width='250' height='158' /> </td> <td align='center'> <code>clouds.noiseDetail = 32.0;</code><br/> <img src='/Images/CloudCollection.noiseDetail32.png' width='250' height='158' /> </td> </tr></table> </div>
noiseOffset
noiseOffset:
Cartesian3
<p> Applies a translation to noise texture coordinates to generate different data. This can be modified if the default noise does not generate good-looking clouds. </p>
<div align='center'> <table border='0' cellpadding='5'><tr> <td align='center'> <code>default</code><br/> <img src='/Images/CloudCollection.noiseOffsetdefault.png' width='250' height='158' /> </td> <td align='center'> <code>clouds.noiseOffset = new Cesium.Cartesian3(10, 20, 10);</code><br/> <img src='/Images/CloudCollection.noiseOffsetx10y20z10.png' width='250' height='158' /> </td> </tr></table> </div>
show
show:
boolean
Determines if billboards in this collection will be shown.
debugBillboards
debugBillboards:
boolean
This property is for debugging only; it is not for production use nor is it optimized. <p> Renders the billboards with one opaque color for the sake of debugging. </p>
debugEllipsoids
debugEllipsoids:
boolean
This property is for debugging only; it is not for production use nor is it optimized. <p> Draws the clouds as opaque, monochrome ellipsoids for the sake of debugging. If <code>debugBillboards</code> is also true, then the ellipsoids will draw on top of the billboards. </p>
length
length:
number
Returns the number of clouds in this collection.
方法
add()
add(
options?:any):CumulusCloud
Creates and adds a cloud with the specified initial properties to the collection. The added cloud is returned so it can be modified or removed from the collection later.
参数
options?
any
A template describing the cloud's properties as shown in Example 1.
返回
The cloud that was added to the collection.
Examples
ts
// Example 1: Add a cumulus cloud, specifying all the default values.
const c = clouds.add({
show : true,
position : Cesium.Cartesian3.ZERO,
scale : new Cesium.Cartesian2(20.0, 12.0),
maximumSize: new Cesium.Cartesian3(20.0, 12.0, 12.0),
slice: -1.0,
cloudType : CloudType.CUMULUS
});ts
// Example 2: Specify only the cloud's cartographic position.
const c = clouds.add({
position : Cesium.Cartesian3.fromDegrees(longitude, latitude, height)
});remove()
remove(
cloud:CumulusCloud):boolean
Removes a cloud from the collection.
参数
cloud
The cloud to remove.
返回
boolean
true if the cloud was removed; false if the cloud was not found in the collection.
示例
ts
const c = clouds.add(...);
clouds.remove(c); // Returns trueremoveAll()
removeAll():
void
Removes all clouds from the collection.
返回
void
示例
ts
clouds.add(...);
clouds.add(...);
clouds.removeAll();contains()
contains(
cloud?:CumulusCloud):boolean
Check whether this collection contains a given cloud.
参数
cloud?
The cloud to check for.
返回
boolean
true if this collection contains the cloud, false otherwise.
get()
get(
index:number):CumulusCloud
Returns the cloud in the collection at the specified index. Indices are zero-based and increase as clouds are added. Removing a cloud shifts all clouds after it to the left, changing their indices. This function is commonly used with CloudCollection#length to iterate over all the clouds in the collection.
参数
index
number
The zero-based index of the cloud.
返回
The cloud at the specified index.
示例
ts
// Toggle the show property of every cloud in the collection
const len = clouds.length;
for (let i = 0; i < len; ++i) {
const c = clouds.get(i);
c.show = !c.show;
}isDestroyed()
isDestroyed():
boolean
Returns true if this object was destroyed; otherwise, false. <br /><br /> If this object was destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a DeveloperError exception.
返回
boolean
true if this object was destroyed; otherwise, false.
destroy()
destroy():
void
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. <br /><br /> Once an object is destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a DeveloperError exception. Therefore, assign the return value (<code>undefined</code>) to the object as done in the example.
返回
void
示例
ts
clouds = clouds && clouds.destroy();构造函数
构造函数
new CloudCollection(
options?: {show?:boolean;noiseDetail?:number;noiseOffset?:number;debugBillboards?:boolean;debugEllipsoids?:boolean; }):CloudCollection
参数
options?
show?
boolean
noiseDetail?
number
noiseOffset?
number
debugBillboards?
boolean
debugEllipsoids?
boolean
返回
CloudCollection
