.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead. .. _class_Material: Material ======== **Inherits:** :ref:`Resource` **<** :ref:`Reference` **<** :ref:`Object` **Inherited By:** :ref:`ShaderMaterial`, :ref:`FixedMaterial` **Category:** Core Brief Description ----------------- Abstract base :ref:`Resource` for coloring and shading geometry. Member Functions ---------------- +----------------------------+-------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_blend_mode` **(** **)** const | +----------------------------+-------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_depth_draw_mode` **(** **)** const | +----------------------------+-------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`get_flag` **(** :ref:`int` flag **)** const | +----------------------------+-------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_line_width` **(** **)** const | +----------------------------+-------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_blend_mode` **(** :ref:`int` mode **)** | +----------------------------+-------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_depth_draw_mode` **(** :ref:`int` mode **)** | +----------------------------+-------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_flag` **(** :ref:`int` flag, :ref:`bool` enable **)** | +----------------------------+-------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_line_width` **(** :ref:`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 :ref:`Resource` used for coloring and shading geometry. All materials inherit from it and almost all :ref:`VisualInstance` derived nodes carry a Material. A few flags and parameters are shared between all material types and are configured here. Member Function Description --------------------------- .. _class_Material_get_blend_mode: - :ref:`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 :ref:`VisualServer` implementations. .. _class_Material_get_depth_draw_mode: - :ref:`int` **get_depth_draw_mode** **(** **)** const .. _class_Material_get_flag: - :ref:`bool` **get_flag** **(** :ref:`int` flag **)** const Return a :ref:`Material` flag, which toggles on or off a behavior when rendering. See enumeration FLAG\_\* for a list. .. _class_Material_get_line_width: - :ref:`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). .. _class_Material_set_blend_mode: - void **set_blend_mode** **(** :ref:`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 :ref:`VisualServer` implementations. .. _class_Material_set_depth_draw_mode: - void **set_depth_draw_mode** **(** :ref:`int` mode **)** .. _class_Material_set_flag: - void **set_flag** **(** :ref:`int` flag, :ref:`bool` enable **)** Set a :ref:`Material` flag, which toggles on or off a behavior when rendering. See enumeration FLAG\_\* for a list. .. _class_Material_set_line_width: - void **set_line_width** **(** :ref:`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).