import type { Context } from "../../../context"; import * as BABYLON from "@babylonjs/core"; import * as Inputs from "../../../inputs"; import type { Color } from "@bitbybit-dev/base"; /** * Physically based materials of the metallic-roughness kind, the standard way to describe a real * surface: a base color, how metallic it is from 0 for plastic or paint to 1 for bare metal, how * rough from 0 for a mirror finish to 1 for matte, an opacity and an optional texture. Create one, * then give it to meshes with `mesh.setMaterial` or through the drawing options. */ export declare class BabylonMaterialPbrMetallicRoughness { private readonly context; private readonly color; constructor(context: Context, color: Color); /** * Creates a metallic-roughness material with the given color, metallic and roughness values, * opacity, back-face culling and optional emissive color. * * Metallic 0 looks like paint or plastic and 1 like bare metal; roughness 0 is a mirror finish * and 1 is matte. `alpha` below 1 makes the surface see-through. * @param inputs - The name, colors, metallic and roughness values, opacity, culling and z offset * @returns The material * @group create * @shortname pbr material * @disposableOutput true * @example * ```typescript * const brushed = bitbybit.babylon.material.pbrMetallicRoughness.create({ name: "brushed", baseColor: "#c0c0c0", emissiveColor: "#000000", metallic: 1, roughness: 0.4, alpha: 1, backFaceCulling: true, zOffset: 0 }); * bitbybit.babylon.mesh.setMaterial({ babylonMesh: mesh, material: brushed, includeChildren: true }); * ``` */ create(inputs: Inputs.BabylonMaterial.PBRMetallicRoughnessDto): BABYLON.PBRMetallicRoughnessMaterial; /** * Changes the base color of a material, the color its surface has under white light, from a hex * string. * @param inputs - The material and the hex color * @group set * @shortname set base color */ setBaseColor(inputs: Inputs.BabylonMaterial.BaseColorDto): void; /** * Changes how metallic a material looks, from 0 for paint or plastic to 1 for bare metal. * @param inputs - The material and the metallic value * @group set * @shortname set metallic */ setMetallic(inputs: Inputs.BabylonMaterial.MetallicDto): void; /** * Changes how rough a material's surface is, from 0 for a mirror finish to 1 for fully matte. * @param inputs - The material and the roughness value * @group set * @shortname set roughness */ setRoughness(inputs: Inputs.BabylonMaterial.RoughnessDto): void; /** * Changes the opacity of a material, from 0 for invisible to 1 for solid; values between make * the surface see-through. * @param inputs - The material and the opacity * @group set * @shortname set alpha */ setAlpha(inputs: Inputs.BabylonMaterial.AlphaDto): void; /** * Sets whether the back of each face is skipped when drawing; culling is faster, while drawing * both sides shows the inside of open or single-sided meshes. * @param inputs - The material and the culling flag * @group set * @shortname set back face culling */ setBackFaceCulling(inputs: Inputs.BabylonMaterial.BackFaceCullingDto): void; /** * Gives a material an image texture that replaces its base color across the surface, as * `texture.createSimple` makes one. * @param inputs - The material and the texture * @group set * @shortname set base texture * @example * ```typescript * const texture = bitbybit.babylon.texture.createSimple({ name: "wood", url: "https://example.com/wood.jpg", invertY: false, invertZ: false, wAng: 0, uScale: 1, vScale: 1, uOffset: 0, vOffset: 0, samplingMode: Bit.Inputs.BabylonTexture.samplingModeEnum.trilinear }); * bitbybit.babylon.material.pbrMetallicRoughness.setBaseTexture({ material, baseTexture: texture }); * ``` */ setBaseTexture(inputs: Inputs.BabylonMaterial.BaseTextureDto): void; /** * Reads the base color of a material as a hex string. * @param inputs - The material * @returns The base color as a hex string * @group get * @shortname get base color */ getBaseColor(inputs: Inputs.BabylonMaterial.MaterialPropDto): string; /** * Reads how metallic a material is, from 0 to 1. * @param inputs - The material * @returns The metallic value * @group get * @shortname get metallic */ getMetallic(inputs: Inputs.BabylonMaterial.MaterialPropDto): number; /** * Reads how rough a material's surface is, from 0 to 1. * @param inputs - The material * @returns The roughness value * @group get * @shortname get roughness */ getRoughness(inputs: Inputs.BabylonMaterial.MaterialPropDto): number; /** * Reads the opacity of a material, from 0 to 1. * @param inputs - The material * @returns The opacity * @group get * @shortname get alpha */ getAlpha(inputs: Inputs.BabylonMaterial.MaterialPropDto): number; /** * Reads whether a material skips the back of each face when drawing. * @param inputs - The material * @returns True when back faces are culled * @group get * @shortname get back face culling */ getBackFaceCulling(inputs: Inputs.BabylonMaterial.MaterialPropDto): boolean; /** * Reads the image texture a material uses in place of its base color, if it has one. * @param inputs - The material * @returns The base texture * @group get * @shortname get base texture */ getBaseTexture(inputs: Inputs.BabylonMaterial.MaterialPropDto): BABYLON.BaseTexture; }