UNPKG

@dcl/ecs

Version:
43 lines (42 loc) 1.65 kB
import { LastWriteWinElementSetComponentDefinition, Entity, IEngine } from '../../engine'; import { PBMaterial, PBMaterial_PbrMaterial, PBMaterial_UnlitMaterial } from '../generated/index.gen'; import { AvatarTexture, Texture, TextureUnion, VideoTexture } from '../generated/types.gen'; /** * @public */ export interface TextureHelper { /** * @returns a common texture with a source file */ Common: (texture: Texture) => TextureUnion; /** * @returns the avatar texture of userId specified */ Avatar: (avatarTexture: AvatarTexture) => TextureUnion; /** * @returns the video texture of videoPlayerEntity specified */ Video: (videoTexture: VideoTexture) => TextureUnion; } /** * @public */ export interface MaterialComponentDefinitionExtended extends LastWriteWinElementSetComponentDefinition<PBMaterial> { /** * Texture helpers with constructor */ Texture: TextureHelper; /** * Create or replace the component Material in the entity specified * @param entity - the entity to link the component * @param material - the Unlit data for this material */ setBasicMaterial: (entity: Entity, material: PBMaterial_UnlitMaterial) => void; /** * Create or replace the component Material in the entity specified * @param entity - the entity to link the component * @param material - the PBR data for this material */ setPbrMaterial: (entity: Entity, material: PBMaterial_PbrMaterial) => void; } export declare function defineMaterialComponent(engine: Pick<IEngine, 'defineComponentFromSchema'>): MaterialComponentDefinitionExtended;