Appearance
KBE3D / KBCore / Cesium / Material
类: Material
A Material defines surface appearance through a combination of diffuse, specular, normal, emission, and alpha components. These values are specified using a JSON schema called Fabric which gets parsed and assembled into glsl shader code behind-the-scenes. Check out the wiki page for more details on Fabric. <br /><br />
示例
ts
// 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)
}
}
});参数
Object with the following properties:
参数
Throws errors for issues that would normally be ignored, including unused uniforms or materials.
参数
When <code>true</code> or a function that returns <code>true</code>, the geometry with this material is expected to appear translucent.
参数
The TextureMinificationFilter to apply to this material's textures.
参数
The TextureMagnificationFilter to apply to this material's textures.
参数
The fabric JSON used to generate the material.
继承于
属性
DefaultImageId
staticDefaultImageId:string
Gets or sets the default texture uniform value.
DefaultCubeMapId
staticDefaultCubeMapId:string
Gets or sets the default cube map texture uniform value.
ColorType
readonlystaticColorType:string
Gets the name of the color material.
ImageType
readonlystaticImageType:string
Gets the name of the image material.
DiffuseMapType
readonlystaticDiffuseMapType:string
Gets the name of the diffuce map material.
AlphaMapType
readonlystaticAlphaMapType:string
Gets the name of the alpha map material.
SpecularMapType
readonlystaticSpecularMapType:string
Gets the name of the specular map material.
EmissionMapType
readonlystaticEmissionMapType:string
Gets the name of the emmision map material.
BumpMapType
readonlystaticBumpMapType:string
Gets the name of the bump map material.
NormalMapType
readonlystaticNormalMapType:string
Gets the name of the normal map material.
GridType
readonlystaticGridType:string
Gets the name of the grid material.
StripeType
readonlystaticStripeType:string
Gets the name of the stripe material.
CheckerboardType
readonlystaticCheckerboardType:string
Gets the name of the checkerboard material.
DotType
readonlystaticDotType:string
Gets the name of the dot material.
WaterType
readonlystaticWaterType:string
Gets the name of the water material.
RimLightingType
readonlystaticRimLightingType:string
Gets the name of the rim lighting material.
FadeType
readonlystaticFadeType:string
Gets the name of the fade material.
PolylineArrowType
readonlystaticPolylineArrowType:string
Gets the name of the polyline arrow material.
PolylineDashType
readonlystaticPolylineDashType:string
Gets the name of the polyline glow material.
PolylineGlowType
readonlystaticPolylineGlowType:string
Gets the name of the polyline glow material.
PolylineOutlineType
readonlystaticPolylineOutlineType:string
Gets the name of the polyline outline material.
ElevationContourType
readonlystaticElevationContourType:string
Gets the name of the elevation contour material.
ElevationRampType
readonlystaticElevationRampType:string
Gets the name of the elevation contour material.
SlopeRampMaterialType
readonlystaticSlopeRampMaterialType:string
Gets the name of the slope ramp material.
AspectRampMaterialType
readonlystaticAspectRampMaterialType:string
Gets the name of the aspect ramp material.
ElevationBandType
readonlystaticElevationBandType:string
Gets the name of the elevation band material.
WaterMaskType
readonlystaticWaterMaskType:string
Gets the name of the water mask material.
type
type:
string
The material type. Can be an existing type or a new type. If no type is specified in fabric, type is a GUID.
shaderSource
shaderSource:
string
The glsl shader source for this material.
materials
materials:
any
Maps sub-material names to Material objects.
uniforms
uniforms:
any
Maps uniform names to their values.
translucent
translucent:
boolean| (...params:any[]) =>any
When <code>true</code> or a function that returns <code>true</code>, the geometry is expected to appear translucent.
方法
fromType()
staticfromType(type:string,uniforms?:any):Material
Creates a new material using an existing material type. <br /><br /> Shorthand for: new Material({fabric : {type : type}});
参数
type
string
The base material type.
uniforms?
any
Overrides for the default uniforms.
返回
Material
New material object.
示例
ts
const material = Cesium.Material.fromType('Color', {
color: new Cesium.Color(1.0, 0.0, 0.0, 1.0)
});fromTypeAsync()
staticfromTypeAsync(type:string,uniforms?:any):Promise<Material>
Creates a new material using an existing material type and returns a promise that resolves when all of the material's resources have been loaded.
参数
type
string
The base material type.
uniforms?
any
Overrides for the default uniforms.
返回
Promise<Material>
A promise that resolves to a new material object when all resources are loaded.
示例
ts
const material = await Cesium.Material.fromTypeAsync('Image', {
image: '../Images/Cesium_Logo_overlay.png'
});isTranslucent()
isTranslucent():
boolean
Gets whether or not this material is translucent.
返回
boolean
true if this material is translucent, false otherwise.
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
material = material && material.destroy();构造函数
构造函数
new Material(
options?: {fabric:any;strict?:boolean;translucent?:boolean| (...params:any[]) =>any;minificationFilter?:TextureMinificationFilter;magnificationFilter?:TextureMagnificationFilter; }):Material
参数
options?
fabric
any
strict?
boolean
translucent?
boolean | (...params: any[]) => any
minificationFilter?
magnificationFilter?
返回
Material
