一种材料通过扩散、光谱、光谱、光谱等组合来定义表面外观,
正常,排放,和α组件。 这些值使用
名为 Fabric 的图案, 被解析后组装成 glsl 阴影码
behind-the-scenes. Check out the wiki page
关于法布里克的更多细节.
基本材料类型及其制服:
基本材料类型及其制服:
- Color
color: rgba color object.- Image
image: path to image.repeat: Object with x and y values specifying the number of times to repeat the image.- DiffuseMap
image: path to image.channels: Three character string containing any combination of r, g, b, and a for selecting the desired image channels.repeat: Object with x and y values specifying the number of times to repeat the image.- AlphaMap
image: path to image.channel: One character string containing r, g, b, or a for selecting the desired image channel.repeat: Object with x and y values specifying the number of times to repeat the image.- SpecularMap
image: path to image.channel: One character string containing r, g, b, or a for selecting the desired image channel.repeat: Object with x and y values specifying the number of times to repeat the image.- EmissionMap
image: path to image.channels: Three character string containing any combination of r, g, b, and a for selecting the desired image channels.repeat: Object with x and y values specifying the number of times to repeat the image.- BumpMap
image: path to image.channel: One character string containing r, g, b, or a for selecting the desired image channel.repeat: Object with x and y values specifying the number of times to repeat the image.strength: Bump strength value between 0.0 and 1.0 where 0.0 is small bumps and 1.0 is large bumps.- NormalMap
image: path to image.channels: Three character string containing any combination of r, g, b, and a for selecting the desired image channels.repeat: Object with x and y values specifying the number of times to repeat the image.strength: Bump strength value between 0.0 and 1.0 where 0.0 is small bumps and 1.0 is large bumps.- Grid
color: rgba color object for the whole material.cellAlpha: Alpha value for the cells between grid lines. This will be combined with color.alpha.lineCount: Object with x and y values specifying the number of columns and rows respectively.lineThickness: Object with x and y values specifying the thickness of grid lines (in pixels where available).lineOffset: Object with x and y values specifying the offset of grid lines (range is 0 to 1).- Stripe
horizontal: Boolean that determines if the stripes are horizontal or vertical.evenColor: rgba color object for the stripe's first color.oddColor: rgba color object for the stripe's second color.offset: Number that controls at which point into the pattern to begin drawing; with 0.0 being the beginning of the even color, 1.0 the beginning of the odd color, 2.0 being the even color again, and any multiple or fractional values being in between.repeat: Number that controls the total number of stripes, half light and half dark.- Checkerboard
lightColor: rgba color object for the checkerboard's light alternating color.darkColor: rgba color object for the checkerboard's dark alternating color.repeat: Object with x and y values specifying the number of columns and rows respectively.- Dot
lightColor: rgba color object for the dot color.darkColor: rgba color object for the background color.repeat: Object with x and y values specifying the number of columns and rows of dots respectively.- Water
baseWaterColor: rgba color object base color of the water.blendColor: rgba color object used when blending from water to non-water areas.specularMap: Single channel texture used to indicate areas of water.normalMap: Normal map for water normal perturbation.frequency: Number that controls the number of waves.animationSpeed: Number that controls the animations speed of the water.amplitude: Number that controls the amplitude of water waves.specularIntensity: Number that controls the intensity of specular reflections.- RimLighting
color: diffuse color and alpha.rimColor: diffuse color and alpha of the rim.width: Number that determines the rim's width.- Fade
fadeInColor: diffuse color and alpha attimefadeOutColor: diffuse color and alpha atmaximumDistancefromtimemaximumDistance: Number between 0.0 and 1.0 where thefadeInColorbecomes thefadeOutColor. A value of 0.0 gives the entire material a color offadeOutColorand a value of 1.0 gives the the entire material a color offadeInColorrepeat: true if the fade should wrap around the texture coodinates.fadeDirection: Object with x and y values specifying if the fade should be in the x and y directions.time: Object with x and y values between 0.0 and 1.0 of thefadeInColorposition- PolylineArrow
color: diffuse color and alpha.- PolylineDash
color: color for the line.gapColor: color for the gaps in the line.dashLength: Dash length in pixels.dashPattern: The 16 bit stipple pattern for the line..- PolylineGlow
color: color and maximum alpha for the glow on the line.glowPower: strength of the glow, as a percentage of the total line width (less than 1.0).taperPower: strength of the tapering effect, as a percentage of the total line length. If 1.0 or higher, no taper effect is used.- PolylineOutline
color: diffuse color and alpha for the interior of the line.outlineColor: diffuse color and alpha for the outline.outlineWidth: width of the outline in pixels.- ElevationContour
color: color and alpha for the contour line.spacing: spacing for contour lines in meters.width: Number specifying the width of the grid lines in pixels.- ElevationRamp
image: color ramp image to use for coloring the terrain.minimumHeight: minimum height for the ramp.maximumHeight: maximum height for the ramp.- SlopeRamp
image: color ramp image to use for coloring the terrain by slope.- AspectRamp
image: color ramp image to use for color the terrain by aspect.- ElevationBand
heights: image of heights sorted from lowest to highest.colors: image of colors at the corresponding heights.- WaterMask
waterColor: diffuse color and alpha for the areas covered by water.landColor: diffuse color and alpha for the areas covered by land.
| Name | Type | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
optional
下列属性的对象 :
|
Throws:
-
DeveloperError : fabric: uniform has invalid type.
-
DeveloperError : fabric: uniforms and materials cannot share the same property.
-
DeveloperError : fabric: cannot have source and components in the same section.
-
DeveloperError : fabric: property name is not valid. It should be 'type', 'materials', 'uniforms', 'components', or 'source'.
-
DeveloperError : fabric: property name is not valid. It should be 'diffuse', 'specular', 'shininess', 'normal', 'emission', or 'alpha'.
-
DeveloperError : strict: shader source does not use string.
-
DeveloperError : strict: shader source does not use uniform.
-
DeveloperError : strict: shader source does not use material.
- Fabric wiki page for a more detailed options of Fabric.
Example:
// 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)
}
}
});
Demo:
See:
Members
获得α地图材料的名称.
获得侧面斜坡材料的名称.
获得凸起图材料的名称.
获得棋盘材料的名称.
获得颜色材料的名称.
获取或设置默认的立方体地图纹理统一值.
获取或设置默认的纹理统一值.
获得diffuce地图材料的名称.
获得点材料的名称.
获得高频带材料的名称.
获得高架轮廓材料的名称.
获得高架轮廓材料的名称.
获得映射图材料的名称.
获得淡出材料的名称.
获得网格材料的名称.
获得图像材料的名称.
获得普通地图材料的名称.
获得多线箭头材料的名称.
获得聚线发光材料的名称.
获得聚线发光材料的名称.
获得多线大纲材料的名称.
获得轮廓照明材料的名称.
获得斜坡材料的名称.
获得光谱图材料的名称.
获得条纹材料的名称.
获得水面具材料的名称.
获得水料名称.
将子材料名称映射到物质对象.
-
Default Value:
undefined
此材料的 glsl 阴影源 .
-
Default Value:
undefined
当 NT 0 真 NT 1 或返回 NT 2 真 NT 3 的函数时,
的几何形状将呈现半透明.
-
Default Value:
undefined
物质类型. 可以是现有类型,也可以是新类型。 如果织物中没有指定类型,类型为 GUID .
-
Default Value:
undefined
将统一名称映射到其价值.
-
Default Value:
undefined
Methods
static Cesium.Material.fromType(type, uniforms) → Material
利用现有材料类型创建新材料.
Shorthand for: new Material({fabric : {type : type}});
Shorthand for: new Material({fabric : {type : type}});
| Name | Type | Description |
|---|---|---|
type |
string | 基础材料类型. |
uniforms |
object | optional 默认制服的覆写. |
Returns:
新材料对象.
Throws:
-
DeveloperError : material with that type does not exist.
Example:
const material = Cesium.Material.fromType('Color', {
color: new Cesium.Color(1.0, 0.0, 0.0, 1.0)
});
static Cesium.Material.fromTypeAsync(type, uniforms) → Promise.<Material>
使用已有的材料类型创建新材料, 并返回一个解析当
所有材料的资源都装满了.
| Name | Type | Description |
|---|---|---|
type |
string | 基础材料类型. |
uniforms |
object | optional 默认制服的覆写. |
Returns:
一个承诺,当所有资源都装满后,就能解决一个新的物质对象.
Throws:
-
DeveloperError : material with that type does not exist.
Example:
const material = await Cesium.Material.fromTypeAsync('Image', {
image: '../Images/Cesium_Logo_overlay.png'
});
Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
释放 WebGL 资源,而不是依赖垃圾收集器来摧毁此对象.
Once an object is destroyed, it should not be used; calling any function other than
Once an object is destroyed, it should not be used; calling any function other than
isDestroyed will result in a DeveloperError exception. Therefore,
assign the return value (undefined) to the object as done in the example.
Throws:
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
Example:
material = material && material.destroy();
See:
如果此对象被销毁, 返回真实; 否则, 错误 .
If this object was destroyed, it should not be used; calling any function other than
If this object was destroyed, it should not be used; calling any function other than
isDestroyed will result in a DeveloperError exception.
Returns:
如果此天体被销毁, 则属真; 否则, 属假 .
See:
获得这种材料是否半透明.
Returns:
true if this material is translucent, false otherwise.