import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial"; import type { Texture } from "@babylonjs/core/Materials/Textures/texture"; import { Color4 } from "@babylonjs/core/Maths/math.color"; import { Color3 } from "@babylonjs/core/Maths/math.color"; import type { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh"; import type { SubMesh } from "@babylonjs/core/Meshes/subMesh"; import type { Scene } from "@babylonjs/core/scene"; import type { Nullable } from "@babylonjs/core/types"; import { MmdPluginMaterialSphereTextureBlendMode } from "./mmdPluginMaterial"; /** * MMD standard material * * This material is an extension of the `StandardMaterial` and includes features for mmd's shading specifications * * The user can decide whether to activate each mmd shading specification * * If you disable all features, it behaves the same as `StandardMaterial` */ export declare class MmdStandardMaterial extends StandardMaterial { private _pluginMaterial; private _renderOutline; /** * Outline width (default: 0.01) */ outlineWidth: number; /** * Outline color (default: (0, 0, 0)) */ outlineColor: Color3; /** * Outline alpha (default: 1.0) */ outlineAlpha: number; private _disposed; /** * Create a new MMD standard material * @param name Define the name of the material in the scene * @param scene The scene the material belongs to * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false */ constructor(name: string, scene?: Scene, forceGLSL?: boolean); private _initPluginShaderSourceAsync; /** * Disposes the material * @param forceDisposeEffect specifies if effects should be forcefully disposed * @param forceDisposeTextures specifies if textures should be forcefully disposed */ dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void; /** * Get if the submesh is ready to be used and all its information available. * Child classes can use it to update shaders * @param mesh defines the mesh to check * @param subMesh defines which submesh to check * @param useInstances specifies that instances should be used * @returns a boolean indicating that the submesh is ready or not */ isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean; /** * Get or set sphere texture */ get sphereTexture(): Nullable; set sphereTexture(value: Nullable); /** * Get or set sphere texture blend mode (default: MmdPluginMaterialSphereTextureBlendMode.Add) */ get sphereTextureBlendMode(): MmdPluginMaterialSphereTextureBlendMode; set sphereTextureBlendMode(value: MmdPluginMaterialSphereTextureBlendMode); /** * Get or set toon texture */ get toonTexture(): Nullable; set toonTexture(value: Nullable); /** * If toe on texture is not set, decide whether to treat it as if it had white toon texture applied (default: true) * * In general, in order to get a stylized rendering, it's better to do true * * and if you want a more realistic rendering, it's better to do false */ get ignoreDiffuseWhenToonTextureIsNull(): boolean; set ignoreDiffuseWhenToonTextureIsNull(value: boolean); /** * Get or set whether to apply ambient color to diffuse color (default: true) * * In babylon.js, the ambient color is not affected by the light source, but in mmd, it is * * Therefore, if you want to get a more mmd-like rendering, it is better to do true */ get applyAmbientColorToDiffuse(): boolean; set applyAmbientColorToDiffuse(value: boolean); /** * Get or set whether to apply clamp `Material.alpha` to 0.0 .. 1.0 (default: false) * * Babylon.js does not clamp the alpha value */ get clampAlpha(): boolean; set clampAlpha(value: boolean); /** * Get or set whether to use the texture multiplicative color (default: (1, 1, 1, 1)) * * If this property is first accessed as set, the shader is recompiled to support texture color properties * * After that, the feature is no longer turned off to prevent shader recompilation * * These features are subject to change at a later date */ get textureMultiplicativeColor(): Color4; set textureMultiplicativeColor(value: Color4); /** * Get or set whether to use the texture additive color (default: (0, 0, 0, 0)) * * If this property is first accessed as set, the shader is recompiled to support texture color properties * * After that, the feature is no longer turned off to prevent shader recompilation * * These features are subject to change at a later date */ get textureAdditiveColor(): Color4; set textureAdditiveColor(value: Color4); /** * Get or set whether to use the sphere texture multiplicative color (default: (1, 1, 1, 1)) * * If this property is first accessed as set, the shader is recompiled to support texture color properties * * After that, the feature is no longer turned off to prevent shader recompilation * * These features are subject to change at a later date */ get sphereTextureMultiplicativeColor(): Color4; set sphereTextureMultiplicativeColor(value: Color4); /** * Get or set whether to use the sphere texture additive color (default: (0, 0, 0, 0)) * * If this property is first accessed as set, the shader is recompiled to support texture color properties * * After that, the feature is no longer turned off to prevent shader recompilation * * These features are subject to change at a later date */ get sphereTextureAdditiveColor(): Color4; set sphereTextureAdditiveColor(value: Color4); /** * Get or set whether to use the toon texture multiplicative color (default: (1, 1, 1, 1)) * * If this property is first accessed as set, the shader is recompiled to support texture color properties * * After that, the feature is no longer turned off to prevent shader recompilation * * These features are subject to change at a later date */ get toonTextureMultiplicativeColor(): Color4; set toonTextureMultiplicativeColor(value: Color4); /** * Get or set whether to use the toon texture additive color (default: (0, 0, 0, 0)) * * If this property is first accessed as set, the shader is recompiled to support texture color properties * * After that, the feature is no longer turned off to prevent shader recompilation * * These features are subject to change at a later date */ get toonTextureAdditiveColor(): Color4; set toonTextureAdditiveColor(value: Color4); /** * Whether to use the outline rendering (default: false) */ get renderOutline(): boolean; set renderOutline(value: boolean); /** * Specifies if the material will require alpha blending * @returns a boolean specifying if alpha blending is needed */ needAlphaBlending(): boolean; /** * Makes a duplicate of the material, and gives it a new name * @param name defines the new name for the duplicated material * @param cloneTexturesOnlyOnce - if a texture is used in more than one channel (e.g diffuse and opacity), only clone it once and reuse it on the other channels. Default false. * @param rootUrl defines the root URL to use to load textures * @returns the cloned material */ clone(name: string, cloneTexturesOnlyOnce?: boolean, rootUrl?: string): MmdStandardMaterial; /** * Creates a mmd standard material from parsed material data * @param source defines the JSON representation of the material * @param scene defines the hosting scene * @param rootUrl defines the root URL to use to load textures and relative dependencies * @returns a new standard material */ static Parse(source: any, scene: Scene, rootUrl: string): StandardMaterial; }