Material
Inherits: Resource < Reference < Object
Inherited By: ShaderMaterial, FixedMaterial
Category: Core
Brief Description
Abstract base Resource for coloring and shading geometry.
Member Functions
int | get_blend_mode ( ) const |
int | get_depth_draw_mode ( ) const |
bool | get_flag ( int flag ) const |
float | get_line_width ( ) const |
void | set_blend_mode ( int mode ) |
void | set_depth_draw_mode ( int mode ) |
void | set_flag ( int flag, bool enable ) |
void | set_line_width ( float width ) |
Numeric Constants
- FLAG_VISIBLE = 0 — Geometry is visible when this flag is enabled (default).
- FLAG_DOUBLE_SIDED = 1 — Both front facing and back facing triangles are rendered when this flag is enabled.
- FLAG_INVERT_FACES = 2 — Front facing and back facing order is swapped when this flag is enabled.
- FLAG_UNSHADED = 3 — Shading (lighting) is disabled when this flag is enabled.
- FLAG_ONTOP = 4
- FLAG_LIGHTMAP_ON_UV2 = 5
- FLAG_COLOR_ARRAY_SRGB = 6
- FLAG_MAX = 7 — Maximum amount of flags.
- DEPTH_DRAW_ALWAYS = 0
- DEPTH_DRAW_OPAQUE_ONLY = 1
- DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA = 2
- DEPTH_DRAW_NEVER = 3
- BLEND_MODE_MIX = 0 — Use the regular alpha blending equation (source and dest colors are faded) (default).
- BLEND_MODE_ADD = 1 — Use additive blending equation, often used for particle effects such as fire or light decals.
- BLEND_MODE_SUB = 2 — Use subtractive blending equation, often used for some smoke effects or types of glass.
- BLEND_MODE_MUL = 3
- BLEND_MODE_PREMULT_ALPHA = 4
Description
Material is a base Resource used for coloring and shading geometry. All materials inherit from it and almost all VisualInstance derived nodes carry a Material. A few flags and parameters are shared between all material types and are configured here.
Member Function Description
int get_blend_mode ( ) const
Return blend mode for the material, which can be one of BLEND_MODE_MIX (default), BLEND_MODE_ADD, BLEND_MODE_SUB. Keep in mind that only BLEND_MODE_MIX ensures that the material may be opaque, any other blend mode will render with alpha blending enabled in raster-based VisualServer implementations.
int get_depth_draw_mode ( ) const
bool get_flag ( int flag ) const
Return a Material flag, which toggles on or off a behavior when rendering. See enumeration FLAG_* for a list.
float get_line_width ( ) const
Return the line width for geometry drawn with FLAG_WIREFRAME enabled, or LINE primitives. Note that not all hardware or VisualServer backends support this (like DirectX).
void set_blend_mode ( int mode )
Set blend mode for the material, which can be one of BLEND_MODE_MIX (default), BLEND_MODE_ADD, BLEND_MODE_SUB. Keep in mind that only BLEND_MODE_MIX ensures that the material may be opaque, any other blend mode will render with alpha blending enabled in raster-based VisualServer implementations.
void set_depth_draw_mode ( int mode )
void set_flag ( int flag, bool enable )
Set a Material flag, which toggles on or off a behavior when rendering. See enumeration FLAG_* for a list.
void set_line_width ( float width )
Set the line width for geometry drawn with FLAG_WIREFRAME enabled, or LINE primitives. Note that not all hardware or VisualServer backends support this (like DirectX).
© 2014–2020 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
https://docs.godotengine.org/en/2.1/classes/class_material.html