main.cesium.Material.kt Maven / Gradle / Ivy
// Automatically generated - do not modify!
@file:JsModule("cesium")
@file:Suppress(
"NON_EXTERNAL_DECLARATION_IN_INAPPROPRIATE_FILE",
)
package cesium
/**
* 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](https://github.com/CesiumGS/cesium/wiki/Fabric)
* for more details on Fabric.
*
* Base material types and their uniforms:
* ```
* // Create a color material with fromType:
* polygon.material = Material.fromType('Color');
* polygon.material.uniforms.color = new Color(1.0, 1.0, 0.0, 1.0);
*
* // Create the default material:
* polygon.material = new Material();
*
* // Create a color material with full Fabric notation:
* polygon.material = new Material({
* fabric : {
* type : 'Color',
* uniforms : {
* color : new Color(1.0, 1.0, 0.0, 1.0)
* }
* }
* });
* ```
* @see Online Documentation
*/
external class Material(options: ConstructorOptions? = definedExternally) {
/**
* @property [strict] Throws errors for issues that would normally be ignored, including unused uniforms or materials.
* Default value - `false`
* @property [translucent] When `true` or a function that returns `true`, the geometry
* with this material is expected to appear translucent.
* Default value - `true`
* @property [minificationFilter] The [TextureMinificationFilter] to apply to this material's textures.
* Default value - [TextureMinificationFilter.LINEAR]
* @property [magnificationFilter] The [TextureMagnificationFilter] to apply to this material's textures.
* Default value - [TextureMagnificationFilter.LINEAR]
* @property [fabric] The fabric JSON used to generate the material.
*/
interface ConstructorOptions {
var strict: Boolean?
var translucent: dynamic
var minificationFilter: TextureMinificationFilter?
var magnificationFilter: TextureMagnificationFilter?
var fabric: Any
}
/**
* The material type. Can be an existing type or a new type. If no type is specified in fabric, type is a GUID.
* @see Online Documentation
*/
var type: String
/**
* The glsl shader source for this material.
* @see Online Documentation
*/
var shaderSource: String
/**
* Maps sub-material names to Material objects.
* @see Online Documentation
*/
var materials: Any
/**
* Maps uniform names to their values.
* @see Online Documentation
*/
var uniforms: Any
/**
* When `true` or a function that returns `true`,
* the geometry is expected to appear translucent.
* @see Online Documentation
*/
var translucent: dynamic
/**
* Gets whether or not this material is translucent.
* @return `true` if this material is translucent, `false` otherwise.
* @see Online Documentation
*/
fun isTranslucent(): Boolean
/**
* Returns true if this object was destroyed; otherwise, false.
*
* If this object was destroyed, it should not be used; calling any function other than
* `isDestroyed` will result in a [DeveloperError] exception.
* @return True if this object was destroyed; otherwise, false.
* @see Online Documentation
*/
fun isDestroyed(): Boolean
/**
* 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.
*
* 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.
* ```
* material = material && material.destroy();
* ```
* @see Online Documentation
*/
fun destroy()
companion object {
/**
* Creates a new material using an existing material type.
*
* Shorthand for: new Material({fabric : {type : type}});
* ```
* const material = Material.fromType('Color', {
* color : new Color(1.0, 0.0, 0.0, 1.0)
* });
* ```
* @param [type] The base material type.
* @param [uniforms] Overrides for the default uniforms.
* @return New material object.
* @see Online Documentation
*/
fun fromType(
type: String,
uniforms: Any? = definedExternally,
): Material
/**
* Gets or sets the default texture uniform value.
* @see Online Documentation
*/
var DefaultImageId: String
/**
* Gets or sets the default cube map texture uniform value.
* @see Online Documentation
*/
var DefaultCubeMapId: String
/**
* Gets the name of the color material.
* @see Online Documentation
*/
val ColorType: String
/**
* Gets the name of the image material.
* @see Online Documentation
*/
val ImageType: String
/**
* Gets the name of the diffuce map material.
* @see Online Documentation
*/
val DiffuseMapType: String
/**
* Gets the name of the alpha map material.
* @see Online Documentation
*/
val AlphaMapType: String
/**
* Gets the name of the specular map material.
* @see Online Documentation
*/
val SpecularMapType: String
/**
* Gets the name of the emmision map material.
* @see Online Documentation
*/
val EmissionMapType: String
/**
* Gets the name of the bump map material.
* @see Online Documentation
*/
val BumpMapType: String
/**
* Gets the name of the normal map material.
* @see Online Documentation
*/
val NormalMapType: String
/**
* Gets the name of the grid material.
* @see Online Documentation
*/
val GridType: String
/**
* Gets the name of the stripe material.
* @see Online Documentation
*/
val StripeType: String
/**
* Gets the name of the checkerboard material.
* @see Online Documentation
*/
val CheckerboardType: String
/**
* Gets the name of the dot material.
* @see Online Documentation
*/
val DotType: String
/**
* Gets the name of the water material.
* @see Online Documentation
*/
val WaterType: String
/**
* Gets the name of the rim lighting material.
* @see Online Documentation
*/
val RimLightingType: String
/**
* Gets the name of the fade material.
* @see Online Documentation
*/
val FadeType: String
/**
* Gets the name of the polyline arrow material.
* @see Online Documentation
*/
val PolylineArrowType: String
/**
* Gets the name of the polyline glow material.
* @see Online Documentation
*/
val PolylineDashType: String
/**
* Gets the name of the polyline glow material.
* @see Online Documentation
*/
val PolylineGlowType: String
/**
* Gets the name of the polyline outline material.
* @see Online Documentation
*/
val PolylineOutlineType: String
/**
* Gets the name of the elevation contour material.
* @see Online Documentation
*/
val ElevationContourType: String
/**
* Gets the name of the elevation contour material.
* @see Online Documentation
*/
val ElevationRampType: String
/**
* Gets the name of the slope ramp material.
* @see Online Documentation
*/
val SlopeRampMaterialType: String
/**
* Gets the name of the aspect ramp material.
* @see Online Documentation
*/
val AspectRampMaterialType: String
/**
* Gets the name of the elevation band material.
* @see Online Documentation
*/
val ElevationBandType: String
}
}
inline fun Material(
block: Material.ConstructorOptions.() -> Unit,
): Material {
val options: Material.ConstructorOptions = js("({})")
block(options)
return Material(options)
}