import type { IAnimatable } from "@babylonjs/core/Animations/animatable.interface"; import type { AbstractEngine } from "@babylonjs/core/Engines/abstractEngine"; import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines"; import { MaterialPluginBase } from "@babylonjs/core/Materials/materialPluginBase"; import type { ShaderLanguage } from "@babylonjs/core/Materials/shaderLanguage"; import type { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial"; import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture"; import type { Texture } from "@babylonjs/core/Materials/Textures/texture"; import type { UniformBuffer } from "@babylonjs/core/Materials/uniformBuffer"; import { Color4 } from "@babylonjs/core/Maths/math.color"; import type { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh"; import type { Mesh } from "@babylonjs/core/Meshes/mesh"; import type { SubMesh } from "@babylonjs/core/Meshes/subMesh"; import type { Scene } from "@babylonjs/core/scene"; import type { Nullable } from "@babylonjs/core/types"; /** * @internal */ export interface IMmdPluginMaterial { sphereTexture: Nullable; sphereTextureBlendMode: MmdPluginMaterialSphereTextureBlendMode; toonTexture: Nullable; ignoreDiffuseWhenToonTextureIsNull: boolean; applyAmbientColorToDiffuse: boolean; clampAlpha: boolean; textureMultiplicativeColor: Color4; textureAdditiveColor: Color4; sphereTextureMultiplicativeColor: Color4; sphereTextureAdditiveColor: Color4; toonTextureMultiplicativeColor: Color4; toonTextureAdditiveColor: Color4; useTextureColor: boolean; useSphereTextureColor: boolean; useToonTextureColor: boolean; } /** * for convert MMD material to Babylon material * * use StandardMaterial as base class * * propertiy mapping: * * - diffuse[0..2]: diffuseColor * - specular: specularColor * - ambient: ambientColor * - diffuse[3](opaque): alpha * - shininess(reflect): specularPower * - isDoubleSided: backFaceCulling * - enabledToonEdge: (custom implementation) * - edgeColor: (custom implementation) * - edgeSize: (custom implementation) * - texture: diffuseTexture * - sphereTexture: (custom implementation) * - toonTexture: (custom implementation) * * using options: * * useAlphaFromDiffuseTexture * * additinal implementation: * * spherical deformation */ export declare class MmdPluginMaterialDefines extends MaterialDefines { SPHERE_TEXTURE: boolean; SPHERE_TEXTURE_BLEND_MODE_MULTIPLY: boolean; SPHERE_TEXTURE_BLEND_MODE_ADD: boolean; TOON_TEXTURE: boolean; IGNORE_DIFFUSE_WHEN_TOON_TEXTURE_DISABLED: boolean; APPLY_AMBIENT_COLOR_TO_DIFFUSE: boolean; CLAMP_ALPHA: boolean; TEXTURE_COLOR: boolean; SPHERE_TEXTURE_COLOR: boolean; TOON_TEXTURE_COLOR: boolean; SDEF: boolean; } export declare enum MmdPluginMaterialSphereTextureBlendMode { Multiply = 1, Add = 2, SubTexture = 3 } export declare abstract class MmdPluginMaterial extends MaterialPluginBase { private _sphereTexture; private _sphereTextureBlendMode; private _toonTexture; private _ignoreDiffuseWhenToonTextureIsNull; textureMultiplicativeColor: Color4; textureAdditiveColor: Color4; sphereTextureMultiplicativeColor: Color4; sphereTextureAdditiveColor: Color4; toonTextureMultiplicativeColor: Color4; toonTextureAdditiveColor: Color4; private _applyAmbientColorToDiffuse; private _clampAlpha; private _useTextureColor; private _useSphereTextureColor; private _useToonTextureColor; private _isEnabled; get isEnabled(): boolean; set isEnabled(value: boolean); get sphereTexture(): Nullable; set sphereTexture(value: Nullable); get sphereTextureBlendMode(): MmdPluginMaterialSphereTextureBlendMode; set sphereTextureBlendMode(value: MmdPluginMaterialSphereTextureBlendMode); get toonTexture(): Nullable; set toonTexture(value: Nullable); get ignoreDiffuseWhenToonTextureIsNull(): boolean; set ignoreDiffuseWhenToonTextureIsNull(value: boolean); get applyAmbientColorToDiffuse(): boolean; set applyAmbientColorToDiffuse(value: boolean); get clampAlpha(): boolean; set clampAlpha(value: boolean); get useTextureColor(): boolean; set useTextureColor(value: boolean); get useSphereTextureColor(): boolean; set useSphereTextureColor(value: boolean); get useToonTextureColor(): boolean; set useToonTextureColor(value: boolean); private readonly _internalMarkAllSubMeshesAsTexturesDirty; _markAllSubMeshesAsTexturesDirty(): void; /** * Gets a boolean indicating that the plugin is compatible with a given shader language. * @param shaderLanguage The shader language to use. * @returns true if the plugin is compatible with the shader language */ isCompatible(_shaderLanguage: ShaderLanguage): boolean; constructor(material: StandardMaterial, addtoPluginList?: boolean, enable?: boolean, resolveIncludes?: boolean); isReadyForSubMesh(defines: MaterialDefines, scene: Scene): boolean; bindForSubMesh(uniformBuffer: UniformBuffer, scene: Scene, _engine: AbstractEngine, subMesh: SubMesh): void; dispose(forceDisposeTextures?: boolean | undefined): void; abstract getCustomCode(shaderType: string, shaderLanguage?: ShaderLanguage): Nullable<{ [pointName: string]: string; }>; prepareDefines(defines: MmdPluginMaterialDefines, scene: Scene, mesh: Mesh): void; hasTexture(texture: BaseTexture): boolean; getActiveTextures(activeTextures: BaseTexture[]): void; getAnimatables(animatables: IAnimatable[]): void; getSamplers(samplers: string[]): void; getAttributes(attributes: string[], _scene: Scene, mesh: AbstractMesh): void; getUniforms(_shaderLanguage?: ShaderLanguage): { ubo: { name: string; size: number; type: string; }[]; fragment?: string; }; getClassName(): string; }