@kognifai/cogsengine
    Preparing search index...

    Class MaterialComponent

    Exposes material properties for legacy entities and code. The values used in the material components will automatically be applied to the material instance(s) on the MeshRenderComponent from the same entity. If no instances are found, a new or shared material will be created.

    Hierarchy (View Summary)

    Index

    Constructors

    • Internal: Component constructor

      Parameters

      • type: string

        type of the component. Ex. "TransformComponent"

      • entity: Entity

        Owning entity. Entity only passed when wrapping existing entity.

      Returns MaterialComponent

    Properties

    ambientColor: vec4
    backdrop: boolean

    If true the MaterialFlags::Backdrop on the material instance.

    blendMode: BlendMode
    cullMode: CullMode
    depthBiasClamp: number
    depthBiasConstant: number
    depthBiasEnable: boolean
    depthBiasSlope: number
    depthTestAlwaysPass: boolean
    depthTestEnabled: boolean
    depthWriteEnabled: boolean
    diffuseAddressMode: AddressMode
    diffuseColor: vec4
    diffuseFilterMode: FilterMode
    diffuseMap: TextureResource
    diffuseMapScale: vec2
    drawOrder: number

    Manages draw order, maps to MaterialOptions::drawOrder.

    emissiveColor: vec4
    enableAlphaOverride: boolean
    enableColorOverride: boolean
    enableLighting: boolean
    enableOverride: boolean
    enableTextureOverride: boolean
    instancedLine: boolean

    Lines rendered with instancing.

    isTyped: boolean

    Internal flag set if component is a Cogs Core component.

    lineWidth: number
    material: Entity

    Master material entity. When set, all material properties of this instance will be overridden by the values of a MaterialComponent on the master material entity.

    normalMap: TextureResource
    normalMapFactor: number
    normalMapScale: vec2
    pointSize: number
    primitiveType: PrimitiveType
    shadowReceiver: boolean

    If false, object never gets shadowed.

    specularColor: vec4
    specularMap: TextureResource
    specularMapScale: vec2
    specularPower: number
    stippleFactor: number
    stipplePattern: number
    transparency: number
    vertexColor: boolean

    Accessors

    • get entity(): Entity

      Gets the optional owning entity

      Returns Entity

    • set entity(entity: Entity): void

      Internal: set owning entity.

      Parameters

      Returns void

    • get name(): string

      Component name == type. For compatibility

      Returns string

    • get type(): string

      Gets the type of the component. Ex. "TransformComponent", "SceneComponent" etc.

      Returns string

    Methods

    • Internal: Creates a new component of the given type (name). Component is wrapped when adding to an entity.

      Parameters

      • type: string

        Type of the component. Ex. "TransformComponent"

      Returns Component

      Created Cogs.js component.

    • Internal: Creates a new component being wrapped as an existing member of the entity

      Parameters

      • type: string

        Type of the component. Ex. "TransformComponent"

      • entity: Entity

        The owning entity

      Returns Component

      Created Cogs.js component.