Non éclairéMatériel
Description
Ce composant crée un matériau qui n'est pas affecté par l'éclairage ou les ombres sur une entité avec géométrie.
Propriétés
Propriété | Type | Défaut | Description |
---|---|---|---|
r | number | 0 | Red channel value of the material. A value between 0 and 255. |
g | number | 0 | Green channel value of the material. A value between 0 and 255. |
b | number | 0 | Blue channel value of the material. A value between 0 and 255. |
textureSrc | string | '' | The color map source, modulated by color (if set) |
opacity | number | 1 | Overall alpha/transparency of the material. A value between 0 and 1. |
side | string | 'front' | Which sides of faces will be rendered. Allowed values: 'front' , 'back' , or 'double' . |
opacityMap | string | '' | Alpha/transparency mapped via a texture resource |
blending | string | 'normal' | Blending to use when displaying objects with this material. Allowed values: 'no' , 'normal' , 'additive' , 'subtractive' , 'multiply' . |
repeatX | number | 1 | How many times a texture is repeated across a material on the X axis |
repeatY | number | 1 | How many times a texture is repeated across a material on the Y axis |
offsetX | number | 0 | How much a texture is offset across a material on the X axis |
offsetY | number | 0 | How much a texture is offset across a material on the Y axis |
wrap | string | 'repeat' | Wrapping mode for textures. Allowed values: 'clamp' , 'repeat' , 'mirroredRepeat' . |
depthTest | boolean | true | Whether to test depth when rendering this material |
depthWrite | boolean | true | Whether rendering this material impacts the depth buffer |
wireframe | boolean | false | Render geometry as wireframe |
forceTransparent | boolean | false | Whether to force the alpha channel to render as transparent |
textureFiltering | string | 'smooth' | Texture filtering mode. Allowed values: 'smooth' , 'sharp' . |
mipmaps | boolean | true | Whether to generate mipmaps for textures |
Fonctions
Get
Returns a read-only reference.
Example
ecs.UnlitMaterial.get(world, component.eid)
Set
Ensures the component exists on the entity, then assigns the (optional) data to the component.
Example
ecs.UnlitMaterial.set(world, component.eid, {
color: '#FFFFFF',
opacity: 1,
side: 'double'
})
Mutate
Perform an update to the component within a callback function. Return true
to indicate no changes made.
Example
ecs.UnlitMaterial.mutate(world, component.eid, (cursor) => {
cursor.opacity = 0.5;
cursor.color = '#808080';
return false;
})
Remove
Removes the component from the entity.
Example
ecs.UnlitMaterial.remove(world, component.eid)
Has
Returns true
if the component is present on the entity.
Example
ecs.UnlitMaterial.has(world, component.eid)
Reset
Adds, or resets the component to its default state.
Example
ecs.UnlitMaterial.reset(world, component.eid)
Advanced Functions
Cursor
Returns a mutable reference. Cursors are reused so only one cursor for each component can exist at a time.
Example
ecs.UnlitMaterial.cursor(world, component.eid)
Acquire
Same behavior as cursor, but commit must be called after the cursor is done being used.
Example
ecs.UnlitMaterial.acquire(world, component.eid)
Commit
Called after acquire. An optional third argument determines whether the cursor was mutated or not.
Example
ecs.UnlitMaterial.commit(world, component.eid)
ecs.UnlitMaterial.commit(world, component.eid, false)
Dirty
Mark the entity as having been mutated. Only needed in a specific case where systems are mutating data.
Example
ecs.UnlitMaterial.dirty(world, component.eid)