Class MToon0xMaterialContent

Material content implementation for MToon 0.x shader. This class handles the creation and configuration of MToon materials, which are commonly used for toon-style rendering in VRM models.

Hierarchy (view full)

Constructors

Properties

Accessors

Methods

Constructors

  • Creates a new MToon 0.x material content instance.

    Parameters

    • isOutline: boolean

      Whether this material is for outline rendering

    • materialProperties: undefined | Vrm0xMaterialProperty

      VRM material properties from the glTF file

    • textures: any

      Array of textures used by the material

    • samplers: Sampler[]

      Array of samplers for texture sampling configuration

    • isMorphing: boolean

      Whether morphing (blend shapes) is enabled

    • isSkinning: boolean

      Whether skeletal animation is enabled

    • isLighting: boolean

      Whether lighting calculations are enabled

    • useTangentAttribute: boolean

      Whether to use tangent attributes for normal mapping

    • debugMode: undefined | number

      Debug visualization mode (optional)

    • makeOutputSrgb: boolean

      Whether to convert output to sRGB color space

    • materialName: string

      Name identifier for the material

    • definitions: string[]

      Additional shader preprocessor definitions

    Returns MToon0xMaterialContent

Properties

__definitions: string = ''
__materialName: string
__semantics: ShaderSemanticsInfo[] = []
_tags: RnTags = {}

Collection of tags associated with this object

shaderType: EnumIO = ShaderType.VertexAndPixelShader
Aspect: ShaderSemanticsClass = ...
CameraUp: ShaderSemanticsClass = ...
InvalidObjectUID: -1 = -1

Invalid object UID constant

_AmbientColor: ShaderSemanticsClass = ...
_BumpScale: ShaderSemanticsClass = ...
_Color: ShaderSemanticsClass = ...
_Cutoff: ShaderSemanticsClass = ...
_EmissionColor: ShaderSemanticsClass = ...
_IndirectLightIntensity: ShaderSemanticsClass = ...
_LightColorAttenuation: ShaderSemanticsClass = ...
_OutlineColor: ShaderSemanticsClass = ...
_OutlineLightingMix: ShaderSemanticsClass = ...
_OutlineScaledMaxDistance: ShaderSemanticsClass = ...
_OutlineWidth: ShaderSemanticsClass = ...
_OutlineWidthTexture: ShaderSemanticsClass = ...
_ReceiveShadowRate: ShaderSemanticsClass = ...
_RimColor: ShaderSemanticsClass = ...
_RimFresnelPower: ShaderSemanticsClass = ...
_RimLift: ShaderSemanticsClass = ...
_RimLightingMix: ShaderSemanticsClass = ...
_ShadeColor: ShaderSemanticsClass = ...
_ShadeShift: ShaderSemanticsClass = ...
_ShadeToony: ShaderSemanticsClass = ...
_ShadingGradeRate: ShaderSemanticsClass = ...
__gl?: WebGLRenderingContext
__tmp_vector2: MutableVector2 = ...
__tmp_vector4: MutableVector4 = ...
_emissionTexture: ShaderSemanticsClass = ...
_litColorTexture: ShaderSemanticsClass = ...
_matCapTexture: ShaderSemanticsClass = ...
_normalTexture: ShaderSemanticsClass = ...
_receiveShadowTexture: ShaderSemanticsClass = ...
_rimTexture: ShaderSemanticsClass = ...
_shadeColorTexture: ShaderSemanticsClass = ...
_shadingGradeTexture: ShaderSemanticsClass = ...
currentMaxObjectCount: number = 0

Current maximum object count for UID generation

materialNodes: AbstractMaterialContent[] = []
usableBlendEquationModeAlpha?: number

Accessors

  • get objectUID(): number
  • Gets the unique object identifier

    Returns number

    The object's UID

  • get pixelShaderityObject(): undefined | ShaderityObject
  • Gets the pixel shader object associated with this material.

    Returns undefined | ShaderityObject

    The pixel shader object or undefined if not set

  • get uniqueName(): string
  • Gets the unique name of this object

    Returns string

    The unique name string

  • get vertexShaderityObject(): undefined | ShaderityObject
  • Gets the vertex shader object associated with this material.

    Returns undefined | ShaderityObject

    The vertex shader object or undefined if not set

Methods

  • Performs shader reflection to extract semantics information from vertex and pixel shaders.

    Parameters

    • vertexShader: ShaderityObject

      The vertex shader object for WebGL

    • pixelShader: ShaderityObject

      The pixel shader object for WebGL

    • vertexShaderWebGpu: ShaderityObject

      The vertex shader object for WebGPU

    • pixelShaderWebGpu: ShaderityObject

      The pixel shader object for WebGPU

    • definitions: string[]

      Array of shader definitions

    Returns ShaderSemanticsInfo[]

    Array of shader semantics information

  • Checks whether this object has a tag with the specified name

    Parameters

    • tagName: string

      The name of the tag to check for

    Returns boolean

    True if the tag exists (value is not null/undefined), false otherwise

  • Checks if this object has a tag with the specified name and value

    Parameters

    • tagName: string

      The tag name to match

    • tagValue: string

      The tag value to match

    Returns boolean

    True if the object has a matching tag, false otherwise

  • Checks if this object has all the specified tags with exactly matching values

    Parameters

    • tags: RnTags

      Object containing tag names as keys and expected values

    Returns boolean

    True if all specified tags exist with matching values, false otherwise

  • Checks if the object's combined tag string contains all the provided search strings. This allows for flexible searching within tag names and values.

    Parameters

    • stringArray: string[]

      Array of strings that must all be present in the combined tag string

    Returns boolean

    True if all strings are found in the combined tag string, false otherwise

  • Configures material parameters based on MToon properties. This method sets up blending modes, culling, and other rendering states based on the material's MToon properties.

    Parameters

    • material: Material

      The material instance to configure

    • isOutline: boolean

      Whether this is an outline material

    Returns void

  • Attempts to set a tag on this object. If the tag already exists, it will be replaced.

    Parameters

    • tag: Tag

      The tag object containing the name and value to set

    Returns boolean

    True if the tag was successfully set, false if the tag name contains invalid characters

  • Attempts to set a unique name for this object

    Parameters

    • name: string

      The desired unique name

    • toAddNameIfConflict: boolean

      If true, appends UID to make name unique when conflicts occur; if false, fails on conflict

    Returns boolean

    True if the name was successfully set, false if there was a conflict and toAddNameIfConflict was false

  • Validates that a tag string contains only allowed characters (alphanumeric and underscore)

    Parameters

    • val: string

      The string to validate

    Returns boolean

    True if the string contains only valid characters, false if it contains invalid characters

  • Searches for the first object that has a specific tag with the given value

    Parameters

    • tag: string

      The tag name to search for

    • value: string

      The tag value to match

    Returns undefined | WeakRef<RnObject>

    WeakRef to the first matching object, or undefined if not found

  • Converts Unity blend mode enum values to corresponding WebGL blend constants. This method maps Unity's blend mode enumeration to the appropriate WebGL blend function constants for proper alpha blending.

    Parameters

    • enumNumber: number

      Unity blend mode enum value

    Returns number

    Corresponding WebGL blend constant