add ORMSpatialMaterial
This commit is contained in:
parent
cc4492f9b9
commit
b9cbffd957
|
@ -128,15 +128,15 @@
|
|||
</member>
|
||||
<member name="color" type="Color" setter="set_color" getter="get_color" default="Color( 1, 1, 1, 1 )">
|
||||
Each particle's initial color.
|
||||
[b]Note:[/b] [member color] multiplies the particle mesh's vertex colors. To have a visible effect on a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color] will have no visible effect.
|
||||
[b]Note:[/b] [member color] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color] will have no visible effect.
|
||||
</member>
|
||||
<member name="color_initial_ramp" type="Gradient" setter="set_color_initial_ramp" getter="get_color_initial_ramp">
|
||||
Each particle's initial color will vary along this [GradientTexture] (multiplied with [member color]).
|
||||
[b]Note:[/b] [member color_initial_ramp] multiplies the particle mesh's vertex colors. To have a visible effect on a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color_initial_ramp] will have no visible effect.
|
||||
[b]Note:[/b] [member color_initial_ramp] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color_initial_ramp] will have no visible effect.
|
||||
</member>
|
||||
<member name="color_ramp" type="Gradient" setter="set_color_ramp" getter="get_color_ramp">
|
||||
Each particle's color will vary along this [GradientTexture] over its lifetime (multiplied with [member color]).
|
||||
[b]Note:[/b] [member color_ramp] multiplies the particle mesh's vertex colors. To have a visible effect on a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color_ramp] will have no visible effect.
|
||||
[b]Note:[/b] [member color_ramp] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color_ramp] will have no visible effect.
|
||||
</member>
|
||||
<member name="damping" type="float" setter="set_param" getter="get_param" default="0.0">
|
||||
The rate at which particles lose velocity.
|
||||
|
@ -158,7 +158,7 @@
|
|||
</member>
|
||||
<member name="emission_colors" type="PoolColorArray" setter="set_emission_colors" getter="get_emission_colors">
|
||||
Sets the [Color]s to modulate particles by when using [constant EMISSION_SHAPE_POINTS] or [constant EMISSION_SHAPE_DIRECTED_POINTS].
|
||||
[b]Note:[/b] [member emission_colors] multiplies the particle mesh's vertex colors. To have a visible effect on a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member emission_colors] will have no visible effect.
|
||||
[b]Note:[/b] [member emission_colors] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member emission_colors] will have no visible effect.
|
||||
</member>
|
||||
<member name="emission_normals" type="PoolVector3Array" setter="set_emission_normals" getter="get_emission_normals">
|
||||
Sets the direction the particles will be emitted in when using [constant EMISSION_SHAPE_DIRECTED_POINTS].
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<method name="add_material">
|
||||
<return type="void" />
|
||||
<argument index="0" name="name" type="String" />
|
||||
<argument index="1" name="material" type="SpatialMaterial" />
|
||||
<argument index="1" name="material" type="Material3D" />
|
||||
<description>
|
||||
Adds a new material to the internal material list for the plugin. It can then be accessed with [method get_material]. Should not be overridden.
|
||||
</description>
|
||||
|
@ -90,7 +90,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_material">
|
||||
<return type="SpatialMaterial" />
|
||||
<return type="Material3D" />
|
||||
<argument index="0" name="name" type="String" />
|
||||
<argument index="1" name="gizmo" type="EditorSpatialGizmo" default="null" />
|
||||
<description>
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
<member name="autowrap" type="bool" setter="set_autowrap" getter="get_autowrap" default="false">
|
||||
If [code]true[/code], wraps the text to the [member width].
|
||||
</member>
|
||||
<member name="billboard" type="int" setter="set_billboard_mode" getter="get_billboard_mode" enum="SpatialMaterial.BillboardMode" default="0">
|
||||
The billboard mode to use for the label. See [enum SpatialMaterial.BillboardMode] for possible values.
|
||||
<member name="billboard" type="int" setter="set_billboard_mode" getter="get_billboard_mode" enum="Material3D.BillboardMode" default="0">
|
||||
The billboard mode to use for the label. See [enum Material3D.BillboardMode] for possible values.
|
||||
</member>
|
||||
<member name="double_sided" type="bool" setter="set_draw_flag" getter="get_draw_flag" default="true">
|
||||
If [code]true[/code], text can be seen from the back as well, if [code]false[/code], it is invisible when looking at it from behind.
|
||||
|
|
|
@ -0,0 +1,668 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="Material3D" inherits="Material" version="3.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
||||
<brief_description>
|
||||
</brief_description>
|
||||
<description>
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="get_feature" qualifiers="const">
|
||||
<return type="bool" />
|
||||
<argument index="0" name="feature" type="int" enum="Material3D.Feature" />
|
||||
<description>
|
||||
Returns [code]true[/code], if the specified [enum Feature] is enabled.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_flag" qualifiers="const">
|
||||
<return type="bool" />
|
||||
<argument index="0" name="flag" type="int" enum="Material3D.Flags" />
|
||||
<description>
|
||||
Returns [code]true[/code], if the specified flag is enabled. See [enum Flags] enumerator for options.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_texture" qualifiers="const">
|
||||
<return type="Texture" />
|
||||
<argument index="0" name="param" type="int" enum="Material3D.TextureParam" />
|
||||
<description>
|
||||
Returns the [Texture] associated with the specified [enum TextureParam].
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_feature">
|
||||
<return type="void" />
|
||||
<argument index="0" name="feature" type="int" enum="Material3D.Feature" />
|
||||
<argument index="1" name="enable" type="bool" />
|
||||
<description>
|
||||
If [code]true[/code], enables the specified [enum Feature]. Many features that are available in [SpatialMaterial]s need to be enabled before use. This way the cost for using the feature is only incurred when specified. Features can also be enabled by setting the corresponding member to [code]true[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_flag">
|
||||
<return type="void" />
|
||||
<argument index="0" name="flag" type="int" enum="Material3D.Flags" />
|
||||
<argument index="1" name="enable" type="bool" />
|
||||
<description>
|
||||
If [code]true[/code], enables the specified flag. Flags are optional behavior that can be turned on and off. Only one flag can be enabled at a time with this function, the flag enumerators cannot be bit-masked together to enable or disable multiple flags at once. Flags can also be enabled by setting the corresponding member to [code]true[/code]. See [enum Flags] enumerator for options.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_texture">
|
||||
<return type="void" />
|
||||
<argument index="0" name="param" type="int" enum="Material3D.TextureParam" />
|
||||
<argument index="1" name="texture" type="Texture" />
|
||||
<description>
|
||||
Sets the [Texture] to be used by the specified [enum TextureParam]. This function is called when setting members ending in [code]*_texture[/code].
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="albedo_color" type="Color" setter="set_albedo" getter="get_albedo" default="Color( 1, 1, 1, 1 )">
|
||||
The material's base color.
|
||||
</member>
|
||||
<member name="albedo_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture to multiply by [member albedo_color]. Used for basic texturing of objects.
|
||||
</member>
|
||||
<member name="anisotropy" type="float" setter="set_anisotropy" getter="get_anisotropy">
|
||||
The strength of the anisotropy effect. This is multiplied by [member anisotropy_flowmap]'s alpha channel if a texture is defined there and the texture contains an alpha channel.
|
||||
</member>
|
||||
<member name="anisotropy_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], anisotropy is enabled. Anisotropy changes the shape of the specular blob and aligns it to tangent space. This is useful for brushed aluminium and hair reflections.
|
||||
[b]Note:[/b] Mesh tangents are needed for anisotropy to work. If the mesh does not contain tangents, the anisotropy effect will appear broken.
|
||||
[b]Note:[/b] Material anisotropy should not to be confused with anisotropic texture filtering. Anisotropic texture filtering can be enabled by selecting a texture in the FileSystem dock, going to the Import dock, checking the [b]Anisotropic[/b] checkbox then clicking [b]Reimport[/b]. The anisotropic filtering level can be changed by adjusting [member ProjectSettings.rendering/quality/filters/anisotropic_filter_level].
|
||||
</member>
|
||||
<member name="anisotropy_flowmap" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture that offsets the tangent map for anisotropy calculations and optionally controls the anisotropy effect (if an alpha channel is present). The flowmap texture is expected to be a derivative map, with the red channel representing distortion on the X axis and green channel representing distortion on the Y axis. Values below 0.5 will result in negative distortion, whereas values above 0.5 will result in positive distortion.
|
||||
If present, the texture's alpha channel will be used to multiply the strength of the [member anisotropy] effect. Fully opaque pixels will keep the anisotropy effect's original strength while fully transparent pixels will disable the anisotropy effect entirely. The flowmap texture's blue channel is ignored.
|
||||
</member>
|
||||
<member name="ao_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], ambient occlusion is enabled. Ambient occlusion darkens areas based on the [member ao_texture].
|
||||
</member>
|
||||
<member name="ao_light_affect" type="float" setter="set_ao_light_affect" getter="get_ao_light_affect">
|
||||
Amount that ambient occlusion affects lighting from lights. If [code]0[/code], ambient occlusion only affects ambient light. If [code]1[/code], ambient occlusion affects lights just as much as it affects ambient light. This can be used to impact the strength of the ambient occlusion effect, but typically looks unrealistic.
|
||||
</member>
|
||||
<member name="ao_on_uv2" type="bool" setter="set_flag" getter="get_flag">
|
||||
If [code]true[/code], use [code]UV2[/code] coordinates to look up from the [member ao_texture].
|
||||
</member>
|
||||
<member name="ao_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture that defines the amount of ambient occlusion for a given point on the object.
|
||||
</member>
|
||||
<member name="ao_texture_channel" type="int" setter="set_ao_texture_channel" getter="get_ao_texture_channel" enum="Material3D.TextureChannel">
|
||||
Specifies the channel of the [member ao_texture] in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
|
||||
</member>
|
||||
<member name="async_mode" type="int" setter="set_async_mode" getter="get_async_mode" enum="Material3D.AsyncMode" default="0">
|
||||
If [member ProjectSettings.rendering/gles3/shaders/shader_compilation_mode] is [code]Synchronous[/code] (with or without cache), this determines how this material must behave in regards to asynchronous shader compilation.
|
||||
[constant ASYNC_MODE_VISIBLE] is the default and the best for most cases.
|
||||
</member>
|
||||
<member name="clearcoat" type="float" setter="set_clearcoat" getter="get_clearcoat">
|
||||
Sets the strength of the clearcoat effect. Setting to [code]0[/code] looks the same as disabling the clearcoat effect.
|
||||
</member>
|
||||
<member name="clearcoat_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], clearcoat rendering is enabled. Adds a secondary transparent pass to the lighting calculation resulting in an added specular blob. This makes materials appear as if they have a clear layer on them that can be either glossy or rough.
|
||||
[b]Note:[/b] Clearcoat rendering is not visible if the material has [member flags_unshaded] set to [code]true[/code].
|
||||
</member>
|
||||
<member name="clearcoat_gloss" type="float" setter="set_clearcoat_gloss" getter="get_clearcoat_gloss">
|
||||
Sets the roughness of the clearcoat pass. A higher value results in a smoother clearcoat while a lower value results in a rougher clearcoat.
|
||||
</member>
|
||||
<member name="clearcoat_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture that defines the strength of the clearcoat effect and the glossiness of the clearcoat. Strength is specified in the red channel while glossiness is specified in the green channel.
|
||||
</member>
|
||||
<member name="depth_deep_parallax" type="bool" setter="set_depth_deep_parallax" getter="is_depth_deep_parallax_enabled">
|
||||
If [code]true[/code], the shader will read depth texture at multiple points along the view ray to determine occlusion and parrallax. This can be very performance demanding, but results in more realistic looking depth mapping.
|
||||
</member>
|
||||
<member name="depth_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], depth mapping is enabled (also called "parallax mapping" or "height mapping"). See also [member normal_enabled].
|
||||
[b]Note:[/b] Depth mapping is not supported if triplanar mapping is used on the same material. The value of [member depth_enabled] will be ignored if [member uv1_triplanar] is enabled.
|
||||
</member>
|
||||
<member name="depth_flip_binormal" type="bool" setter="set_depth_deep_parallax_flip_binormal" getter="get_depth_deep_parallax_flip_binormal">
|
||||
If [code]true[/code], direction of the binormal is flipped before using in the depth effect. This may be necessary if you have encoded your binormals in a way that is conflicting with the depth effect.
|
||||
</member>
|
||||
<member name="depth_flip_tangent" type="bool" setter="set_depth_deep_parallax_flip_tangent" getter="get_depth_deep_parallax_flip_tangent">
|
||||
If [code]true[/code], direction of the tangent is flipped before using in the depth effect. This may be necessary if you have encoded your tangents in a way that is conflicting with the depth effect.
|
||||
</member>
|
||||
<member name="depth_max_layers" type="int" setter="set_depth_deep_parallax_max_layers" getter="get_depth_deep_parallax_max_layers">
|
||||
Number of layers to use when using [member depth_deep_parallax] and the view direction is perpendicular to the surface of the object. A higher number will be more performance demanding while a lower number may not look as crisp.
|
||||
</member>
|
||||
<member name="depth_min_layers" type="int" setter="set_depth_deep_parallax_min_layers" getter="get_depth_deep_parallax_min_layers">
|
||||
Number of layers to use when using [member depth_deep_parallax] and the view direction is parallel to the surface of the object. A higher number will be more performance demanding while a lower number may not look as crisp.
|
||||
</member>
|
||||
<member name="depth_scale" type="float" setter="set_depth_scale" getter="get_depth_scale">
|
||||
Scales the depth offset effect. A higher number will create a larger depth.
|
||||
</member>
|
||||
<member name="depth_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture used to determine depth at a given pixel. Depth is always stored in the red channel.
|
||||
</member>
|
||||
<member name="detail_albedo" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture that specifies the color of the detail overlay.
|
||||
</member>
|
||||
<member name="detail_blend_mode" type="int" setter="set_detail_blend_mode" getter="get_detail_blend_mode" enum="Material3D.BlendMode">
|
||||
Specifies how the [member detail_albedo] should blend with the current [code]ALBEDO[/code]. See [enum BlendMode] for options.
|
||||
</member>
|
||||
<member name="detail_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], enables the detail overlay. Detail is a second texture that gets mixed over the surface of the object based on [member detail_mask]. This can be used to add variation to objects, or to blend between two different albedo/normal textures.
|
||||
</member>
|
||||
<member name="detail_mask" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture used to specify how the detail textures get blended with the base textures.
|
||||
</member>
|
||||
<member name="detail_normal" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture that specifies the per-pixel normal of the detail overlay.
|
||||
[b]Note:[/b] Godot expects the normal map to use X+, Y+, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines.
|
||||
</member>
|
||||
<member name="detail_uv_layer" type="int" setter="set_detail_uv" getter="get_detail_uv" enum="Material3D.DetailUV">
|
||||
Specifies whether to use [code]UV[/code] or [code]UV2[/code] for the detail layer. See [enum DetailUV] for options.
|
||||
</member>
|
||||
<member name="distance_fade_max_distance" type="float" setter="set_distance_fade_max_distance" getter="get_distance_fade_max_distance">
|
||||
Distance at which the object appears fully opaque.
|
||||
[b]Note:[/b] If [code]distance_fade_max_distance[/code] is less than [code]distance_fade_min_distance[/code], the behavior will be reversed. The object will start to fade away at [code]distance_fade_max_distance[/code] and will fully disappear once it reaches [code]distance_fade_min_distance[/code].
|
||||
</member>
|
||||
<member name="distance_fade_min_distance" type="float" setter="set_distance_fade_min_distance" getter="get_distance_fade_min_distance">
|
||||
Distance at which the object starts to become visible. If the object is less than this distance away, it will be invisible.
|
||||
[b]Note:[/b] If [code]distance_fade_min_distance[/code] is greater than [code]distance_fade_max_distance[/code], the behavior will be reversed. The object will start to fade away at [code]distance_fade_max_distance[/code] and will fully disappear once it reaches [code]distance_fade_min_distance[/code].
|
||||
</member>
|
||||
<member name="distance_fade_mode" type="int" setter="set_distance_fade" getter="get_distance_fade" enum="Material3D.DistanceFadeMode" default="0">
|
||||
Specifies which type of fade to use. Can be any of the [enum DistanceFadeMode]s.
|
||||
</member>
|
||||
<member name="emission" type="Color" setter="set_emission" getter="get_emission">
|
||||
The emitted light's color. See [member emission_enabled].
|
||||
</member>
|
||||
<member name="emission_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], the body emits light. Emitting light makes the object appear brighter. The object can also cast light on other objects if a [GIProbe] or [BakedLightmap] is used and this object is used in baked lighting.
|
||||
</member>
|
||||
<member name="emission_energy" type="float" setter="set_emission_energy" getter="get_emission_energy">
|
||||
The emitted light's strength. See [member emission_enabled].
|
||||
</member>
|
||||
<member name="emission_on_uv2" type="bool" setter="set_flag" getter="get_flag">
|
||||
Use [code]UV2[/code] to read from the [member emission_texture].
|
||||
</member>
|
||||
<member name="emission_operator" type="int" setter="set_emission_operator" getter="get_emission_operator" enum="Material3D.EmissionOperator">
|
||||
Sets how [member emission] interacts with [member emission_texture]. Can either add or multiply. See [enum EmissionOperator] for options.
|
||||
</member>
|
||||
<member name="emission_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture that specifies how much surface emits light at a given point.
|
||||
</member>
|
||||
<member name="flags_albedo_tex_force_srgb" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
Forces a conversion of the [member albedo_texture] from sRGB space to linear space.
|
||||
</member>
|
||||
<member name="flags_albedo_tex_msdf" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
Enables signed distance field rendering shader.
|
||||
</member>
|
||||
<member name="flags_disable_ambient_light" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], the object receives no ambient light.
|
||||
</member>
|
||||
<member name="flags_do_not_receive_shadows" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], the object receives no shadow that would otherwise be cast onto it.
|
||||
</member>
|
||||
<member name="flags_ensure_correct_normals" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], the shader will compute extra operations to make sure the normal stays correct when using a non-uniform scale. Only enable if using non-uniform scaling.
|
||||
</member>
|
||||
<member name="flags_fixed_size" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], the object is rendered at the same size regardless of distance.
|
||||
</member>
|
||||
<member name="flags_no_depth_test" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], depth testing is disabled and the object will be drawn in render order.
|
||||
</member>
|
||||
<member name="flags_transparent" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], transparency is enabled on the body. See also [member params_blend_mode].
|
||||
</member>
|
||||
<member name="flags_unshaded" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], the object is unaffected by lighting.
|
||||
</member>
|
||||
<member name="flags_use_point_size" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], render point size can be changed.
|
||||
[b]Note:[/b] This is only effective for objects whose geometry is point-based rather than triangle-based. See also [member params_point_size].
|
||||
</member>
|
||||
<member name="flags_use_shadow_to_opacity" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], enables the "shadow to opacity" render mode where lighting modifies the alpha so shadowed areas are opaque and non-shadowed areas are transparent. Useful for overlaying shadows onto a camera feed in AR.
|
||||
</member>
|
||||
<member name="flags_vertex_lighting" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], lighting is calculated per vertex rather than per pixel. This may increase performance on low-end devices, especially for meshes with a lower polygon count. The downside is that shading becomes much less accurate, with visible linear interpolation between vertices that are joined together. This can be compensated by ensuring meshes have a sufficient level of subdivision (but not too much, to avoid reducing performance). Some material features are also not supported when vertex shading is enabled.
|
||||
See also [member ProjectSettings.rendering/quality/shading/force_vertex_shading] which can globally enable vertex shading on all materials.
|
||||
[b]Note:[/b] By default, vertex shading is enforced on mobile platforms by [member ProjectSettings.rendering/quality/shading/force_vertex_shading]'s [code]mobile[/code] override.
|
||||
[b]Note:[/b] [member flags_vertex_lighting] has no effect if [member flags_unshaded] is [code]true[/code].
|
||||
</member>
|
||||
<member name="flags_world_triplanar" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], triplanar mapping is calculated in world space rather than object local space. See also [member uv1_triplanar].
|
||||
</member>
|
||||
<member name="metallic" type="float" setter="set_metallic" getter="get_metallic" default="0.0">
|
||||
A high value makes the material appear more like a metal. Non-metals use their albedo as the diffuse color and add diffuse to the specular reflection. With non-metals, the reflection appears on top of the albedo color. Metals use their albedo as a multiplier to the specular reflection and set the diffuse color to black resulting in a tinted reflection. Materials work better when fully metal or fully non-metal, values between [code]0[/code] and [code]1[/code] should only be used for blending between metal and non-metal sections. To alter the amount of reflection use [member roughness].
|
||||
</member>
|
||||
<member name="metallic_specular" type="float" setter="set_specular" getter="get_specular" default="0.5">
|
||||
Sets the size of the specular lobe. The specular lobe is the bright spot that is reflected from light sources.
|
||||
[b]Note:[/b] Unlike [member metallic], this is not energy-conserving, so it should be left at [code]0.5[/code] in most cases. See also [member roughness].
|
||||
</member>
|
||||
<member name="metallic_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture used to specify metallic for an object. This is multiplied by [member metallic].
|
||||
</member>
|
||||
<member name="metallic_texture_channel" type="int" setter="set_metallic_texture_channel" getter="get_metallic_texture_channel" enum="Material3D.TextureChannel" default="0">
|
||||
Specifies the channel of the [member metallic_texture] in which the metallic information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
|
||||
</member>
|
||||
<member name="normal_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], normal mapping is enabled.
|
||||
</member>
|
||||
<member name="normal_scale" type="float" setter="set_normal_scale" getter="get_normal_scale">
|
||||
The strength of the normal map's effect.
|
||||
</member>
|
||||
<member name="normal_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture used to specify the normal at a given pixel. The [code]normal_texture[/code] only uses the red and green channels; the blue and alpha channels are ignored. The normal read from [code]normal_texture[/code] is oriented around the surface normal provided by the [Mesh].
|
||||
[b]Note:[/b] The mesh must have both normals and tangents defined in its vertex data. Otherwise, the normal map won't render correctly and will only appear to darken the whole surface. If creating geometry with [SurfaceTool], you can use [method SurfaceTool.generate_normals] and [method SurfaceTool.generate_tangents] to automatically generate normals and tangents respectively.
|
||||
[b]Note:[/b] Godot expects the normal map to use X+, Y+, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines.
|
||||
</member>
|
||||
<member name="orm_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
A single texture that combines information about AO, roughness and metallic. AO is stored in the red channel, roughness in the green channel and metallic in the blue channel.
|
||||
</member>
|
||||
<member name="params_alpha_scissor_threshold" type="float" setter="set_alpha_scissor_threshold" getter="get_alpha_scissor_threshold">
|
||||
Threshold at which the alpha scissor will discard values.
|
||||
</member>
|
||||
<member name="params_billboard_keep_scale" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], the shader will keep the scale set for the mesh. Otherwise the scale is lost when billboarding. Only applies when [member params_billboard_mode] is [constant BILLBOARD_ENABLED].
|
||||
</member>
|
||||
<member name="params_billboard_mode" type="int" setter="set_billboard_mode" getter="get_billboard_mode" enum="Material3D.BillboardMode" default="0">
|
||||
Controls how the object faces the camera. See [enum BillboardMode].
|
||||
[b]Note:[/b] Billboard mode is not suitable for VR because the left-right vector of the camera is not horizontal when the screen is attached to your head instead of on the table. See [url=https://github.com/godotengine/godot/issues/41567]GitHub issue #41567[/url] for details.
|
||||
</member>
|
||||
<member name="params_blend_mode" type="int" setter="set_blend_mode" getter="get_blend_mode" enum="Material3D.BlendMode" default="0">
|
||||
The material's blend mode.
|
||||
[b]Note:[/b] Values other than [code]Mix[/code] force the object into the transparent pipeline. See [enum BlendMode].
|
||||
</member>
|
||||
<member name="params_cull_mode" type="int" setter="set_cull_mode" getter="get_cull_mode" enum="Material3D.CullMode" default="0">
|
||||
Which side of the object is not drawn when backfaces are rendered. See [enum CullMode].
|
||||
</member>
|
||||
<member name="params_depth_draw_mode" type="int" setter="set_depth_draw_mode" getter="get_depth_draw_mode" enum="Material3D.DepthDrawMode" default="0">
|
||||
Determines when depth rendering takes place. See [enum DepthDrawMode]. See also [member flags_transparent].
|
||||
</member>
|
||||
<member name="params_diffuse_mode" type="int" setter="set_diffuse_mode" getter="get_diffuse_mode" enum="Material3D.DiffuseMode" default="0">
|
||||
The algorithm used for diffuse light scattering. See [enum DiffuseMode].
|
||||
</member>
|
||||
<member name="params_grow" type="bool" setter="set_grow_enabled" getter="is_grow_enabled" default="false">
|
||||
If [code]true[/code], enables the vertex grow setting. See [member params_grow_amount].
|
||||
</member>
|
||||
<member name="params_grow_amount" type="float" setter="set_grow" getter="get_grow">
|
||||
Grows object vertices in the direction of their normals.
|
||||
</member>
|
||||
<member name="params_line_width" type="float" setter="set_line_width" getter="get_line_width" default="1.0">
|
||||
Currently unimplemented in Godot.
|
||||
</member>
|
||||
<member name="params_point_size" type="float" setter="set_point_size" getter="get_point_size" default="1.0">
|
||||
The point size in pixels. See [member flags_use_point_size].
|
||||
</member>
|
||||
<member name="params_specular_mode" type="int" setter="set_specular_mode" getter="get_specular_mode" enum="Material3D.SpecularMode" default="0">
|
||||
The method for rendering the specular blob. See [enum SpecularMode].
|
||||
</member>
|
||||
<member name="params_use_alpha_scissor" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], the shader will discard all pixels that have an alpha value less than [member params_alpha_scissor_threshold].
|
||||
</member>
|
||||
<member name="particles_anim_h_frames" type="int" setter="set_particles_anim_h_frames" getter="get_particles_anim_h_frames">
|
||||
The number of horizontal frames in the particle sprite sheet. Only enabled when using [constant BILLBOARD_PARTICLES]. See [member params_billboard_mode].
|
||||
</member>
|
||||
<member name="particles_anim_loop" type="bool" setter="set_particles_anim_loop" getter="get_particles_anim_loop">
|
||||
If [code]true[/code], particle animations are looped. Only enabled when using [constant BILLBOARD_PARTICLES]. See [member params_billboard_mode].
|
||||
</member>
|
||||
<member name="particles_anim_v_frames" type="int" setter="set_particles_anim_v_frames" getter="get_particles_anim_v_frames">
|
||||
The number of vertical frames in the particle sprite sheet. Only enabled when using [constant BILLBOARD_PARTICLES]. See [member params_billboard_mode].
|
||||
</member>
|
||||
<member name="proximity_fade_distance" type="float" setter="set_proximity_fade_distance" getter="get_proximity_fade_distance">
|
||||
Distance over which the fade effect takes place. The larger the distance the longer it takes for an object to fade.
|
||||
</member>
|
||||
<member name="proximity_fade_enable" type="bool" setter="set_proximity_fade" getter="is_proximity_fade_enabled" default="false">
|
||||
If [code]true[/code], the proximity fade effect is enabled. The proximity fade effect fades out each pixel based on its distance to another object.
|
||||
</member>
|
||||
<member name="refraction_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], the refraction effect is enabled. Refraction distorts transparency based on light from behind the object. When using the GLES3 backend, the material's roughness value will affect the blurriness of the refraction. Higher roughness values will make the refraction look blurrier.
|
||||
</member>
|
||||
<member name="refraction_scale" type="float" setter="set_refraction" getter="get_refraction">
|
||||
The strength of the refraction effect. Higher values result in a more distorted appearance for the refraction.
|
||||
</member>
|
||||
<member name="refraction_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture that controls the strength of the refraction per-pixel. Multiplied by [member refraction_scale].
|
||||
</member>
|
||||
<member name="refraction_texture_channel" type="int" setter="set_refraction_texture_channel" getter="get_refraction_texture_channel" enum="Material3D.TextureChannel">
|
||||
Specifies the channel of the [member refraction_texture] in which the refraction information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
|
||||
</member>
|
||||
<member name="rim" type="float" setter="set_rim" getter="get_rim">
|
||||
Sets the strength of the rim lighting effect.
|
||||
</member>
|
||||
<member name="rim_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], rim effect is enabled. Rim lighting increases the brightness at glancing angles on an object.
|
||||
[b]Note:[/b] Rim lighting is not visible if the material has [member flags_unshaded] set to [code]true[/code].
|
||||
</member>
|
||||
<member name="rim_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture used to set the strength of the rim lighting effect per-pixel. Multiplied by [member rim].
|
||||
</member>
|
||||
<member name="rim_tint" type="float" setter="set_rim_tint" getter="get_rim_tint">
|
||||
The amount of to blend light and albedo color when rendering rim effect. If [code]0[/code] the light color is used, while [code]1[/code] means albedo color is used. An intermediate value generally works best.
|
||||
</member>
|
||||
<member name="roughness" type="float" setter="set_roughness" getter="get_roughness" default="1.0">
|
||||
Surface reflection. A value of [code]0[/code] represents a perfect mirror while a value of [code]1[/code] completely blurs the reflection. See also [member metallic].
|
||||
</member>
|
||||
<member name="roughness_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture used to control the roughness per-pixel. Multiplied by [member roughness].
|
||||
</member>
|
||||
<member name="roughness_texture_channel" type="int" setter="set_roughness_texture_channel" getter="get_roughness_texture_channel" enum="Material3D.TextureChannel" default="0">
|
||||
Specifies the channel of the [member ao_texture] in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
|
||||
</member>
|
||||
<member name="subsurf_scatter_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], subsurface scattering is enabled. Emulates light that penetrates an object's surface, is scattered, and then emerges.
|
||||
</member>
|
||||
<member name="subsurf_scatter_strength" type="float" setter="set_subsurface_scattering_strength" getter="get_subsurface_scattering_strength">
|
||||
The strength of the subsurface scattering effect.
|
||||
</member>
|
||||
<member name="subsurf_scatter_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture used to control the subsurface scattering strength. Stored in the red texture channel. Multiplied by [member subsurf_scatter_strength].
|
||||
</member>
|
||||
<member name="transmission" type="Color" setter="set_transmission" getter="get_transmission">
|
||||
The color used by the transmission effect. Represents the light passing through an object.
|
||||
</member>
|
||||
<member name="transmission_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], the transmission effect is enabled.
|
||||
</member>
|
||||
<member name="transmission_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture used to control the transmission effect per-pixel. Added to [member transmission].
|
||||
</member>
|
||||
<member name="uv1_offset" type="Vector3" setter="set_uv1_offset" getter="get_uv1_offset" default="Vector3( 0, 0, 0 )">
|
||||
How much to offset the [code]UV[/code] coordinates. This amount will be added to [code]UV[/code] in the vertex function. This can be used to offset a texture.
|
||||
</member>
|
||||
<member name="uv1_scale" type="Vector3" setter="set_uv1_scale" getter="get_uv1_scale" default="Vector3( 1, 1, 1 )">
|
||||
How much to scale the [code]UV[/code] coordinates. This is multiplied by [code]UV[/code] in the vertex function.
|
||||
</member>
|
||||
<member name="uv1_triplanar" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], instead of using [code]UV[/code] textures will use a triplanar texture lookup to determine how to apply textures. Triplanar uses the orientation of the object's surface to blend between texture coordinates. It reads from the source texture 3 times, once for each axis and then blends between the results based on how closely the pixel aligns with each axis. This is often used for natural features to get a realistic blend of materials. Because triplanar texturing requires many more texture reads per-pixel it is much slower than normal UV texturing. Additionally, because it is blending the texture between the three axes, it is unsuitable when you are trying to achieve crisp texturing.
|
||||
</member>
|
||||
<member name="uv1_triplanar_sharpness" type="float" setter="set_uv1_triplanar_blend_sharpness" getter="get_uv1_triplanar_blend_sharpness">
|
||||
A lower number blends the texture more softly while a higher number blends the texture more sharply.
|
||||
[b]Note:[/b] [member uv1_triplanar_sharpness] is clamped between [code]0.0[/code] and [code]150.0[/code] (inclusive) as values outside that range can look broken depending on the mesh.
|
||||
</member>
|
||||
<member name="uv2_offset" type="Vector3" setter="set_uv2_offset" getter="get_uv2_offset" default="Vector3( 0, 0, 0 )">
|
||||
How much to offset the [code]UV2[/code] coordinates. This amount will be added to [code]UV2[/code] in the vertex function. This can be used to offset a texture.
|
||||
</member>
|
||||
<member name="uv2_scale" type="Vector3" setter="set_uv2_scale" getter="get_uv2_scale" default="Vector3( 1, 1, 1 )">
|
||||
How much to scale the [code]UV2[/code] coordinates. This is multiplied by [code]UV2[/code] in the vertex function.
|
||||
</member>
|
||||
<member name="uv2_triplanar" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], instead of using [code]UV2[/code] textures will use a triplanar texture lookup to determine how to apply textures. Triplanar uses the orientation of the object's surface to blend between texture coordinates. It reads from the source texture 3 times, once for each axis and then blends between the results based on how closely the pixel aligns with each axis. This is often used for natural features to get a realistic blend of materials. Because triplanar texturing requires many more texture reads per-pixel it is much slower than normal UV texturing. Additionally, because it is blending the texture between the three axes, it is unsuitable when you are trying to achieve crisp texturing.
|
||||
</member>
|
||||
<member name="uv2_triplanar_sharpness" type="float" setter="set_uv2_triplanar_blend_sharpness" getter="get_uv2_triplanar_blend_sharpness">
|
||||
A lower number blends the texture more softly while a higher number blends the texture more sharply.
|
||||
[b]Note:[/b] [member uv2_triplanar_sharpness] is clamped between [code]0.0[/code] and [code]150.0[/code] (inclusive) as values outside that range can look broken depending on the mesh.
|
||||
</member>
|
||||
<member name="vertex_color_is_srgb" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], the model's vertex colors are processed as sRGB mode.
|
||||
</member>
|
||||
<member name="vertex_color_use_as_albedo" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], the vertex color is used as albedo color.
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
<constant name="TEXTURE_ALBEDO" value="0" enum="TextureParam">
|
||||
Texture specifying per-pixel color.
|
||||
</constant>
|
||||
<constant name="TEXTURE_METALLIC" value="1" enum="TextureParam">
|
||||
Texture specifying per-pixel metallic value.
|
||||
</constant>
|
||||
<constant name="TEXTURE_ROUGHNESS" value="2" enum="TextureParam">
|
||||
Texture specifying per-pixel roughness value.
|
||||
</constant>
|
||||
<constant name="TEXTURE_EMISSION" value="3" enum="TextureParam">
|
||||
Texture specifying per-pixel emission color.
|
||||
</constant>
|
||||
<constant name="TEXTURE_NORMAL" value="4" enum="TextureParam">
|
||||
Texture specifying per-pixel normal vector.
|
||||
</constant>
|
||||
<constant name="TEXTURE_RIM" value="5" enum="TextureParam">
|
||||
Texture specifying per-pixel rim value.
|
||||
</constant>
|
||||
<constant name="TEXTURE_CLEARCOAT" value="6" enum="TextureParam">
|
||||
Texture specifying per-pixel clearcoat value.
|
||||
</constant>
|
||||
<constant name="TEXTURE_FLOWMAP" value="7" enum="TextureParam">
|
||||
Texture specifying per-pixel flowmap direction for use with [member anisotropy].
|
||||
</constant>
|
||||
<constant name="TEXTURE_AMBIENT_OCCLUSION" value="8" enum="TextureParam">
|
||||
Texture specifying per-pixel ambient occlusion value.
|
||||
</constant>
|
||||
<constant name="TEXTURE_DEPTH" value="9" enum="TextureParam">
|
||||
Texture specifying per-pixel depth.
|
||||
</constant>
|
||||
<constant name="TEXTURE_SUBSURFACE_SCATTERING" value="10" enum="TextureParam">
|
||||
Texture specifying per-pixel subsurface scattering.
|
||||
</constant>
|
||||
<constant name="TEXTURE_TRANSMISSION" value="11" enum="TextureParam">
|
||||
Texture specifying per-pixel transmission color.
|
||||
</constant>
|
||||
<constant name="TEXTURE_REFRACTION" value="12" enum="TextureParam">
|
||||
Texture specifying per-pixel refraction strength.
|
||||
</constant>
|
||||
<constant name="TEXTURE_DETAIL_MASK" value="13" enum="TextureParam">
|
||||
Texture specifying per-pixel detail mask blending value.
|
||||
</constant>
|
||||
<constant name="TEXTURE_DETAIL_ALBEDO" value="14" enum="TextureParam">
|
||||
Texture specifying per-pixel detail color.
|
||||
</constant>
|
||||
<constant name="TEXTURE_DETAIL_NORMAL" value="15" enum="TextureParam">
|
||||
Texture specifying per-pixel detail normal.
|
||||
</constant>
|
||||
<constant name="TEXTURE_MAX" value="17" enum="TextureParam">
|
||||
Represents the size of the [enum TextureParam] enum.
|
||||
</constant>
|
||||
<constant name="DETAIL_UV_1" value="0" enum="DetailUV">
|
||||
Use [code]UV[/code] with the detail texture.
|
||||
</constant>
|
||||
<constant name="DETAIL_UV_2" value="1" enum="DetailUV">
|
||||
Use [code]UV2[/code] with the detail texture.
|
||||
</constant>
|
||||
<constant name="FEATURE_TRANSPARENT" value="0" enum="Feature">
|
||||
Constant for setting [member flags_transparent].
|
||||
</constant>
|
||||
<constant name="FEATURE_EMISSION" value="1" enum="Feature">
|
||||
Constant for setting [member emission_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_NORMAL_MAPPING" value="2" enum="Feature">
|
||||
Constant for setting [member normal_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_RIM" value="3" enum="Feature">
|
||||
Constant for setting [member rim_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_CLEARCOAT" value="4" enum="Feature">
|
||||
Constant for setting [member clearcoat_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_ANISOTROPY" value="5" enum="Feature">
|
||||
Constant for setting [member anisotropy_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_AMBIENT_OCCLUSION" value="6" enum="Feature">
|
||||
Constant for setting [member ao_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_DEPTH_MAPPING" value="7" enum="Feature">
|
||||
Constant for setting [member depth_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_SUBSURACE_SCATTERING" value="8" enum="Feature">
|
||||
Constant for setting [member subsurf_scatter_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_TRANSMISSION" value="9" enum="Feature">
|
||||
Constant for setting [member transmission_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_REFRACTION" value="10" enum="Feature">
|
||||
Constant for setting [member refraction_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_DETAIL" value="11" enum="Feature">
|
||||
Constant for setting [member detail_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_MAX" value="12" enum="Feature">
|
||||
Represents the size of the [enum Feature] enum.
|
||||
</constant>
|
||||
<constant name="BLEND_MODE_MIX" value="0" enum="BlendMode">
|
||||
Default blend mode. The color of the object is blended over the background based on the object's alpha value.
|
||||
</constant>
|
||||
<constant name="BLEND_MODE_ADD" value="1" enum="BlendMode">
|
||||
The color of the object is added to the background.
|
||||
</constant>
|
||||
<constant name="BLEND_MODE_SUB" value="2" enum="BlendMode">
|
||||
The color of the object is subtracted from the background.
|
||||
</constant>
|
||||
<constant name="BLEND_MODE_MUL" value="3" enum="BlendMode">
|
||||
The color of the object is multiplied by the background.
|
||||
</constant>
|
||||
<constant name="DEPTH_DRAW_OPAQUE_ONLY" value="0" enum="DepthDrawMode">
|
||||
Default depth draw mode. Depth is drawn only for opaque objects.
|
||||
</constant>
|
||||
<constant name="DEPTH_DRAW_ALWAYS" value="1" enum="DepthDrawMode">
|
||||
Depth draw is calculated for both opaque and transparent objects.
|
||||
</constant>
|
||||
<constant name="DEPTH_DRAW_DISABLED" value="2" enum="DepthDrawMode">
|
||||
No depth draw.
|
||||
</constant>
|
||||
<constant name="DEPTH_DRAW_ALPHA_OPAQUE_PREPASS" value="3" enum="DepthDrawMode">
|
||||
For transparent objects, an opaque pass is made first with the opaque parts, then transparency is drawn.
|
||||
</constant>
|
||||
<constant name="CULL_BACK" value="0" enum="CullMode">
|
||||
Default cull mode. The back of the object is culled when not visible.
|
||||
</constant>
|
||||
<constant name="CULL_FRONT" value="1" enum="CullMode">
|
||||
The front of the object is culled when not visible.
|
||||
</constant>
|
||||
<constant name="CULL_DISABLED" value="2" enum="CullMode">
|
||||
No culling is performed.
|
||||
</constant>
|
||||
<constant name="FLAG_UNSHADED" value="0" enum="Flags">
|
||||
No lighting is used on the object. Color comes directly from [code]ALBEDO[/code].
|
||||
</constant>
|
||||
<constant name="FLAG_USE_VERTEX_LIGHTING" value="1" enum="Flags">
|
||||
Lighting is calculated per-vertex rather than per-pixel. This can be used to increase the speed of the shader at the cost of quality.
|
||||
</constant>
|
||||
<constant name="FLAG_DISABLE_DEPTH_TEST" value="2" enum="Flags">
|
||||
Disables the depth test, so this object is drawn on top of all others. However, objects drawn after it in the draw order may cover it.
|
||||
</constant>
|
||||
<constant name="FLAG_ALBEDO_FROM_VERTEX_COLOR" value="3" enum="Flags">
|
||||
Set [code]ALBEDO[/code] to the per-vertex color specified in the mesh.
|
||||
</constant>
|
||||
<constant name="FLAG_SRGB_VERTEX_COLOR" value="4" enum="Flags">
|
||||
Vertex color is in sRGB space and needs to be converted to linear. Only applies in the GLES3 renderer.
|
||||
</constant>
|
||||
<constant name="FLAG_USE_POINT_SIZE" value="5" enum="Flags">
|
||||
Uses point size to alter the size of primitive points. Also changes the albedo texture lookup to use [code]POINT_COORD[/code] instead of [code]UV[/code].
|
||||
</constant>
|
||||
<constant name="FLAG_FIXED_SIZE" value="6" enum="Flags">
|
||||
Object is scaled by depth so that it always appears the same size on screen.
|
||||
</constant>
|
||||
<constant name="FLAG_BILLBOARD_KEEP_SCALE" value="7" enum="Flags">
|
||||
Shader will keep the scale set for the mesh. Otherwise the scale is lost when billboarding. Only applies when [member params_billboard_mode] is [constant BILLBOARD_ENABLED].
|
||||
</constant>
|
||||
<constant name="FLAG_UV1_USE_TRIPLANAR" value="8" enum="Flags">
|
||||
Use triplanar texture lookup for all texture lookups that would normally use [code]UV[/code].
|
||||
</constant>
|
||||
<constant name="FLAG_UV2_USE_TRIPLANAR" value="9" enum="Flags">
|
||||
Use triplanar texture lookup for all texture lookups that would normally use [code]UV2[/code].
|
||||
</constant>
|
||||
<constant name="FLAG_AO_ON_UV2" value="11" enum="Flags">
|
||||
Use [code]UV2[/code] coordinates to look up from the [member ao_texture].
|
||||
</constant>
|
||||
<constant name="FLAG_EMISSION_ON_UV2" value="12" enum="Flags">
|
||||
Use [code]UV2[/code] coordinates to look up from the [member emission_texture].
|
||||
</constant>
|
||||
<constant name="FLAG_USE_ALPHA_SCISSOR" value="13" enum="Flags">
|
||||
Use alpha scissor. Set by [member params_use_alpha_scissor].
|
||||
</constant>
|
||||
<constant name="FLAG_TRIPLANAR_USE_WORLD" value="10" enum="Flags">
|
||||
Use world coordinates in the triplanar texture lookup instead of local coordinates.
|
||||
</constant>
|
||||
<constant name="FLAG_ALBEDO_TEXTURE_FORCE_SRGB" value="14" enum="Flags">
|
||||
Forces the shader to convert albedo from sRGB space to linear space.
|
||||
</constant>
|
||||
<constant name="FLAG_DONT_RECEIVE_SHADOWS" value="15" enum="Flags">
|
||||
Disables receiving shadows from other objects.
|
||||
</constant>
|
||||
<constant name="FLAG_DISABLE_AMBIENT_LIGHT" value="17" enum="Flags">
|
||||
Disables receiving ambient light.
|
||||
</constant>
|
||||
<constant name="FLAG_ENSURE_CORRECT_NORMALS" value="16" enum="Flags">
|
||||
Ensures that normals appear correct, even with non-uniform scaling.
|
||||
</constant>
|
||||
<constant name="FLAG_USE_SHADOW_TO_OPACITY" value="18" enum="Flags">
|
||||
Enables the shadow to opacity feature.
|
||||
</constant>
|
||||
<constant name="FLAG_ALBEDO_TEXTURE_SDF" value="19" enum="Flags">
|
||||
Enables signed distance field rendering shader.
|
||||
</constant>
|
||||
<constant name="FLAG_MAX" value="20" enum="Flags">
|
||||
Represents the size of the [enum Flags] enum.
|
||||
</constant>
|
||||
<constant name="DIFFUSE_BURLEY" value="0" enum="DiffuseMode">
|
||||
Default diffuse scattering algorithm.
|
||||
</constant>
|
||||
<constant name="DIFFUSE_LAMBERT" value="1" enum="DiffuseMode">
|
||||
Diffuse scattering ignores roughness.
|
||||
</constant>
|
||||
<constant name="DIFFUSE_LAMBERT_WRAP" value="2" enum="DiffuseMode">
|
||||
Extends Lambert to cover more than 90 degrees when roughness increases.
|
||||
</constant>
|
||||
<constant name="DIFFUSE_OREN_NAYAR" value="3" enum="DiffuseMode">
|
||||
Attempts to use roughness to emulate microsurfacing.
|
||||
</constant>
|
||||
<constant name="DIFFUSE_TOON" value="4" enum="DiffuseMode">
|
||||
Uses a hard cut for lighting, with smoothing affected by roughness.
|
||||
</constant>
|
||||
<constant name="SPECULAR_SCHLICK_GGX" value="0" enum="SpecularMode">
|
||||
Default specular blob.
|
||||
</constant>
|
||||
<constant name="SPECULAR_BLINN" value="1" enum="SpecularMode">
|
||||
Older specular algorithm, included for compatibility.
|
||||
</constant>
|
||||
<constant name="SPECULAR_PHONG" value="2" enum="SpecularMode">
|
||||
Older specular algorithm, included for compatibility.
|
||||
</constant>
|
||||
<constant name="SPECULAR_TOON" value="3" enum="SpecularMode">
|
||||
Toon blob which changes size based on roughness.
|
||||
</constant>
|
||||
<constant name="SPECULAR_DISABLED" value="4" enum="SpecularMode">
|
||||
No specular blob.
|
||||
</constant>
|
||||
<constant name="BILLBOARD_DISABLED" value="0" enum="BillboardMode">
|
||||
Billboard mode is disabled.
|
||||
</constant>
|
||||
<constant name="BILLBOARD_ENABLED" value="1" enum="BillboardMode">
|
||||
The object's Z axis will always face the camera.
|
||||
</constant>
|
||||
<constant name="BILLBOARD_FIXED_Y" value="2" enum="BillboardMode">
|
||||
The object's X axis will always face the camera.
|
||||
</constant>
|
||||
<constant name="BILLBOARD_PARTICLES" value="3" enum="BillboardMode">
|
||||
Used for particle systems when assigned to [Particles] and [CPUParticles] nodes. Enables [code]particles_anim_*[/code] properties.
|
||||
The [member ParticlesMaterial.anim_speed] or [member CPUParticles.anim_speed] should also be set to a positive value for the animation to play.
|
||||
</constant>
|
||||
<constant name="TEXTURE_CHANNEL_RED" value="0" enum="TextureChannel">
|
||||
Used to read from the red channel of a texture.
|
||||
</constant>
|
||||
<constant name="TEXTURE_CHANNEL_GREEN" value="1" enum="TextureChannel">
|
||||
Used to read from the green channel of a texture.
|
||||
</constant>
|
||||
<constant name="TEXTURE_CHANNEL_BLUE" value="2" enum="TextureChannel">
|
||||
Used to read from the blue channel of a texture.
|
||||
</constant>
|
||||
<constant name="TEXTURE_CHANNEL_ALPHA" value="3" enum="TextureChannel">
|
||||
Used to read from the alpha channel of a texture.
|
||||
</constant>
|
||||
<constant name="TEXTURE_CHANNEL_GRAYSCALE" value="4" enum="TextureChannel">
|
||||
Currently unused.
|
||||
</constant>
|
||||
<constant name="EMISSION_OP_ADD" value="0" enum="EmissionOperator">
|
||||
Adds the emission color to the color from the emission texture.
|
||||
</constant>
|
||||
<constant name="EMISSION_OP_MULTIPLY" value="1" enum="EmissionOperator">
|
||||
Multiplies the emission color by the color from the emission texture.
|
||||
</constant>
|
||||
<constant name="DISTANCE_FADE_DISABLED" value="0" enum="DistanceFadeMode">
|
||||
Do not use distance fade.
|
||||
</constant>
|
||||
<constant name="DISTANCE_FADE_PIXEL_ALPHA" value="1" enum="DistanceFadeMode">
|
||||
Smoothly fades the object out based on each pixel's distance from the camera using the alpha channel.
|
||||
</constant>
|
||||
<constant name="DISTANCE_FADE_PIXEL_DITHER" value="2" enum="DistanceFadeMode">
|
||||
Smoothly fades the object out based on each pixel's distance from the camera using a dither approach. Dithering discards pixels based on a set pattern to smoothly fade without enabling transparency. On certain hardware this can be faster than [constant DISTANCE_FADE_PIXEL_ALPHA].
|
||||
</constant>
|
||||
<constant name="DISTANCE_FADE_OBJECT_DITHER" value="3" enum="DistanceFadeMode">
|
||||
Smoothly fades the object out based on the object's distance from the camera using a dither approach. Dithering discards pixels based on a set pattern to smoothly fade without enabling transparency. On certain hardware this can be faster than [constant DISTANCE_FADE_PIXEL_ALPHA].
|
||||
</constant>
|
||||
<constant name="ASYNC_MODE_VISIBLE" value="0" enum="AsyncMode">
|
||||
The real conditioned shader needed on each situation will be sent for background compilation. In the meantime, a very complex shader that adapts to every situation will be used ("ubershader"). This ubershader is much slower to render, but will keep the game running without stalling to compile. Once shader compilation is done, the ubershader is replaced by the traditional optimized shader.
|
||||
</constant>
|
||||
<constant name="ASYNC_MODE_HIDDEN" value="1" enum="AsyncMode">
|
||||
Anything with this material applied won't be rendered while this material's shader is being compiled.
|
||||
This is useful for optimization, in cases where the visuals won't suffer from having certain non-essential elements missing during the short time their shaders are being compiled.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
|
@ -81,7 +81,7 @@
|
|||
<argument index="1" name="color" type="Color" />
|
||||
<description>
|
||||
Sets the color of a specific instance by [i]multiplying[/i] the mesh's existing vertex colors.
|
||||
For the color to take effect, ensure that [member color_format] is non-[code]null[/code] on the [MultiMesh] and [member SpatialMaterial.vertex_color_use_as_albedo] is [code]true[/code] on the material. If the color doesn't look as expected, make sure the material's albedo color is set to pure white ([code]Color(1, 1, 1)[/code]).
|
||||
For the color to take effect, ensure that [member color_format] is non-[code]null[/code] on the [MultiMesh] and [member Material3D.vertex_color_use_as_albedo] is [code]true[/code] on the material. If the color doesn't look as expected, make sure the material's albedo color is set to pure white ([code]Color(1, 1, 1)[/code]).
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_instance_custom_data">
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="ORMSpatialMaterial" inherits="Material3D" version="3.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
||||
<brief_description>
|
||||
ORM 3D rendering material, based on [Material3D].
|
||||
</brief_description>
|
||||
<description>
|
||||
This is a variant of the SpatialMaterial that uses an ORM texture to store AO, roughness and metallic information.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
</methods>
|
||||
<constants>
|
||||
</constants>
|
||||
</class>
|
|
@ -75,7 +75,7 @@
|
|||
<members>
|
||||
<member name="angle" type="float" setter="set_param" getter="get_param" default="0.0">
|
||||
Initial rotation applied to each particle, in degrees.
|
||||
[b]Note:[/b] Only applied when [member flag_disable_z] or [member flag_rotate_y] are [code]true[/code] or the [SpatialMaterial] being used to draw the particle is using [constant SpatialMaterial.BILLBOARD_PARTICLES].
|
||||
[b]Note:[/b] Only applied when [member flag_disable_z] or [member flag_rotate_y] are [code]true[/code] or the [Material3D] being used to draw the particle is using [constant Material3D.BILLBOARD_PARTICLES].
|
||||
</member>
|
||||
<member name="angle_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
|
||||
Each particle's rotation will be animated along this [CurveTexture].
|
||||
|
@ -85,7 +85,7 @@
|
|||
</member>
|
||||
<member name="angular_velocity" type="float" setter="set_param" getter="get_param" default="0.0">
|
||||
Initial angular velocity applied to each particle in [i]degrees[/i] per second. Sets the speed of rotation of the particle.
|
||||
[b]Note:[/b] Only applied when [member flag_disable_z] or [member flag_rotate_y] are [code]true[/code] or the [SpatialMaterial] being used to draw the particle is using [constant SpatialMaterial.BILLBOARD_PARTICLES].
|
||||
[b]Note:[/b] Only applied when [member flag_disable_z] or [member flag_rotate_y] are [code]true[/code] or the [Material3D] being used to draw the particle is using [constant Material3D.BILLBOARD_PARTICLES].
|
||||
</member>
|
||||
<member name="angular_velocity_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
|
||||
Each particle's angular velocity will vary along this [CurveTexture].
|
||||
|
@ -113,15 +113,15 @@
|
|||
</member>
|
||||
<member name="color" type="Color" setter="set_color" getter="get_color" default="Color( 1, 1, 1, 1 )">
|
||||
Each particle's initial color. If the [Particles2D]'s or [Particles]'s [code]texture[/code] is defined, it will be multiplied by this color.
|
||||
[b]Note:[/b] [member color] multiplies the particle mesh's vertex colors. To have a visible effect on a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color] will have no visible effect.
|
||||
[b]Note:[/b] [member color] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color] will have no visible effect.
|
||||
</member>
|
||||
<member name="color_initial_ramp" type="Texture" setter="set_color_initial_ramp" getter="get_color_initial_ramp">
|
||||
Each particle's initial color will vary along this [GradientTexture] (multiplied with [member color]).
|
||||
[b]Note:[/b] [member color_initial_ramp] multiplies the particle mesh's vertex colors. To have a visible effect on a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color_initial_ramp] will have no visible effect.
|
||||
[b]Note:[/b] [member color_initial_ramp] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color_initial_ramp] will have no visible effect.
|
||||
</member>
|
||||
<member name="color_ramp" type="Texture" setter="set_color_ramp" getter="get_color_ramp">
|
||||
Each particle's color will vary along this [GradientTexture] over its lifetime (multiplied with [member color]).
|
||||
[b]Note:[/b] [member color_ramp] multiplies the particle mesh's vertex colors. To have a visible effect on a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color_ramp] will have no visible effect.
|
||||
[b]Note:[/b] [member color_ramp] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color_ramp] will have no visible effect.
|
||||
</member>
|
||||
<member name="damping" type="float" setter="set_param" getter="get_param" default="0.0">
|
||||
The rate at which particles lose velocity.
|
||||
|
@ -140,7 +140,7 @@
|
|||
</member>
|
||||
<member name="emission_color_texture" type="Texture" setter="set_emission_color_texture" getter="get_emission_color_texture">
|
||||
Particle color will be modulated by color determined by sampling this texture at the same point as the [member emission_point_texture].
|
||||
[b]Note:[/b] [member emission_color_texture] multiplies the particle mesh's vertex colors. To have a visible effect on a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member emission_color_texture] will have no visible effect.
|
||||
[b]Note:[/b] [member emission_color_texture] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member emission_color_texture] will have no visible effect.
|
||||
</member>
|
||||
<member name="emission_normal_texture" type="Texture" setter="set_emission_normal_texture" getter="get_emission_normal_texture">
|
||||
Particle velocity and rotation will be set by sampling this texture at the same point as the [member emission_point_texture]. Used only in [constant EMISSION_SHAPE_DIRECTED_POINTS]. Can be created automatically from mesh or node by selecting "Create Emission Points from Mesh/Node" under the "Particles" tool in the toolbar.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</brief_description>
|
||||
<description>
|
||||
The PointMesh is made from a single point. Instead of relying on triangles, points are rendered as a single rectangle on the screen with a constant size. They are intended to be used with Particle systems, but can be used as a cheap way to render constant size billboarded sprites (for example in a point cloud).
|
||||
PointMeshes, must be used with a material that has a point size. Point size can be accessed in a shader with [code]POINT_SIZE[/code], or in a [SpatialMaterial] by setting [member SpatialMaterial.flags_use_point_size] and the variable [member SpatialMaterial.params_point_size].
|
||||
PointMeshes, must be used with a material that has a point size. Point size can be accessed in a shader with [code]POINT_SIZE[/code], or in a [SpatialMaterial] by setting [member Material3D.flags_use_point_size] and the variable [member Material3D.params_point_size].
|
||||
When using PointMeshes, properties that normally alter vertices will be ignored, including billboard mode, grow, and cull face.
|
||||
</description>
|
||||
<tutorials>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
</member>
|
||||
<member name="flip_faces" type="bool" setter="set_flip_faces" getter="get_flip_faces" default="false">
|
||||
If set, the order of the vertices in each triangle are reversed resulting in the backside of the mesh being drawn.
|
||||
This gives the same result as using [constant SpatialMaterial.CULL_BACK] in [member SpatialMaterial.params_cull_mode].
|
||||
This gives the same result as using [constant Material3D.CULL_BACK] in [member Material3D.params_cull_mode].
|
||||
</member>
|
||||
<member name="material" type="Material" setter="set_material" getter="get_material">
|
||||
The current [Material] of the primitive mesh.
|
||||
|
|
|
@ -1593,7 +1593,7 @@
|
|||
<member name="rendering/gles3/shaders/shader_compilation_mode" type="int" setter="" getter="" default="0">
|
||||
If set to [code]Asynchronous[/code] and available on the target device, asynchronous compilation of shaders is enabled (in contrast to [code]Asynchronous[/code]).
|
||||
That means that when a shader is first used under some new rendering situation, the game won't stall while such shader is being compiled. Instead, a fallback will be used and the real shader will be compiled in the background. Once the actual shader is compiled, it will be used the next times it's used to draw a frame.
|
||||
Depending on the [member SpatialMaterial.async_mode] mode configured for a given material, the fallback will be an "ubershader" (the default) or just skip rendering any item it is applied to. In custom [ShaderMaterial]s, the async mode is set using [code]render_mode async_visible;[/code] (default) or [code]render_mode async_hidden;[/code] at the top of the shader.
|
||||
Depending on the [member Material3D.async_mode] mode configured for a given material, the fallback will be an "ubershader" (the default) or just skip rendering any item it is applied to. In custom [ShaderMaterial]s, the async mode is set using [code]render_mode async_visible;[/code] (default) or [code]render_mode async_hidden;[/code] at the top of the shader.
|
||||
An ubershader is a very complex shader, slow but suited to any rendering situation, that the engine generates internally so it can be used from the beginning while the traditional conditioned, optimized version of it is being compiled.
|
||||
To reduce loading times after the project has been launched at least once, you can use [code]Asynchronous + Cache[/code]. This also causes the ubershaders to be cached into storage so they can be ready faster next time they are used (provided the platform provides support for it).
|
||||
[b]Note:[/b] Asynchronous compilation requires driver support for the [code]GL_ARB_get_program_binary[/code] OpenGL extension. This extension is supported by all hardware that supports OpenGL 4.1 or higher as well as most hardware that supports OpenGL 3.3 or higher.
|
||||
|
@ -1781,8 +1781,8 @@
|
|||
Lower-end override for [member rendering/quality/shading/force_lambert_over_burley] on mobile devices, due to performance concerns or driver support.
|
||||
</member>
|
||||
<member name="rendering/quality/shading/force_vertex_shading" type="bool" setter="" getter="" default="false">
|
||||
If [code]true[/code], forces vertex shading for all 3D [SpatialMaterial] and [ShaderMaterial] rendering. This can be used to improve performance on low-end mobile devices. The downside is that shading becomes much less accurate, with visible linear interpolation between vertices that are joined together. This can be compensated by ensuring meshes have a sufficient level of subdivision (but not too much, to avoid reducing performance). Some material features are also not supported when vertex shading is enabled.
|
||||
See also [member SpatialMaterial.flags_vertex_lighting] which can be used to enable vertex shading on specific materials only.
|
||||
If [code]true[/code], forces vertex shading for all 3D [Material3D] and [ShaderMaterial] rendering. This can be used to improve performance on low-end mobile devices. The downside is that shading becomes much less accurate, with visible linear interpolation between vertices that are joined together. This can be compensated by ensuring meshes have a sufficient level of subdivision (but not too much, to avoid reducing performance). Some material features are also not supported when vertex shading is enabled.
|
||||
See also [member Material3D.flags_vertex_lighting] which can be used to enable vertex shading on specific materials only.
|
||||
[b]Note:[/b] This setting does not affect unshaded materials.
|
||||
</member>
|
||||
<member name="rendering/quality/shading/force_vertex_shading.mobile" type="bool" setter="" getter="" default="true">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="SpatialMaterial" inherits="Material" version="3.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
||||
<class name="SpatialMaterial" inherits="Material3D" version="3.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
||||
<brief_description>
|
||||
Default 3D rendering material.
|
||||
Default 3D rendering material, based on [Material3D].
|
||||
</brief_description>
|
||||
<description>
|
||||
This provides a default material with a wide variety of rendering features and properties without the need to write shader code. See the tutorial below for details.
|
||||
|
@ -10,659 +10,7 @@
|
|||
<link>$DOCS_URL/tutorials/3d/spatial_material.html</link>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="get_feature" qualifiers="const">
|
||||
<return type="bool" />
|
||||
<argument index="0" name="feature" type="int" enum="SpatialMaterial.Feature" />
|
||||
<description>
|
||||
Returns [code]true[/code], if the specified [enum Feature] is enabled.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_flag" qualifiers="const">
|
||||
<return type="bool" />
|
||||
<argument index="0" name="flag" type="int" enum="SpatialMaterial.Flags" />
|
||||
<description>
|
||||
Returns [code]true[/code], if the specified flag is enabled. See [enum Flags] enumerator for options.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_texture" qualifiers="const">
|
||||
<return type="Texture" />
|
||||
<argument index="0" name="param" type="int" enum="SpatialMaterial.TextureParam" />
|
||||
<description>
|
||||
Returns the [Texture] associated with the specified [enum TextureParam].
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_feature">
|
||||
<return type="void" />
|
||||
<argument index="0" name="feature" type="int" enum="SpatialMaterial.Feature" />
|
||||
<argument index="1" name="enable" type="bool" />
|
||||
<description>
|
||||
If [code]true[/code], enables the specified [enum Feature]. Many features that are available in [SpatialMaterial]s need to be enabled before use. This way the cost for using the feature is only incurred when specified. Features can also be enabled by setting the corresponding member to [code]true[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_flag">
|
||||
<return type="void" />
|
||||
<argument index="0" name="flag" type="int" enum="SpatialMaterial.Flags" />
|
||||
<argument index="1" name="enable" type="bool" />
|
||||
<description>
|
||||
If [code]true[/code], enables the specified flag. Flags are optional behavior that can be turned on and off. Only one flag can be enabled at a time with this function, the flag enumerators cannot be bit-masked together to enable or disable multiple flags at once. Flags can also be enabled by setting the corresponding member to [code]true[/code]. See [enum Flags] enumerator for options.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_texture">
|
||||
<return type="void" />
|
||||
<argument index="0" name="param" type="int" enum="SpatialMaterial.TextureParam" />
|
||||
<argument index="1" name="texture" type="Texture" />
|
||||
<description>
|
||||
Sets the [Texture] to be used by the specified [enum TextureParam]. This function is called when setting members ending in [code]*_texture[/code].
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="albedo_color" type="Color" setter="set_albedo" getter="get_albedo" default="Color( 1, 1, 1, 1 )">
|
||||
The material's base color.
|
||||
</member>
|
||||
<member name="albedo_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture to multiply by [member albedo_color]. Used for basic texturing of objects.
|
||||
</member>
|
||||
<member name="anisotropy" type="float" setter="set_anisotropy" getter="get_anisotropy">
|
||||
The strength of the anisotropy effect. This is multiplied by [member anisotropy_flowmap]'s alpha channel if a texture is defined there and the texture contains an alpha channel.
|
||||
</member>
|
||||
<member name="anisotropy_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], anisotropy is enabled. Anisotropy changes the shape of the specular blob and aligns it to tangent space. This is useful for brushed aluminium and hair reflections.
|
||||
[b]Note:[/b] Mesh tangents are needed for anisotropy to work. If the mesh does not contain tangents, the anisotropy effect will appear broken.
|
||||
[b]Note:[/b] Material anisotropy should not to be confused with anisotropic texture filtering. Anisotropic texture filtering can be enabled by selecting a texture in the FileSystem dock, going to the Import dock, checking the [b]Anisotropic[/b] checkbox then clicking [b]Reimport[/b]. The anisotropic filtering level can be changed by adjusting [member ProjectSettings.rendering/quality/filters/anisotropic_filter_level].
|
||||
</member>
|
||||
<member name="anisotropy_flowmap" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture that offsets the tangent map for anisotropy calculations and optionally controls the anisotropy effect (if an alpha channel is present). The flowmap texture is expected to be a derivative map, with the red channel representing distortion on the X axis and green channel representing distortion on the Y axis. Values below 0.5 will result in negative distortion, whereas values above 0.5 will result in positive distortion.
|
||||
If present, the texture's alpha channel will be used to multiply the strength of the [member anisotropy] effect. Fully opaque pixels will keep the anisotropy effect's original strength while fully transparent pixels will disable the anisotropy effect entirely. The flowmap texture's blue channel is ignored.
|
||||
</member>
|
||||
<member name="ao_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], ambient occlusion is enabled. Ambient occlusion darkens areas based on the [member ao_texture].
|
||||
</member>
|
||||
<member name="ao_light_affect" type="float" setter="set_ao_light_affect" getter="get_ao_light_affect">
|
||||
Amount that ambient occlusion affects lighting from lights. If [code]0[/code], ambient occlusion only affects ambient light. If [code]1[/code], ambient occlusion affects lights just as much as it affects ambient light. This can be used to impact the strength of the ambient occlusion effect, but typically looks unrealistic.
|
||||
</member>
|
||||
<member name="ao_on_uv2" type="bool" setter="set_flag" getter="get_flag">
|
||||
If [code]true[/code], use [code]UV2[/code] coordinates to look up from the [member ao_texture].
|
||||
</member>
|
||||
<member name="ao_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture that defines the amount of ambient occlusion for a given point on the object.
|
||||
</member>
|
||||
<member name="ao_texture_channel" type="int" setter="set_ao_texture_channel" getter="get_ao_texture_channel" enum="SpatialMaterial.TextureChannel">
|
||||
Specifies the channel of the [member ao_texture] in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
|
||||
</member>
|
||||
<member name="async_mode" type="int" setter="set_async_mode" getter="get_async_mode" enum="SpatialMaterial.AsyncMode" default="0">
|
||||
If [member ProjectSettings.rendering/gles3/shaders/shader_compilation_mode] is [code]Synchronous[/code] (with or without cache), this determines how this material must behave in regards to asynchronous shader compilation.
|
||||
[constant ASYNC_MODE_VISIBLE] is the default and the best for most cases.
|
||||
</member>
|
||||
<member name="clearcoat" type="float" setter="set_clearcoat" getter="get_clearcoat">
|
||||
Sets the strength of the clearcoat effect. Setting to [code]0[/code] looks the same as disabling the clearcoat effect.
|
||||
</member>
|
||||
<member name="clearcoat_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], clearcoat rendering is enabled. Adds a secondary transparent pass to the lighting calculation resulting in an added specular blob. This makes materials appear as if they have a clear layer on them that can be either glossy or rough.
|
||||
[b]Note:[/b] Clearcoat rendering is not visible if the material has [member flags_unshaded] set to [code]true[/code].
|
||||
</member>
|
||||
<member name="clearcoat_gloss" type="float" setter="set_clearcoat_gloss" getter="get_clearcoat_gloss">
|
||||
Sets the roughness of the clearcoat pass. A higher value results in a smoother clearcoat while a lower value results in a rougher clearcoat.
|
||||
</member>
|
||||
<member name="clearcoat_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture that defines the strength of the clearcoat effect and the glossiness of the clearcoat. Strength is specified in the red channel while glossiness is specified in the green channel.
|
||||
</member>
|
||||
<member name="depth_deep_parallax" type="bool" setter="set_depth_deep_parallax" getter="is_depth_deep_parallax_enabled">
|
||||
If [code]true[/code], the shader will read depth texture at multiple points along the view ray to determine occlusion and parrallax. This can be very performance demanding, but results in more realistic looking depth mapping.
|
||||
</member>
|
||||
<member name="depth_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], depth mapping is enabled (also called "parallax mapping" or "height mapping"). See also [member normal_enabled].
|
||||
[b]Note:[/b] Depth mapping is not supported if triplanar mapping is used on the same material. The value of [member depth_enabled] will be ignored if [member uv1_triplanar] is enabled.
|
||||
</member>
|
||||
<member name="depth_flip_binormal" type="bool" setter="set_depth_deep_parallax_flip_binormal" getter="get_depth_deep_parallax_flip_binormal">
|
||||
If [code]true[/code], direction of the binormal is flipped before using in the depth effect. This may be necessary if you have encoded your binormals in a way that is conflicting with the depth effect.
|
||||
</member>
|
||||
<member name="depth_flip_tangent" type="bool" setter="set_depth_deep_parallax_flip_tangent" getter="get_depth_deep_parallax_flip_tangent">
|
||||
If [code]true[/code], direction of the tangent is flipped before using in the depth effect. This may be necessary if you have encoded your tangents in a way that is conflicting with the depth effect.
|
||||
</member>
|
||||
<member name="depth_max_layers" type="int" setter="set_depth_deep_parallax_max_layers" getter="get_depth_deep_parallax_max_layers">
|
||||
Number of layers to use when using [member depth_deep_parallax] and the view direction is perpendicular to the surface of the object. A higher number will be more performance demanding while a lower number may not look as crisp.
|
||||
</member>
|
||||
<member name="depth_min_layers" type="int" setter="set_depth_deep_parallax_min_layers" getter="get_depth_deep_parallax_min_layers">
|
||||
Number of layers to use when using [member depth_deep_parallax] and the view direction is parallel to the surface of the object. A higher number will be more performance demanding while a lower number may not look as crisp.
|
||||
</member>
|
||||
<member name="depth_scale" type="float" setter="set_depth_scale" getter="get_depth_scale">
|
||||
Scales the depth offset effect. A higher number will create a larger depth.
|
||||
</member>
|
||||
<member name="depth_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture used to determine depth at a given pixel. Depth is always stored in the red channel.
|
||||
</member>
|
||||
<member name="detail_albedo" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture that specifies the color of the detail overlay.
|
||||
</member>
|
||||
<member name="detail_blend_mode" type="int" setter="set_detail_blend_mode" getter="get_detail_blend_mode" enum="SpatialMaterial.BlendMode">
|
||||
Specifies how the [member detail_albedo] should blend with the current [code]ALBEDO[/code]. See [enum BlendMode] for options.
|
||||
</member>
|
||||
<member name="detail_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], enables the detail overlay. Detail is a second texture that gets mixed over the surface of the object based on [member detail_mask]. This can be used to add variation to objects, or to blend between two different albedo/normal textures.
|
||||
</member>
|
||||
<member name="detail_mask" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture used to specify how the detail textures get blended with the base textures.
|
||||
</member>
|
||||
<member name="detail_normal" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture that specifies the per-pixel normal of the detail overlay.
|
||||
[b]Note:[/b] Godot expects the normal map to use X+, Y+, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines.
|
||||
</member>
|
||||
<member name="detail_uv_layer" type="int" setter="set_detail_uv" getter="get_detail_uv" enum="SpatialMaterial.DetailUV">
|
||||
Specifies whether to use [code]UV[/code] or [code]UV2[/code] for the detail layer. See [enum DetailUV] for options.
|
||||
</member>
|
||||
<member name="distance_fade_max_distance" type="float" setter="set_distance_fade_max_distance" getter="get_distance_fade_max_distance">
|
||||
Distance at which the object appears fully opaque.
|
||||
[b]Note:[/b] If [code]distance_fade_max_distance[/code] is less than [code]distance_fade_min_distance[/code], the behavior will be reversed. The object will start to fade away at [code]distance_fade_max_distance[/code] and will fully disappear once it reaches [code]distance_fade_min_distance[/code].
|
||||
</member>
|
||||
<member name="distance_fade_min_distance" type="float" setter="set_distance_fade_min_distance" getter="get_distance_fade_min_distance">
|
||||
Distance at which the object starts to become visible. If the object is less than this distance away, it will be invisible.
|
||||
[b]Note:[/b] If [code]distance_fade_min_distance[/code] is greater than [code]distance_fade_max_distance[/code], the behavior will be reversed. The object will start to fade away at [code]distance_fade_max_distance[/code] and will fully disappear once it reaches [code]distance_fade_min_distance[/code].
|
||||
</member>
|
||||
<member name="distance_fade_mode" type="int" setter="set_distance_fade" getter="get_distance_fade" enum="SpatialMaterial.DistanceFadeMode" default="0">
|
||||
Specifies which type of fade to use. Can be any of the [enum DistanceFadeMode]s.
|
||||
</member>
|
||||
<member name="emission" type="Color" setter="set_emission" getter="get_emission">
|
||||
The emitted light's color. See [member emission_enabled].
|
||||
</member>
|
||||
<member name="emission_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], the body emits light. Emitting light makes the object appear brighter. The object can also cast light on other objects if a [GIProbe] or [BakedLightmap] is used and this object is used in baked lighting.
|
||||
</member>
|
||||
<member name="emission_energy" type="float" setter="set_emission_energy" getter="get_emission_energy">
|
||||
The emitted light's strength. See [member emission_enabled].
|
||||
</member>
|
||||
<member name="emission_on_uv2" type="bool" setter="set_flag" getter="get_flag">
|
||||
Use [code]UV2[/code] to read from the [member emission_texture].
|
||||
</member>
|
||||
<member name="emission_operator" type="int" setter="set_emission_operator" getter="get_emission_operator" enum="SpatialMaterial.EmissionOperator">
|
||||
Sets how [member emission] interacts with [member emission_texture]. Can either add or multiply. See [enum EmissionOperator] for options.
|
||||
</member>
|
||||
<member name="emission_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture that specifies how much surface emits light at a given point.
|
||||
</member>
|
||||
<member name="flags_albedo_tex_force_srgb" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
Forces a conversion of the [member albedo_texture] from sRGB space to linear space.
|
||||
</member>
|
||||
<member name="flags_albedo_tex_msdf" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
Enables signed distance field rendering shader.
|
||||
</member>
|
||||
<member name="flags_disable_ambient_light" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], the object receives no ambient light.
|
||||
</member>
|
||||
<member name="flags_do_not_receive_shadows" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], the object receives no shadow that would otherwise be cast onto it.
|
||||
</member>
|
||||
<member name="flags_ensure_correct_normals" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], the shader will compute extra operations to make sure the normal stays correct when using a non-uniform scale. Only enable if using non-uniform scaling.
|
||||
</member>
|
||||
<member name="flags_fixed_size" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], the object is rendered at the same size regardless of distance.
|
||||
</member>
|
||||
<member name="flags_no_depth_test" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], depth testing is disabled and the object will be drawn in render order.
|
||||
</member>
|
||||
<member name="flags_transparent" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], transparency is enabled on the body. See also [member params_blend_mode].
|
||||
</member>
|
||||
<member name="flags_unshaded" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], the object is unaffected by lighting.
|
||||
</member>
|
||||
<member name="flags_use_point_size" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], render point size can be changed.
|
||||
[b]Note:[/b] This is only effective for objects whose geometry is point-based rather than triangle-based. See also [member params_point_size].
|
||||
</member>
|
||||
<member name="flags_use_shadow_to_opacity" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], enables the "shadow to opacity" render mode where lighting modifies the alpha so shadowed areas are opaque and non-shadowed areas are transparent. Useful for overlaying shadows onto a camera feed in AR.
|
||||
</member>
|
||||
<member name="flags_vertex_lighting" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], lighting is calculated per vertex rather than per pixel. This may increase performance on low-end devices, especially for meshes with a lower polygon count. The downside is that shading becomes much less accurate, with visible linear interpolation between vertices that are joined together. This can be compensated by ensuring meshes have a sufficient level of subdivision (but not too much, to avoid reducing performance). Some material features are also not supported when vertex shading is enabled.
|
||||
See also [member ProjectSettings.rendering/quality/shading/force_vertex_shading] which can globally enable vertex shading on all materials.
|
||||
[b]Note:[/b] By default, vertex shading is enforced on mobile platforms by [member ProjectSettings.rendering/quality/shading/force_vertex_shading]'s [code]mobile[/code] override.
|
||||
[b]Note:[/b] [member flags_vertex_lighting] has no effect if [member flags_unshaded] is [code]true[/code].
|
||||
</member>
|
||||
<member name="flags_world_triplanar" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], triplanar mapping is calculated in world space rather than object local space. See also [member uv1_triplanar].
|
||||
</member>
|
||||
<member name="metallic" type="float" setter="set_metallic" getter="get_metallic" default="0.0">
|
||||
A high value makes the material appear more like a metal. Non-metals use their albedo as the diffuse color and add diffuse to the specular reflection. With non-metals, the reflection appears on top of the albedo color. Metals use their albedo as a multiplier to the specular reflection and set the diffuse color to black resulting in a tinted reflection. Materials work better when fully metal or fully non-metal, values between [code]0[/code] and [code]1[/code] should only be used for blending between metal and non-metal sections. To alter the amount of reflection use [member roughness].
|
||||
</member>
|
||||
<member name="metallic_specular" type="float" setter="set_specular" getter="get_specular" default="0.5">
|
||||
Sets the size of the specular lobe. The specular lobe is the bright spot that is reflected from light sources.
|
||||
[b]Note:[/b] Unlike [member metallic], this is not energy-conserving, so it should be left at [code]0.5[/code] in most cases. See also [member roughness].
|
||||
</member>
|
||||
<member name="metallic_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture used to specify metallic for an object. This is multiplied by [member metallic].
|
||||
</member>
|
||||
<member name="metallic_texture_channel" type="int" setter="set_metallic_texture_channel" getter="get_metallic_texture_channel" enum="SpatialMaterial.TextureChannel" default="0">
|
||||
Specifies the channel of the [member metallic_texture] in which the metallic information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
|
||||
</member>
|
||||
<member name="normal_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], normal mapping is enabled.
|
||||
</member>
|
||||
<member name="normal_scale" type="float" setter="set_normal_scale" getter="get_normal_scale">
|
||||
The strength of the normal map's effect.
|
||||
</member>
|
||||
<member name="normal_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture used to specify the normal at a given pixel. The [code]normal_texture[/code] only uses the red and green channels; the blue and alpha channels are ignored. The normal read from [code]normal_texture[/code] is oriented around the surface normal provided by the [Mesh].
|
||||
[b]Note:[/b] The mesh must have both normals and tangents defined in its vertex data. Otherwise, the normal map won't render correctly and will only appear to darken the whole surface. If creating geometry with [SurfaceTool], you can use [method SurfaceTool.generate_normals] and [method SurfaceTool.generate_tangents] to automatically generate normals and tangents respectively.
|
||||
[b]Note:[/b] Godot expects the normal map to use X+, Y+, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines.
|
||||
</member>
|
||||
<member name="params_alpha_scissor_threshold" type="float" setter="set_alpha_scissor_threshold" getter="get_alpha_scissor_threshold">
|
||||
Threshold at which the alpha scissor will discard values.
|
||||
</member>
|
||||
<member name="params_billboard_keep_scale" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], the shader will keep the scale set for the mesh. Otherwise the scale is lost when billboarding. Only applies when [member params_billboard_mode] is [constant BILLBOARD_ENABLED].
|
||||
</member>
|
||||
<member name="params_billboard_mode" type="int" setter="set_billboard_mode" getter="get_billboard_mode" enum="SpatialMaterial.BillboardMode" default="0">
|
||||
Controls how the object faces the camera. See [enum BillboardMode].
|
||||
[b]Note:[/b] Billboard mode is not suitable for VR because the left-right vector of the camera is not horizontal when the screen is attached to your head instead of on the table. See [url=https://github.com/godotengine/godot/issues/41567]GitHub issue #41567[/url] for details.
|
||||
</member>
|
||||
<member name="params_blend_mode" type="int" setter="set_blend_mode" getter="get_blend_mode" enum="SpatialMaterial.BlendMode" default="0">
|
||||
The material's blend mode.
|
||||
[b]Note:[/b] Values other than [code]Mix[/code] force the object into the transparent pipeline. See [enum BlendMode].
|
||||
</member>
|
||||
<member name="params_cull_mode" type="int" setter="set_cull_mode" getter="get_cull_mode" enum="SpatialMaterial.CullMode" default="0">
|
||||
Which side of the object is not drawn when backfaces are rendered. See [enum CullMode].
|
||||
</member>
|
||||
<member name="params_depth_draw_mode" type="int" setter="set_depth_draw_mode" getter="get_depth_draw_mode" enum="SpatialMaterial.DepthDrawMode" default="0">
|
||||
Determines when depth rendering takes place. See [enum DepthDrawMode]. See also [member flags_transparent].
|
||||
</member>
|
||||
<member name="params_diffuse_mode" type="int" setter="set_diffuse_mode" getter="get_diffuse_mode" enum="SpatialMaterial.DiffuseMode" default="0">
|
||||
The algorithm used for diffuse light scattering. See [enum DiffuseMode].
|
||||
</member>
|
||||
<member name="params_grow" type="bool" setter="set_grow_enabled" getter="is_grow_enabled" default="false">
|
||||
If [code]true[/code], enables the vertex grow setting. See [member params_grow_amount].
|
||||
</member>
|
||||
<member name="params_grow_amount" type="float" setter="set_grow" getter="get_grow">
|
||||
Grows object vertices in the direction of their normals.
|
||||
</member>
|
||||
<member name="params_line_width" type="float" setter="set_line_width" getter="get_line_width" default="1.0">
|
||||
Currently unimplemented in Godot.
|
||||
</member>
|
||||
<member name="params_point_size" type="float" setter="set_point_size" getter="get_point_size" default="1.0">
|
||||
The point size in pixels. See [member flags_use_point_size].
|
||||
</member>
|
||||
<member name="params_specular_mode" type="int" setter="set_specular_mode" getter="get_specular_mode" enum="SpatialMaterial.SpecularMode" default="0">
|
||||
The method for rendering the specular blob. See [enum SpecularMode].
|
||||
</member>
|
||||
<member name="params_use_alpha_scissor" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], the shader will discard all pixels that have an alpha value less than [member params_alpha_scissor_threshold].
|
||||
</member>
|
||||
<member name="particles_anim_h_frames" type="int" setter="set_particles_anim_h_frames" getter="get_particles_anim_h_frames">
|
||||
The number of horizontal frames in the particle sprite sheet. Only enabled when using [constant BILLBOARD_PARTICLES]. See [member params_billboard_mode].
|
||||
</member>
|
||||
<member name="particles_anim_loop" type="bool" setter="set_particles_anim_loop" getter="get_particles_anim_loop">
|
||||
If [code]true[/code], particle animations are looped. Only enabled when using [constant BILLBOARD_PARTICLES]. See [member params_billboard_mode].
|
||||
</member>
|
||||
<member name="particles_anim_v_frames" type="int" setter="set_particles_anim_v_frames" getter="get_particles_anim_v_frames">
|
||||
The number of vertical frames in the particle sprite sheet. Only enabled when using [constant BILLBOARD_PARTICLES]. See [member params_billboard_mode].
|
||||
</member>
|
||||
<member name="proximity_fade_distance" type="float" setter="set_proximity_fade_distance" getter="get_proximity_fade_distance">
|
||||
Distance over which the fade effect takes place. The larger the distance the longer it takes for an object to fade.
|
||||
</member>
|
||||
<member name="proximity_fade_enable" type="bool" setter="set_proximity_fade" getter="is_proximity_fade_enabled" default="false">
|
||||
If [code]true[/code], the proximity fade effect is enabled. The proximity fade effect fades out each pixel based on its distance to another object.
|
||||
</member>
|
||||
<member name="refraction_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], the refraction effect is enabled. Refraction distorts transparency based on light from behind the object. When using the GLES3 backend, the material's roughness value will affect the blurriness of the refraction. Higher roughness values will make the refraction look blurrier.
|
||||
</member>
|
||||
<member name="refraction_scale" type="float" setter="set_refraction" getter="get_refraction">
|
||||
The strength of the refraction effect. Higher values result in a more distorted appearance for the refraction.
|
||||
</member>
|
||||
<member name="refraction_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture that controls the strength of the refraction per-pixel. Multiplied by [member refraction_scale].
|
||||
</member>
|
||||
<member name="refraction_texture_channel" type="int" setter="set_refraction_texture_channel" getter="get_refraction_texture_channel" enum="SpatialMaterial.TextureChannel">
|
||||
Specifies the channel of the [member refraction_texture] in which the refraction information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
|
||||
</member>
|
||||
<member name="rim" type="float" setter="set_rim" getter="get_rim">
|
||||
Sets the strength of the rim lighting effect.
|
||||
</member>
|
||||
<member name="rim_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], rim effect is enabled. Rim lighting increases the brightness at glancing angles on an object.
|
||||
[b]Note:[/b] Rim lighting is not visible if the material has [member flags_unshaded] set to [code]true[/code].
|
||||
</member>
|
||||
<member name="rim_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture used to set the strength of the rim lighting effect per-pixel. Multiplied by [member rim].
|
||||
</member>
|
||||
<member name="rim_tint" type="float" setter="set_rim_tint" getter="get_rim_tint">
|
||||
The amount of to blend light and albedo color when rendering rim effect. If [code]0[/code] the light color is used, while [code]1[/code] means albedo color is used. An intermediate value generally works best.
|
||||
</member>
|
||||
<member name="roughness" type="float" setter="set_roughness" getter="get_roughness" default="1.0">
|
||||
Surface reflection. A value of [code]0[/code] represents a perfect mirror while a value of [code]1[/code] completely blurs the reflection. See also [member metallic].
|
||||
</member>
|
||||
<member name="roughness_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture used to control the roughness per-pixel. Multiplied by [member roughness].
|
||||
</member>
|
||||
<member name="roughness_texture_channel" type="int" setter="set_roughness_texture_channel" getter="get_roughness_texture_channel" enum="SpatialMaterial.TextureChannel" default="0">
|
||||
Specifies the channel of the [member ao_texture] in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
|
||||
</member>
|
||||
<member name="subsurf_scatter_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], subsurface scattering is enabled. Emulates light that penetrates an object's surface, is scattered, and then emerges.
|
||||
</member>
|
||||
<member name="subsurf_scatter_strength" type="float" setter="set_subsurface_scattering_strength" getter="get_subsurface_scattering_strength">
|
||||
The strength of the subsurface scattering effect.
|
||||
</member>
|
||||
<member name="subsurf_scatter_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture used to control the subsurface scattering strength. Stored in the red texture channel. Multiplied by [member subsurf_scatter_strength].
|
||||
</member>
|
||||
<member name="transmission" type="Color" setter="set_transmission" getter="get_transmission">
|
||||
The color used by the transmission effect. Represents the light passing through an object.
|
||||
</member>
|
||||
<member name="transmission_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
|
||||
If [code]true[/code], the transmission effect is enabled.
|
||||
</member>
|
||||
<member name="transmission_texture" type="Texture" setter="set_texture" getter="get_texture">
|
||||
Texture used to control the transmission effect per-pixel. Added to [member transmission].
|
||||
</member>
|
||||
<member name="uv1_offset" type="Vector3" setter="set_uv1_offset" getter="get_uv1_offset" default="Vector3( 0, 0, 0 )">
|
||||
How much to offset the [code]UV[/code] coordinates. This amount will be added to [code]UV[/code] in the vertex function. This can be used to offset a texture.
|
||||
</member>
|
||||
<member name="uv1_scale" type="Vector3" setter="set_uv1_scale" getter="get_uv1_scale" default="Vector3( 1, 1, 1 )">
|
||||
How much to scale the [code]UV[/code] coordinates. This is multiplied by [code]UV[/code] in the vertex function.
|
||||
</member>
|
||||
<member name="uv1_triplanar" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], instead of using [code]UV[/code] textures will use a triplanar texture lookup to determine how to apply textures. Triplanar uses the orientation of the object's surface to blend between texture coordinates. It reads from the source texture 3 times, once for each axis and then blends between the results based on how closely the pixel aligns with each axis. This is often used for natural features to get a realistic blend of materials. Because triplanar texturing requires many more texture reads per-pixel it is much slower than normal UV texturing. Additionally, because it is blending the texture between the three axes, it is unsuitable when you are trying to achieve crisp texturing.
|
||||
</member>
|
||||
<member name="uv1_triplanar_sharpness" type="float" setter="set_uv1_triplanar_blend_sharpness" getter="get_uv1_triplanar_blend_sharpness">
|
||||
A lower number blends the texture more softly while a higher number blends the texture more sharply.
|
||||
[b]Note:[/b] [member uv1_triplanar_sharpness] is clamped between [code]0.0[/code] and [code]150.0[/code] (inclusive) as values outside that range can look broken depending on the mesh.
|
||||
</member>
|
||||
<member name="uv2_offset" type="Vector3" setter="set_uv2_offset" getter="get_uv2_offset" default="Vector3( 0, 0, 0 )">
|
||||
How much to offset the [code]UV2[/code] coordinates. This amount will be added to [code]UV2[/code] in the vertex function. This can be used to offset a texture.
|
||||
</member>
|
||||
<member name="uv2_scale" type="Vector3" setter="set_uv2_scale" getter="get_uv2_scale" default="Vector3( 1, 1, 1 )">
|
||||
How much to scale the [code]UV2[/code] coordinates. This is multiplied by [code]UV2[/code] in the vertex function.
|
||||
</member>
|
||||
<member name="uv2_triplanar" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], instead of using [code]UV2[/code] textures will use a triplanar texture lookup to determine how to apply textures. Triplanar uses the orientation of the object's surface to blend between texture coordinates. It reads from the source texture 3 times, once for each axis and then blends between the results based on how closely the pixel aligns with each axis. This is often used for natural features to get a realistic blend of materials. Because triplanar texturing requires many more texture reads per-pixel it is much slower than normal UV texturing. Additionally, because it is blending the texture between the three axes, it is unsuitable when you are trying to achieve crisp texturing.
|
||||
</member>
|
||||
<member name="uv2_triplanar_sharpness" type="float" setter="set_uv2_triplanar_blend_sharpness" getter="get_uv2_triplanar_blend_sharpness">
|
||||
A lower number blends the texture more softly while a higher number blends the texture more sharply.
|
||||
[b]Note:[/b] [member uv2_triplanar_sharpness] is clamped between [code]0.0[/code] and [code]150.0[/code] (inclusive) as values outside that range can look broken depending on the mesh.
|
||||
</member>
|
||||
<member name="vertex_color_is_srgb" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], the model's vertex colors are processed as sRGB mode.
|
||||
</member>
|
||||
<member name="vertex_color_use_as_albedo" type="bool" setter="set_flag" getter="get_flag" default="false">
|
||||
If [code]true[/code], the vertex color is used as albedo color.
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
<constant name="TEXTURE_ALBEDO" value="0" enum="TextureParam">
|
||||
Texture specifying per-pixel color.
|
||||
</constant>
|
||||
<constant name="TEXTURE_METALLIC" value="1" enum="TextureParam">
|
||||
Texture specifying per-pixel metallic value.
|
||||
</constant>
|
||||
<constant name="TEXTURE_ROUGHNESS" value="2" enum="TextureParam">
|
||||
Texture specifying per-pixel roughness value.
|
||||
</constant>
|
||||
<constant name="TEXTURE_EMISSION" value="3" enum="TextureParam">
|
||||
Texture specifying per-pixel emission color.
|
||||
</constant>
|
||||
<constant name="TEXTURE_NORMAL" value="4" enum="TextureParam">
|
||||
Texture specifying per-pixel normal vector.
|
||||
</constant>
|
||||
<constant name="TEXTURE_RIM" value="5" enum="TextureParam">
|
||||
Texture specifying per-pixel rim value.
|
||||
</constant>
|
||||
<constant name="TEXTURE_CLEARCOAT" value="6" enum="TextureParam">
|
||||
Texture specifying per-pixel clearcoat value.
|
||||
</constant>
|
||||
<constant name="TEXTURE_FLOWMAP" value="7" enum="TextureParam">
|
||||
Texture specifying per-pixel flowmap direction for use with [member anisotropy].
|
||||
</constant>
|
||||
<constant name="TEXTURE_AMBIENT_OCCLUSION" value="8" enum="TextureParam">
|
||||
Texture specifying per-pixel ambient occlusion value.
|
||||
</constant>
|
||||
<constant name="TEXTURE_DEPTH" value="9" enum="TextureParam">
|
||||
Texture specifying per-pixel depth.
|
||||
</constant>
|
||||
<constant name="TEXTURE_SUBSURFACE_SCATTERING" value="10" enum="TextureParam">
|
||||
Texture specifying per-pixel subsurface scattering.
|
||||
</constant>
|
||||
<constant name="TEXTURE_TRANSMISSION" value="11" enum="TextureParam">
|
||||
Texture specifying per-pixel transmission color.
|
||||
</constant>
|
||||
<constant name="TEXTURE_REFRACTION" value="12" enum="TextureParam">
|
||||
Texture specifying per-pixel refraction strength.
|
||||
</constant>
|
||||
<constant name="TEXTURE_DETAIL_MASK" value="13" enum="TextureParam">
|
||||
Texture specifying per-pixel detail mask blending value.
|
||||
</constant>
|
||||
<constant name="TEXTURE_DETAIL_ALBEDO" value="14" enum="TextureParam">
|
||||
Texture specifying per-pixel detail color.
|
||||
</constant>
|
||||
<constant name="TEXTURE_DETAIL_NORMAL" value="15" enum="TextureParam">
|
||||
Texture specifying per-pixel detail normal.
|
||||
</constant>
|
||||
<constant name="TEXTURE_MAX" value="16" enum="TextureParam">
|
||||
Represents the size of the [enum TextureParam] enum.
|
||||
</constant>
|
||||
<constant name="DETAIL_UV_1" value="0" enum="DetailUV">
|
||||
Use [code]UV[/code] with the detail texture.
|
||||
</constant>
|
||||
<constant name="DETAIL_UV_2" value="1" enum="DetailUV">
|
||||
Use [code]UV2[/code] with the detail texture.
|
||||
</constant>
|
||||
<constant name="FEATURE_TRANSPARENT" value="0" enum="Feature">
|
||||
Constant for setting [member flags_transparent].
|
||||
</constant>
|
||||
<constant name="FEATURE_EMISSION" value="1" enum="Feature">
|
||||
Constant for setting [member emission_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_NORMAL_MAPPING" value="2" enum="Feature">
|
||||
Constant for setting [member normal_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_RIM" value="3" enum="Feature">
|
||||
Constant for setting [member rim_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_CLEARCOAT" value="4" enum="Feature">
|
||||
Constant for setting [member clearcoat_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_ANISOTROPY" value="5" enum="Feature">
|
||||
Constant for setting [member anisotropy_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_AMBIENT_OCCLUSION" value="6" enum="Feature">
|
||||
Constant for setting [member ao_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_DEPTH_MAPPING" value="7" enum="Feature">
|
||||
Constant for setting [member depth_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_SUBSURACE_SCATTERING" value="8" enum="Feature">
|
||||
Constant for setting [member subsurf_scatter_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_TRANSMISSION" value="9" enum="Feature">
|
||||
Constant for setting [member transmission_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_REFRACTION" value="10" enum="Feature">
|
||||
Constant for setting [member refraction_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_DETAIL" value="11" enum="Feature">
|
||||
Constant for setting [member detail_enabled].
|
||||
</constant>
|
||||
<constant name="FEATURE_MAX" value="12" enum="Feature">
|
||||
Represents the size of the [enum Feature] enum.
|
||||
</constant>
|
||||
<constant name="BLEND_MODE_MIX" value="0" enum="BlendMode">
|
||||
Default blend mode. The color of the object is blended over the background based on the object's alpha value.
|
||||
</constant>
|
||||
<constant name="BLEND_MODE_ADD" value="1" enum="BlendMode">
|
||||
The color of the object is added to the background.
|
||||
</constant>
|
||||
<constant name="BLEND_MODE_SUB" value="2" enum="BlendMode">
|
||||
The color of the object is subtracted from the background.
|
||||
</constant>
|
||||
<constant name="BLEND_MODE_MUL" value="3" enum="BlendMode">
|
||||
The color of the object is multiplied by the background.
|
||||
</constant>
|
||||
<constant name="DEPTH_DRAW_OPAQUE_ONLY" value="0" enum="DepthDrawMode">
|
||||
Default depth draw mode. Depth is drawn only for opaque objects.
|
||||
</constant>
|
||||
<constant name="DEPTH_DRAW_ALWAYS" value="1" enum="DepthDrawMode">
|
||||
Depth draw is calculated for both opaque and transparent objects.
|
||||
</constant>
|
||||
<constant name="DEPTH_DRAW_DISABLED" value="2" enum="DepthDrawMode">
|
||||
No depth draw.
|
||||
</constant>
|
||||
<constant name="DEPTH_DRAW_ALPHA_OPAQUE_PREPASS" value="3" enum="DepthDrawMode">
|
||||
For transparent objects, an opaque pass is made first with the opaque parts, then transparency is drawn.
|
||||
</constant>
|
||||
<constant name="CULL_BACK" value="0" enum="CullMode">
|
||||
Default cull mode. The back of the object is culled when not visible.
|
||||
</constant>
|
||||
<constant name="CULL_FRONT" value="1" enum="CullMode">
|
||||
The front of the object is culled when not visible.
|
||||
</constant>
|
||||
<constant name="CULL_DISABLED" value="2" enum="CullMode">
|
||||
No culling is performed.
|
||||
</constant>
|
||||
<constant name="FLAG_UNSHADED" value="0" enum="Flags">
|
||||
No lighting is used on the object. Color comes directly from [code]ALBEDO[/code].
|
||||
</constant>
|
||||
<constant name="FLAG_USE_VERTEX_LIGHTING" value="1" enum="Flags">
|
||||
Lighting is calculated per-vertex rather than per-pixel. This can be used to increase the speed of the shader at the cost of quality.
|
||||
</constant>
|
||||
<constant name="FLAG_DISABLE_DEPTH_TEST" value="2" enum="Flags">
|
||||
Disables the depth test, so this object is drawn on top of all others. However, objects drawn after it in the draw order may cover it.
|
||||
</constant>
|
||||
<constant name="FLAG_ALBEDO_FROM_VERTEX_COLOR" value="3" enum="Flags">
|
||||
Set [code]ALBEDO[/code] to the per-vertex color specified in the mesh.
|
||||
</constant>
|
||||
<constant name="FLAG_SRGB_VERTEX_COLOR" value="4" enum="Flags">
|
||||
Vertex color is in sRGB space and needs to be converted to linear. Only applies in the GLES3 renderer.
|
||||
</constant>
|
||||
<constant name="FLAG_USE_POINT_SIZE" value="5" enum="Flags">
|
||||
Uses point size to alter the size of primitive points. Also changes the albedo texture lookup to use [code]POINT_COORD[/code] instead of [code]UV[/code].
|
||||
</constant>
|
||||
<constant name="FLAG_FIXED_SIZE" value="6" enum="Flags">
|
||||
Object is scaled by depth so that it always appears the same size on screen.
|
||||
</constant>
|
||||
<constant name="FLAG_BILLBOARD_KEEP_SCALE" value="7" enum="Flags">
|
||||
Shader will keep the scale set for the mesh. Otherwise the scale is lost when billboarding. Only applies when [member params_billboard_mode] is [constant BILLBOARD_ENABLED].
|
||||
</constant>
|
||||
<constant name="FLAG_UV1_USE_TRIPLANAR" value="8" enum="Flags">
|
||||
Use triplanar texture lookup for all texture lookups that would normally use [code]UV[/code].
|
||||
</constant>
|
||||
<constant name="FLAG_UV2_USE_TRIPLANAR" value="9" enum="Flags">
|
||||
Use triplanar texture lookup for all texture lookups that would normally use [code]UV2[/code].
|
||||
</constant>
|
||||
<constant name="FLAG_AO_ON_UV2" value="11" enum="Flags">
|
||||
Use [code]UV2[/code] coordinates to look up from the [member ao_texture].
|
||||
</constant>
|
||||
<constant name="FLAG_EMISSION_ON_UV2" value="12" enum="Flags">
|
||||
Use [code]UV2[/code] coordinates to look up from the [member emission_texture].
|
||||
</constant>
|
||||
<constant name="FLAG_USE_ALPHA_SCISSOR" value="13" enum="Flags">
|
||||
Use alpha scissor. Set by [member params_use_alpha_scissor].
|
||||
</constant>
|
||||
<constant name="FLAG_TRIPLANAR_USE_WORLD" value="10" enum="Flags">
|
||||
Use world coordinates in the triplanar texture lookup instead of local coordinates.
|
||||
</constant>
|
||||
<constant name="FLAG_ALBEDO_TEXTURE_FORCE_SRGB" value="14" enum="Flags">
|
||||
Forces the shader to convert albedo from sRGB space to linear space.
|
||||
</constant>
|
||||
<constant name="FLAG_DONT_RECEIVE_SHADOWS" value="15" enum="Flags">
|
||||
Disables receiving shadows from other objects.
|
||||
</constant>
|
||||
<constant name="FLAG_DISABLE_AMBIENT_LIGHT" value="17" enum="Flags">
|
||||
Disables receiving ambient light.
|
||||
</constant>
|
||||
<constant name="FLAG_ENSURE_CORRECT_NORMALS" value="16" enum="Flags">
|
||||
Ensures that normals appear correct, even with non-uniform scaling.
|
||||
</constant>
|
||||
<constant name="FLAG_USE_SHADOW_TO_OPACITY" value="18" enum="Flags">
|
||||
Enables the shadow to opacity feature.
|
||||
</constant>
|
||||
<constant name="FLAG_ALBEDO_TEXTURE_SDF" value="19" enum="Flags">
|
||||
Enables signed distance field rendering shader.
|
||||
</constant>
|
||||
<constant name="FLAG_MAX" value="20" enum="Flags">
|
||||
Represents the size of the [enum Flags] enum.
|
||||
</constant>
|
||||
<constant name="DIFFUSE_BURLEY" value="0" enum="DiffuseMode">
|
||||
Default diffuse scattering algorithm.
|
||||
</constant>
|
||||
<constant name="DIFFUSE_LAMBERT" value="1" enum="DiffuseMode">
|
||||
Diffuse scattering ignores roughness.
|
||||
</constant>
|
||||
<constant name="DIFFUSE_LAMBERT_WRAP" value="2" enum="DiffuseMode">
|
||||
Extends Lambert to cover more than 90 degrees when roughness increases.
|
||||
</constant>
|
||||
<constant name="DIFFUSE_OREN_NAYAR" value="3" enum="DiffuseMode">
|
||||
Attempts to use roughness to emulate microsurfacing.
|
||||
</constant>
|
||||
<constant name="DIFFUSE_TOON" value="4" enum="DiffuseMode">
|
||||
Uses a hard cut for lighting, with smoothing affected by roughness.
|
||||
</constant>
|
||||
<constant name="SPECULAR_SCHLICK_GGX" value="0" enum="SpecularMode">
|
||||
Default specular blob.
|
||||
</constant>
|
||||
<constant name="SPECULAR_BLINN" value="1" enum="SpecularMode">
|
||||
Older specular algorithm, included for compatibility.
|
||||
</constant>
|
||||
<constant name="SPECULAR_PHONG" value="2" enum="SpecularMode">
|
||||
Older specular algorithm, included for compatibility.
|
||||
</constant>
|
||||
<constant name="SPECULAR_TOON" value="3" enum="SpecularMode">
|
||||
Toon blob which changes size based on roughness.
|
||||
</constant>
|
||||
<constant name="SPECULAR_DISABLED" value="4" enum="SpecularMode">
|
||||
No specular blob.
|
||||
</constant>
|
||||
<constant name="BILLBOARD_DISABLED" value="0" enum="BillboardMode">
|
||||
Billboard mode is disabled.
|
||||
</constant>
|
||||
<constant name="BILLBOARD_ENABLED" value="1" enum="BillboardMode">
|
||||
The object's Z axis will always face the camera.
|
||||
</constant>
|
||||
<constant name="BILLBOARD_FIXED_Y" value="2" enum="BillboardMode">
|
||||
The object's X axis will always face the camera.
|
||||
</constant>
|
||||
<constant name="BILLBOARD_PARTICLES" value="3" enum="BillboardMode">
|
||||
Used for particle systems when assigned to [Particles] and [CPUParticles] nodes. Enables [code]particles_anim_*[/code] properties.
|
||||
The [member ParticlesMaterial.anim_speed] or [member CPUParticles.anim_speed] should also be set to a positive value for the animation to play.
|
||||
</constant>
|
||||
<constant name="TEXTURE_CHANNEL_RED" value="0" enum="TextureChannel">
|
||||
Used to read from the red channel of a texture.
|
||||
</constant>
|
||||
<constant name="TEXTURE_CHANNEL_GREEN" value="1" enum="TextureChannel">
|
||||
Used to read from the green channel of a texture.
|
||||
</constant>
|
||||
<constant name="TEXTURE_CHANNEL_BLUE" value="2" enum="TextureChannel">
|
||||
Used to read from the blue channel of a texture.
|
||||
</constant>
|
||||
<constant name="TEXTURE_CHANNEL_ALPHA" value="3" enum="TextureChannel">
|
||||
Used to read from the alpha channel of a texture.
|
||||
</constant>
|
||||
<constant name="TEXTURE_CHANNEL_GRAYSCALE" value="4" enum="TextureChannel">
|
||||
Currently unused.
|
||||
</constant>
|
||||
<constant name="EMISSION_OP_ADD" value="0" enum="EmissionOperator">
|
||||
Adds the emission color to the color from the emission texture.
|
||||
</constant>
|
||||
<constant name="EMISSION_OP_MULTIPLY" value="1" enum="EmissionOperator">
|
||||
Multiplies the emission color by the color from the emission texture.
|
||||
</constant>
|
||||
<constant name="DISTANCE_FADE_DISABLED" value="0" enum="DistanceFadeMode">
|
||||
Do not use distance fade.
|
||||
</constant>
|
||||
<constant name="DISTANCE_FADE_PIXEL_ALPHA" value="1" enum="DistanceFadeMode">
|
||||
Smoothly fades the object out based on each pixel's distance from the camera using the alpha channel.
|
||||
</constant>
|
||||
<constant name="DISTANCE_FADE_PIXEL_DITHER" value="2" enum="DistanceFadeMode">
|
||||
Smoothly fades the object out based on each pixel's distance from the camera using a dither approach. Dithering discards pixels based on a set pattern to smoothly fade without enabling transparency. On certain hardware this can be faster than [constant DISTANCE_FADE_PIXEL_ALPHA].
|
||||
</constant>
|
||||
<constant name="DISTANCE_FADE_OBJECT_DITHER" value="3" enum="DistanceFadeMode">
|
||||
Smoothly fades the object out based on the object's distance from the camera using a dither approach. Dithering discards pixels based on a set pattern to smoothly fade without enabling transparency. On certain hardware this can be faster than [constant DISTANCE_FADE_PIXEL_ALPHA].
|
||||
</constant>
|
||||
<constant name="ASYNC_MODE_VISIBLE" value="0" enum="AsyncMode">
|
||||
The real conditioned shader needed on each situation will be sent for background compilation. In the meantime, a very complex shader that adapts to every situation will be used ("ubershader"). This ubershader is much slower to render, but will keep the game running without stalling to compile. Once shader compilation is done, the ubershader is replaced by the traditional optimized shader.
|
||||
</constant>
|
||||
<constant name="ASYNC_MODE_HIDDEN" value="1" enum="AsyncMode">
|
||||
Anything with this material applied won't be rendered while this material's shader is being compiled.
|
||||
This is useful for optimization, in cases where the visuals won't suffer from having certain non-essential elements missing during the short time their shaders are being compiled.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
<member name="axis" type="int" setter="set_axis" getter="get_axis" enum="Vector3.Axis" default="2">
|
||||
The direction in which the front of the texture faces.
|
||||
</member>
|
||||
<member name="billboard" type="int" setter="set_billboard_mode" getter="get_billboard_mode" enum="SpatialMaterial.BillboardMode" default="0">
|
||||
<member name="billboard" type="int" setter="set_billboard_mode" getter="get_billboard_mode" enum="Material3D.BillboardMode" default="0">
|
||||
</member>
|
||||
<member name="centered" type="bool" setter="set_centered" getter="is_centered" default="true">
|
||||
If [code]true[/code], texture will be centered.
|
||||
|
@ -61,7 +61,7 @@
|
|||
</member>
|
||||
<member name="modulate" type="Color" setter="set_modulate" getter="get_modulate" default="Color( 1, 1, 1, 1 )">
|
||||
A color value used to [i]multiply[/i] the texture's colors. Can be used for mood-coloring or to simulate the color of light.
|
||||
[b]Note:[/b] If a [member GeometryInstance.material_override] is defined on the [SpriteBase3D], the material override must be configured to take vertex colors into account for albedo. Otherwise, the color defined in [member modulate] will be ignored. For a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] must be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function.
|
||||
[b]Note:[/b] If a [member GeometryInstance.material_override] is defined on the [SpriteBase3D], the material override must be configured to take vertex colors into account for albedo. Otherwise, the color defined in [member modulate] will be ignored. For a [SpatialMaterial], [member Material3D.vertex_color_use_as_albedo] must be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function.
|
||||
</member>
|
||||
<member name="no_depth_test" type="bool" setter="set_draw_flag" getter="get_draw_flag" default="false">
|
||||
If [code]true[/code], depth testing is disabled and the object will be drawn in render order.
|
||||
|
@ -71,7 +71,7 @@
|
|||
</member>
|
||||
<member name="opacity" type="float" setter="set_opacity" getter="get_opacity" default="1.0">
|
||||
The texture's visibility on a scale from [code]0[/code] (fully invisible) to [code]1[/code] (fully visible). [member opacity] is a multiplier for the [member modulate] color's alpha channel.
|
||||
[b]Note:[/b] If a [member GeometryInstance.material_override] is defined on the [SpriteBase3D], the material override must be configured to take vertex colors into account for albedo. Otherwise, the opacity defined in [member opacity] will be ignored. For a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] must be [code]true[/code]. For a [ShaderMaterial], [code]ALPHA *= COLOR.a;[/code] must be inserted in the shader's [code]fragment()[/code] function.
|
||||
[b]Note:[/b] If a [member GeometryInstance.material_override] is defined on the [SpriteBase3D], the material override must be configured to take vertex colors into account for albedo. Otherwise, the opacity defined in [member opacity] will be ignored. For a [SpatialMaterial], [member Material3D.vertex_color_use_as_albedo] must be [code]true[/code]. For a [ShaderMaterial], [code]ALPHA *= COLOR.a;[/code] must be inserted in the shader's [code]fragment()[/code] function.
|
||||
</member>
|
||||
<member name="pixel_size" type="float" setter="set_pixel_size" getter="get_pixel_size" default="0.01">
|
||||
The size of one pixel's width on the sprite to scale it in 3D.
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<argument index="0" name="color" type="Color" />
|
||||
<description>
|
||||
Specifies a [Color] to use for the [i]next[/i] vertex. If every vertex needs to have this information set and you fail to submit it for the first vertex, this information may not be used at all.
|
||||
[b]Note:[/b] The material must have [member SpatialMaterial.vertex_color_use_as_albedo] enabled for the vertex color to be visible.
|
||||
[b]Note:[/b] The material must have [member Material3D.vertex_color_use_as_albedo] enabled for the vertex color to be visible.
|
||||
</description>
|
||||
</method>
|
||||
<method name="add_index">
|
||||
|
|
|
@ -2713,7 +2713,7 @@
|
|||
<return type="void" />
|
||||
<argument index="0" name="forbidden" type="bool" />
|
||||
<description>
|
||||
If asynchronous shader compilation is enabled, this controls whether [constant SpatialMaterial.ASYNC_MODE_HIDDEN] is obeyed.
|
||||
If asynchronous shader compilation is enabled, this controls whether [constant Material3D.ASYNC_MODE_HIDDEN] is obeyed.
|
||||
For instance, you may want to enable this temporarily before taking a screenshot. This ensures everything is visible even if shaders with async mode [i]hidden[/i] are not ready yet.
|
||||
Reflection probes use this internally to ensure they capture everything regardless the shaders are ready or not.
|
||||
</description>
|
||||
|
|
|
@ -518,7 +518,7 @@ void EditorResourcePicker::_get_allowed_types(bool p_with_convert, Set<String> *
|
|||
}
|
||||
|
||||
if (p_with_convert) {
|
||||
if (base == "SpatialMaterial") {
|
||||
if (base == "SpatialMaterial" || base == "ORMSpatialMaterial") {
|
||||
p_vector->insert("Texture");
|
||||
} else if (base == "ShaderMaterial") {
|
||||
p_vector->insert("Shader");
|
||||
|
@ -643,11 +643,22 @@ void EditorResourcePicker::drop_data_fw(const Point2 &p_point, const Variant &p_
|
|||
|
||||
if (at == "SpatialMaterial" && ClassDB::is_parent_class(dropped_resource->get_class(), "Texture")) {
|
||||
// Use existing resource if possible and only replace its data.
|
||||
Ref<SpatialMaterial> mat = edited_resource;
|
||||
Ref<Material3D> mat = edited_resource;
|
||||
if (mat.is_null()) {
|
||||
mat.instance();
|
||||
}
|
||||
mat->set_texture(SpatialMaterial::TextureParam::TEXTURE_ALBEDO, dropped_resource);
|
||||
mat->set_texture(Material3D::TextureParam::TEXTURE_ALBEDO, dropped_resource);
|
||||
dropped_resource = mat;
|
||||
break;
|
||||
}
|
||||
|
||||
if (at == "ORMSpatialMaterial" && ClassDB::is_parent_class(dropped_resource->get_class(), "Texture")) {
|
||||
// Use existing resource if possible and only replace its data.
|
||||
Ref<ORMSpatialMaterial> mat = edited_resource;
|
||||
if (mat.is_null()) {
|
||||
mat.instance();
|
||||
}
|
||||
mat->set_texture(Material3D::TextureParam::TEXTURE_ALBEDO, dropped_resource);
|
||||
dropped_resource = mat;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 3.1191406-3.7636719 1.8808594 3.7636719 1.8828125 3.763672-1.8828125z" fill="#80ff45"/><path d="m3 6.6191406v2.3808594 1.382812l1.234375.617188 2.765625 1.382812v-1.382812-2-.3808594l-3.2382812-1.6191406z" fill="#ff4545"/><path d="m13 6.6191406-.761719.3808594-3.238281 1.6191406v3.7636714l2.765625-1.382812 1.234375-.617188v-1.382812z" fill="#45d7ff"/></svg>
|
After Width: | Height: | Size: 455 B |
|
@ -336,7 +336,7 @@ Error ColladaImport::_create_material(const String &p_target) {
|
|||
ERR_FAIL_COND_V(!collada.state.effect_map.has(src_mat.instance_effect), ERR_INVALID_PARAMETER);
|
||||
Collada::Effect &effect = collada.state.effect_map[src_mat.instance_effect];
|
||||
|
||||
Ref<SpatialMaterial> material = memnew(SpatialMaterial);
|
||||
Ref<Material3D> material = memnew(SpatialMaterial);
|
||||
|
||||
if (src_mat.name != "") {
|
||||
material->set_name(src_mat.name);
|
||||
|
@ -354,9 +354,9 @@ Error ColladaImport::_create_material(const String &p_target) {
|
|||
}
|
||||
Ref<Texture> texture = ResourceLoader::load(texfile, "Texture");
|
||||
if (texture.is_valid()) {
|
||||
material->set_texture(SpatialMaterial::TEXTURE_ALBEDO, texture);
|
||||
material->set_texture(Material3D::TEXTURE_ALBEDO, texture);
|
||||
material->set_albedo(Color(1, 1, 1, 1));
|
||||
//material->set_parameter(SpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,1));
|
||||
//material->set_parameter(Material3D::PARAM_DIFFUSE,Color(1,1,1,1));
|
||||
} else {
|
||||
missing_textures.push_back(texfile.get_file());
|
||||
}
|
||||
|
@ -376,11 +376,11 @@ Error ColladaImport::_create_material(const String &p_target) {
|
|||
|
||||
Ref<Texture> texture = ResourceLoader::load(texfile, "Texture");
|
||||
if (texture.is_valid()) {
|
||||
material->set_texture(SpatialMaterial::TEXTURE_METALLIC, texture);
|
||||
material->set_texture(Material3D::TEXTURE_METALLIC, texture);
|
||||
material->set_specular(1.0);
|
||||
|
||||
//material->set_texture(SpatialMaterial::PARAM_SPECULAR,texture);
|
||||
//material->set_parameter(SpatialMaterial::PARAM_SPECULAR,Color(1,1,1,1));
|
||||
//material->set_texture(Material3D::PARAM_SPECULAR,texture);
|
||||
//material->set_parameter(Material3D::PARAM_SPECULAR,Color(1,1,1,1));
|
||||
} else {
|
||||
missing_textures.push_back(texfile.get_file());
|
||||
}
|
||||
|
@ -401,18 +401,18 @@ Error ColladaImport::_create_material(const String &p_target) {
|
|||
|
||||
Ref<Texture> texture = ResourceLoader::load(texfile, "Texture");
|
||||
if (texture.is_valid()) {
|
||||
material->set_feature(SpatialMaterial::FEATURE_EMISSION, true);
|
||||
material->set_texture(SpatialMaterial::TEXTURE_EMISSION, texture);
|
||||
material->set_feature(Material3D::FEATURE_EMISSION, true);
|
||||
material->set_texture(Material3D::TEXTURE_EMISSION, texture);
|
||||
material->set_emission(Color(1, 1, 1, 1));
|
||||
|
||||
//material->set_parameter(SpatialMaterial::PARAM_EMISSION,Color(1,1,1,1));
|
||||
//material->set_parameter(Material3D::PARAM_EMISSION,Color(1,1,1,1));
|
||||
} else {
|
||||
missing_textures.push_back(texfile.get_file());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (effect.emission.color != Color()) {
|
||||
material->set_feature(SpatialMaterial::FEATURE_EMISSION, true);
|
||||
material->set_feature(Material3D::FEATURE_EMISSION, true);
|
||||
material->set_emission(effect.emission.color);
|
||||
}
|
||||
}
|
||||
|
@ -428,11 +428,11 @@ Error ColladaImport::_create_material(const String &p_target) {
|
|||
|
||||
Ref<Texture> texture = ResourceLoader::load(texfile, "Texture");
|
||||
if (texture.is_valid()) {
|
||||
material->set_feature(SpatialMaterial::FEATURE_NORMAL_MAPPING, true);
|
||||
material->set_texture(SpatialMaterial::TEXTURE_NORMAL, texture);
|
||||
material->set_feature(Material3D::FEATURE_NORMAL_MAPPING, true);
|
||||
material->set_texture(Material3D::TEXTURE_NORMAL, texture);
|
||||
//material->set_emission(Color(1,1,1,1));
|
||||
|
||||
//material->set_texture(SpatialMaterial::PARAM_NORMAL,texture);
|
||||
//material->set_texture(Material3D::PARAM_NORMAL,texture);
|
||||
} else {
|
||||
//missing_textures.push_back(texfile.get_file());
|
||||
}
|
||||
|
@ -443,9 +443,9 @@ Error ColladaImport::_create_material(const String &p_target) {
|
|||
material->set_roughness(roughness);
|
||||
|
||||
if (effect.double_sided) {
|
||||
material->set_cull_mode(SpatialMaterial::CULL_DISABLED);
|
||||
material->set_cull_mode(Material3D::CULL_DISABLED);
|
||||
}
|
||||
material->set_flag(SpatialMaterial::FLAG_UNSHADED, effect.unshaded);
|
||||
material->set_flag(Material3D::FLAG_UNSHADED, effect.unshaded);
|
||||
|
||||
material_cache[p_target] = material;
|
||||
return OK;
|
||||
|
@ -883,7 +883,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
|
|||
/*****************/
|
||||
|
||||
{
|
||||
Ref<SpatialMaterial> material;
|
||||
Ref<Material3D> material;
|
||||
|
||||
{
|
||||
if (p_material_map.has(p.material)) {
|
||||
|
|
|
@ -41,7 +41,7 @@ uint32_t EditorOBJImporter::get_import_flags() const {
|
|||
return IMPORT_SCENE;
|
||||
}
|
||||
|
||||
static Error _parse_material_library(const String &p_path, Map<String, Ref<SpatialMaterial>> &material_map, List<String> *r_missing_deps) {
|
||||
static Error _parse_material_library(const String &p_path, Map<String, Ref<Material3D>> &material_map, List<String> *r_missing_deps) {
|
||||
FileAccessRef f = FileAccess::open(p_path, FileAccess::READ);
|
||||
ERR_FAIL_COND_V_MSG(!f, ERR_CANT_OPEN, vformat("Couldn't open MTL file '%s', it may not exist or not be readable.", p_path));
|
||||
|
||||
|
@ -99,7 +99,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati
|
|||
c.a = d;
|
||||
current->set_albedo(c);
|
||||
if (c.a < 0.99) {
|
||||
current->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
current->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
}
|
||||
} else if (l.begins_with("Tr ")) {
|
||||
//normal
|
||||
|
@ -111,7 +111,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati
|
|||
c.a = 1.0 - d;
|
||||
current->set_albedo(c);
|
||||
if (c.a < 0.99) {
|
||||
current->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
current->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
}
|
||||
|
||||
} else if (l.begins_with("map_Ka ")) {
|
||||
|
@ -133,7 +133,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati
|
|||
Ref<Texture> texture = ResourceLoader::load(path);
|
||||
|
||||
if (texture.is_valid()) {
|
||||
current->set_texture(SpatialMaterial::TEXTURE_ALBEDO, texture);
|
||||
current->set_texture(Material3D::TEXTURE_ALBEDO, texture);
|
||||
} else if (r_missing_deps) {
|
||||
r_missing_deps->push_back(path);
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati
|
|||
Ref<Texture> texture = ResourceLoader::load(path);
|
||||
|
||||
if (texture.is_valid()) {
|
||||
current->set_texture(SpatialMaterial::TEXTURE_METALLIC, texture);
|
||||
current->set_texture(Material3D::TEXTURE_METALLIC, texture);
|
||||
} else if (r_missing_deps) {
|
||||
r_missing_deps->push_back(path);
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati
|
|||
Ref<Texture> texture = ResourceLoader::load(path);
|
||||
|
||||
if (texture.is_valid()) {
|
||||
current->set_texture(SpatialMaterial::TEXTURE_ROUGHNESS, texture);
|
||||
current->set_texture(Material3D::TEXTURE_ROUGHNESS, texture);
|
||||
} else if (r_missing_deps) {
|
||||
r_missing_deps->push_back(path);
|
||||
}
|
||||
|
@ -187,8 +187,8 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati
|
|||
Ref<Texture> texture = ResourceLoader::load(path);
|
||||
|
||||
if (texture.is_valid()) {
|
||||
current->set_feature(SpatialMaterial::FEATURE_NORMAL_MAPPING, true);
|
||||
current->set_texture(SpatialMaterial::TEXTURE_NORMAL, texture);
|
||||
current->set_feature(Material3D::FEATURE_NORMAL_MAPPING, true);
|
||||
current->set_texture(Material3D::TEXTURE_NORMAL, texture);
|
||||
} else if (r_missing_deps) {
|
||||
r_missing_deps->push_back(path);
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_
|
|||
Vector<Color> colors;
|
||||
String name;
|
||||
|
||||
Map<String, Map<String, Ref<SpatialMaterial>>> material_map;
|
||||
Map<String, Map<String, Ref<Material3D>>> material_map;
|
||||
|
||||
Ref<SurfaceTool> surf_tool = memnew(SurfaceTool);
|
||||
surf_tool->begin(Mesh::PRIMITIVE_TRIANGLES);
|
||||
|
@ -361,7 +361,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_
|
|||
print_verbose("OBJ: Current material " + current_material + " has " + itos(material_map.has(current_material_library) && material_map[current_material_library].has(current_material)));
|
||||
|
||||
if (material_map.has(current_material_library) && material_map[current_material_library].has(current_material)) {
|
||||
Ref<SpatialMaterial> &material = material_map[current_material_library][current_material];
|
||||
Ref<Material3D> &material = material_map[current_material_library][current_material];
|
||||
if (!colors.empty()) {
|
||||
material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
}
|
||||
|
@ -411,7 +411,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_
|
|||
|
||||
current_material_library = l.replace("mtllib", "").strip_edges();
|
||||
if (!material_map.has(current_material_library)) {
|
||||
Map<String, Ref<SpatialMaterial>> lib;
|
||||
Map<String, Ref<Material3D>> lib;
|
||||
String lib_path = current_material_library;
|
||||
if (lib_path.is_rel_path()) {
|
||||
lib_path = p_path.get_base_dir().plus_file(current_material_library);
|
||||
|
|
|
@ -315,18 +315,18 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
|
|||
|
||||
if (m.is_valid()) {
|
||||
for (int i = 0; i < m->get_surface_count(); i++) {
|
||||
Ref<SpatialMaterial> mat = m->surface_get_material(i);
|
||||
Ref<Material3D> mat = m->surface_get_material(i);
|
||||
if (!mat.is_valid()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_teststr(mat->get_name(), "alpha")) {
|
||||
mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
mat->set_name(_fixstr(mat->get_name(), "alpha"));
|
||||
}
|
||||
if (_teststr(mat->get_name(), "vcol")) {
|
||||
mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
mat->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
mat->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
mat->set_name(_fixstr(mat->get_name(), "vcol"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -518,23 +518,23 @@ Polygon3DEditor::Polygon3DEditor(EditorNode *p_editor) {
|
|||
imgeom = memnew(ImmediateGeometry);
|
||||
imgeom->set_transform(Transform(Basis(), Vector3(0, 0, 0.00001)));
|
||||
|
||||
line_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
|
||||
line_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
line_material = Ref<Material3D>(memnew(SpatialMaterial));
|
||||
line_material->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
line_material->set_line_width(3.0);
|
||||
line_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
line_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
line_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
line_material->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
line_material->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
line_material->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
line_material->set_albedo(Color(1, 1, 1));
|
||||
|
||||
handle_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
|
||||
handle_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
handle_material->set_flag(SpatialMaterial::FLAG_USE_POINT_SIZE, true);
|
||||
handle_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
handle_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
handle_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
handle_material = Ref<Material3D>(memnew(SpatialMaterial));
|
||||
handle_material->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
handle_material->set_flag(Material3D::FLAG_USE_POINT_SIZE, true);
|
||||
handle_material->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
handle_material->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
handle_material->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
Ref<Texture> handle = editor->get_gui_base()->get_icon("Editor3DHandle", "EditorIcons");
|
||||
handle_material->set_point_size(handle->get_width());
|
||||
handle_material->set_texture(SpatialMaterial::TEXTURE_ALBEDO, handle);
|
||||
handle_material->set_texture(Material3D::TEXTURE_ALBEDO, handle);
|
||||
|
||||
pointsm = memnew(MeshInstance);
|
||||
imgeom->add_child(pointsm);
|
||||
|
|
|
@ -56,8 +56,8 @@ class Polygon3DEditor : public HBoxContainer {
|
|||
ToolButton *button_create;
|
||||
ToolButton *button_edit;
|
||||
|
||||
Ref<SpatialMaterial> line_material;
|
||||
Ref<SpatialMaterial> handle_material;
|
||||
Ref<Material3D> line_material;
|
||||
Ref<Material3D> handle_material;
|
||||
|
||||
EditorNode *editor;
|
||||
Panel *panel;
|
||||
|
|
|
@ -263,11 +263,11 @@ String SpatialMaterialConversionPlugin::converts_to() const {
|
|||
return "ShaderMaterial";
|
||||
}
|
||||
bool SpatialMaterialConversionPlugin::handles(const Ref<Resource> &p_resource) const {
|
||||
Ref<SpatialMaterial> mat = p_resource;
|
||||
Ref<Material3D> mat = p_resource;
|
||||
return mat.is_valid();
|
||||
}
|
||||
Ref<Resource> SpatialMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) const {
|
||||
Ref<SpatialMaterial> mat = p_resource;
|
||||
Ref<Material3D> mat = p_resource;
|
||||
ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>());
|
||||
|
||||
Ref<ShaderMaterial> smat;
|
||||
|
|
|
@ -462,7 +462,7 @@ MeshInstanceEditor::MeshInstanceEditor() {
|
|||
options->get_popup()->add_item(TTR("Create Navigation Mesh"), MENU_OPTION_CREATE_NAVMESH);
|
||||
options->get_popup()->add_separator();
|
||||
options->get_popup()->add_item(TTR("Create Outline Mesh..."), MENU_OPTION_CREATE_OUTLINE_MESH);
|
||||
options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a static outline mesh. The outline mesh will have its normals flipped automatically.\nThis can be used instead of the SpatialMaterial Grow property when using that property isn't possible."));
|
||||
options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a static outline mesh. The outline mesh will have its normals flipped automatically.\nThis can be used instead of the Material3D Grow property when using that property isn't possible."));
|
||||
options->get_popup()->add_separator();
|
||||
options->get_popup()->add_item(TTR("View UV1"), MENU_OPTION_DEBUG_UV1);
|
||||
options->get_popup()->add_item(TTR("View UV2"), MENU_OPTION_DEBUG_UV2);
|
||||
|
|
|
@ -217,9 +217,9 @@ void PathSpatialGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p
|
|||
void PathSpatialGizmo::redraw() {
|
||||
clear();
|
||||
|
||||
Ref<SpatialMaterial> path_material = gizmo_plugin->get_material("path_material", this);
|
||||
Ref<SpatialMaterial> path_thin_material = gizmo_plugin->get_material("path_thin_material", this);
|
||||
Ref<SpatialMaterial> handles_material = gizmo_plugin->get_material("handles");
|
||||
Ref<Material3D> path_material = gizmo_plugin->get_material("path_material", this);
|
||||
Ref<Material3D> path_thin_material = gizmo_plugin->get_material("path_thin_material", this);
|
||||
Ref<Material3D> handles_material = gizmo_plugin->get_material("handles");
|
||||
|
||||
Ref<Curve3D> c = path->get_curve();
|
||||
if (c.is_null()) {
|
||||
|
|
|
@ -5028,19 +5028,19 @@ void SpatialEditor::_generate_selection_boxes() {
|
|||
st_xray->add_vertex(b);
|
||||
}
|
||||
|
||||
Ref<SpatialMaterial> mat = memnew(SpatialMaterial);
|
||||
mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
Ref<Material3D> mat = memnew(SpatialMaterial);
|
||||
mat->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
const Color selection_box_color = EDITOR_GET("editors/3d/selection_box_color");
|
||||
mat->set_albedo(selection_box_color);
|
||||
mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
st->set_material(mat);
|
||||
selection_box = st->commit();
|
||||
|
||||
Ref<SpatialMaterial> mat_xray = memnew(SpatialMaterial);
|
||||
mat_xray->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
mat_xray->set_flag(SpatialMaterial::FLAG_DISABLE_DEPTH_TEST, true);
|
||||
Ref<Material3D> mat_xray = memnew(SpatialMaterial);
|
||||
mat_xray->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
mat_xray->set_flag(Material3D::FLAG_DISABLE_DEPTH_TEST, true);
|
||||
mat_xray->set_albedo(selection_box_color * Color(1, 1, 1, 0.15));
|
||||
mat_xray->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
mat_xray->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
st_xray->set_material(mat_xray);
|
||||
selection_box_xray = st_xray->commit();
|
||||
}
|
||||
|
@ -5618,10 +5618,10 @@ void SpatialEditor::_init_indicators() {
|
|||
grid_enabled = true;
|
||||
|
||||
indicator_mat.instance();
|
||||
indicator_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
indicator_mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
indicator_mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
indicator_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
indicator_mat->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
indicator_mat->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
indicator_mat->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
indicator_mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
|
||||
Vector<Color> origin_colors;
|
||||
Vector<Vector3> origin_points;
|
||||
|
@ -5753,14 +5753,14 @@ void SpatialEditor::_init_indicators() {
|
|||
scale_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
scale_plane_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
|
||||
Ref<SpatialMaterial> mat = memnew(SpatialMaterial);
|
||||
mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
Ref<Material3D> mat = memnew(SpatialMaterial);
|
||||
mat->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
mat->set_on_top_of_alpha();
|
||||
mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
mat->set_albedo(col);
|
||||
gizmo_color[i] = mat;
|
||||
|
||||
Ref<SpatialMaterial> mat_hl = mat->duplicate();
|
||||
Ref<Material3D> mat_hl = mat->duplicate();
|
||||
const Color albedo = col.from_hsv(col.get_h(), 0.25, 1.0, 1);
|
||||
mat_hl->set_albedo(albedo);
|
||||
gizmo_color_hl[i] = mat_hl;
|
||||
|
@ -5846,17 +5846,17 @@ void SpatialEditor::_init_indicators() {
|
|||
surftool->add_vertex(points[2]);
|
||||
surftool->add_vertex(points[3]);
|
||||
|
||||
Ref<SpatialMaterial> plane_mat = memnew(SpatialMaterial);
|
||||
plane_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
Ref<Material3D> plane_mat = memnew(SpatialMaterial);
|
||||
plane_mat->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
plane_mat->set_on_top_of_alpha();
|
||||
plane_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
plane_mat->set_cull_mode(SpatialMaterial::CULL_DISABLED);
|
||||
plane_mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
plane_mat->set_cull_mode(Material3D::CULL_DISABLED);
|
||||
plane_mat->set_albedo(col);
|
||||
plane_gizmo_color[i] = plane_mat; // needed, so we can draw planes from both sides
|
||||
surftool->set_material(plane_mat);
|
||||
surftool->commit(move_plane_gizmo[i]);
|
||||
|
||||
Ref<SpatialMaterial> plane_mat_hl = plane_mat->duplicate();
|
||||
Ref<Material3D> plane_mat_hl = plane_mat->duplicate();
|
||||
plane_mat_hl->set_albedo(albedo);
|
||||
plane_gizmo_color_hl[i] = plane_mat_hl; // needed, so we can draw planes from both sides
|
||||
}
|
||||
|
@ -6055,17 +6055,17 @@ void SpatialEditor::_init_indicators() {
|
|||
surftool->add_vertex(points[2]);
|
||||
surftool->add_vertex(points[3]);
|
||||
|
||||
Ref<SpatialMaterial> plane_mat = memnew(SpatialMaterial);
|
||||
plane_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
Ref<Material3D> plane_mat = memnew(SpatialMaterial);
|
||||
plane_mat->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
plane_mat->set_on_top_of_alpha();
|
||||
plane_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
plane_mat->set_cull_mode(SpatialMaterial::CULL_DISABLED);
|
||||
plane_mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
plane_mat->set_cull_mode(Material3D::CULL_DISABLED);
|
||||
plane_mat->set_albedo(col);
|
||||
plane_gizmo_color[i] = plane_mat; // needed, so we can draw planes from both sides
|
||||
surftool->set_material(plane_mat);
|
||||
surftool->commit(scale_plane_gizmo[i]);
|
||||
|
||||
Ref<SpatialMaterial> plane_mat_hl = plane_mat->duplicate();
|
||||
Ref<Material3D> plane_mat_hl = plane_mat->duplicate();
|
||||
plane_mat_hl->set_albedo(col.from_hsv(col.get_h(), 0.25, 1.0, 1));
|
||||
plane_gizmo_color_hl[i] = plane_mat_hl; // needed, so we can draw planes from both sides
|
||||
}
|
||||
|
@ -7398,13 +7398,13 @@ SpatialEditorPlugin::~SpatialEditorPlugin() {
|
|||
void EditorSpatialGizmoPlugin::create_material(const String &p_name, const Color &p_color, bool p_billboard, bool p_on_top, bool p_use_vertex_color) {
|
||||
Color instanced_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/instanced");
|
||||
|
||||
Vector<Ref<SpatialMaterial>> mats;
|
||||
Vector<Ref<Material3D>> mats;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
bool selected = i % 2 == 1;
|
||||
bool instanced = i < 2;
|
||||
|
||||
Ref<SpatialMaterial> material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
|
||||
Ref<Material3D> material = Ref<Material3D>(memnew(SpatialMaterial));
|
||||
|
||||
Color color = instanced ? instanced_color : p_color;
|
||||
|
||||
|
@ -7413,17 +7413,17 @@ void EditorSpatialGizmoPlugin::create_material(const String &p_name, const Color
|
|||
}
|
||||
|
||||
material->set_albedo(color);
|
||||
material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
material->set_render_priority(SpatialMaterial::RENDER_PRIORITY_MIN + 1);
|
||||
material->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
material->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
material->set_render_priority(Material3D::RENDER_PRIORITY_MIN + 1);
|
||||
|
||||
if (p_use_vertex_color) {
|
||||
material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
material->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
material->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
}
|
||||
|
||||
if (p_billboard) {
|
||||
material->set_billboard_mode(SpatialMaterial::BILLBOARD_ENABLED);
|
||||
material->set_billboard_mode(Material3D::BILLBOARD_ENABLED);
|
||||
}
|
||||
|
||||
if (p_on_top && selected) {
|
||||
|
@ -7439,13 +7439,13 @@ void EditorSpatialGizmoPlugin::create_material(const String &p_name, const Color
|
|||
void EditorSpatialGizmoPlugin::create_icon_material(const String &p_name, const Ref<Texture> &p_texture, bool p_on_top, const Color &p_albedo) {
|
||||
Color instanced_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/instanced");
|
||||
|
||||
Vector<Ref<SpatialMaterial>> icons;
|
||||
Vector<Ref<Material3D>> icons;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
bool selected = i % 2 == 1;
|
||||
bool instanced = i < 2;
|
||||
|
||||
Ref<SpatialMaterial> icon = Ref<SpatialMaterial>(memnew(SpatialMaterial));
|
||||
Ref<Material3D> icon = Ref<Material3D>(memnew(SpatialMaterial));
|
||||
|
||||
Color color = instanced ? instanced_color : p_albedo;
|
||||
|
||||
|
@ -7455,16 +7455,16 @@ void EditorSpatialGizmoPlugin::create_icon_material(const String &p_name, const
|
|||
|
||||
icon->set_albedo(color);
|
||||
|
||||
icon->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
icon->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
icon->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
icon->set_cull_mode(SpatialMaterial::CULL_DISABLED);
|
||||
icon->set_depth_draw_mode(SpatialMaterial::DEPTH_DRAW_DISABLED);
|
||||
icon->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
icon->set_texture(SpatialMaterial::TEXTURE_ALBEDO, p_texture);
|
||||
icon->set_flag(SpatialMaterial::FLAG_FIXED_SIZE, true);
|
||||
icon->set_billboard_mode(SpatialMaterial::BILLBOARD_ENABLED);
|
||||
icon->set_render_priority(SpatialMaterial::RENDER_PRIORITY_MIN);
|
||||
icon->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
icon->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
icon->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
icon->set_cull_mode(Material3D::CULL_DISABLED);
|
||||
icon->set_depth_draw_mode(Material3D::DEPTH_DRAW_DISABLED);
|
||||
icon->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
icon->set_texture(Material3D::TEXTURE_ALBEDO, p_texture);
|
||||
icon->set_flag(Material3D::FLAG_FIXED_SIZE, true);
|
||||
icon->set_billboard_mode(Material3D::BILLBOARD_ENABLED);
|
||||
icon->set_render_priority(Material3D::RENDER_PRIORITY_MIN);
|
||||
|
||||
if (p_on_top && selected) {
|
||||
icon->set_on_top_of_alpha();
|
||||
|
@ -7477,36 +7477,36 @@ void EditorSpatialGizmoPlugin::create_icon_material(const String &p_name, const
|
|||
}
|
||||
|
||||
void EditorSpatialGizmoPlugin::create_handle_material(const String &p_name, bool p_billboard, const Ref<Texture> &p_icon) {
|
||||
Ref<SpatialMaterial> handle_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
|
||||
Ref<Material3D> handle_material = Ref<Material3D>(memnew(SpatialMaterial));
|
||||
|
||||
handle_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
handle_material->set_flag(SpatialMaterial::FLAG_USE_POINT_SIZE, true);
|
||||
handle_material->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
handle_material->set_flag(Material3D::FLAG_USE_POINT_SIZE, true);
|
||||
|
||||
Ref<Texture> handle_t = p_icon != nullptr ? p_icon : SpatialEditor::get_singleton()->get_icon("Editor3DHandle", "EditorIcons");
|
||||
handle_material->set_point_size(handle_t->get_width());
|
||||
handle_material->set_texture(SpatialMaterial::TEXTURE_ALBEDO, handle_t);
|
||||
handle_material->set_texture(Material3D::TEXTURE_ALBEDO, handle_t);
|
||||
handle_material->set_albedo(Color(1, 1, 1));
|
||||
handle_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
handle_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
handle_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
handle_material->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
handle_material->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
handle_material->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
handle_material->set_on_top_of_alpha();
|
||||
if (p_billboard) {
|
||||
handle_material->set_billboard_mode(SpatialMaterial::BILLBOARD_ENABLED);
|
||||
handle_material->set_billboard_mode(Material3D::BILLBOARD_ENABLED);
|
||||
handle_material->set_on_top_of_alpha();
|
||||
}
|
||||
|
||||
materials[p_name] = Vector<Ref<SpatialMaterial>>();
|
||||
materials[p_name] = Vector<Ref<Material3D>>();
|
||||
materials[p_name].push_back(handle_material);
|
||||
}
|
||||
|
||||
void EditorSpatialGizmoPlugin::add_material(const String &p_name, Ref<SpatialMaterial> p_material) {
|
||||
materials[p_name] = Vector<Ref<SpatialMaterial>>();
|
||||
void EditorSpatialGizmoPlugin::add_material(const String &p_name, Ref<Material3D> p_material) {
|
||||
materials[p_name] = Vector<Ref<Material3D>>();
|
||||
materials[p_name].push_back(p_material);
|
||||
}
|
||||
|
||||
Ref<SpatialMaterial> EditorSpatialGizmoPlugin::get_material(const String &p_name, const Ref<EditorSpatialGizmo> &p_gizmo) {
|
||||
ERR_FAIL_COND_V(!materials.has(p_name), Ref<SpatialMaterial>());
|
||||
ERR_FAIL_COND_V(materials[p_name].size() == 0, Ref<SpatialMaterial>());
|
||||
Ref<Material3D> EditorSpatialGizmoPlugin::get_material(const String &p_name, const Ref<EditorSpatialGizmo> &p_gizmo) {
|
||||
ERR_FAIL_COND_V(!materials.has(p_name), Ref<Material3D>());
|
||||
ERR_FAIL_COND_V(materials[p_name].size() == 0, Ref<Material3D>());
|
||||
|
||||
if (p_gizmo.is_null() || materials[p_name].size() == 1) {
|
||||
return materials[p_name][0];
|
||||
|
@ -7514,12 +7514,12 @@ Ref<SpatialMaterial> EditorSpatialGizmoPlugin::get_material(const String &p_name
|
|||
|
||||
int index = (p_gizmo->is_selected() ? 1 : 0) + (p_gizmo->is_editable() ? 2 : 0);
|
||||
|
||||
Ref<SpatialMaterial> mat = materials[p_name][index];
|
||||
Ref<Material3D> mat = materials[p_name][index];
|
||||
|
||||
if (current_state == ON_TOP && p_gizmo->is_selected()) {
|
||||
mat->set_flag(SpatialMaterial::FLAG_DISABLE_DEPTH_TEST, true);
|
||||
mat->set_flag(Material3D::FLAG_DISABLE_DEPTH_TEST, true);
|
||||
} else {
|
||||
mat->set_flag(SpatialMaterial::FLAG_DISABLE_DEPTH_TEST, false);
|
||||
mat->set_flag(Material3D::FLAG_DISABLE_DEPTH_TEST, false);
|
||||
}
|
||||
|
||||
return mat;
|
||||
|
|
|
@ -619,11 +619,11 @@ private:
|
|||
bool grid_enabled;
|
||||
|
||||
Ref<ArrayMesh> move_gizmo[3], move_plane_gizmo[3], rotate_gizmo[4], scale_gizmo[3], scale_plane_gizmo[3];
|
||||
Ref<SpatialMaterial> gizmo_color[3];
|
||||
Ref<SpatialMaterial> plane_gizmo_color[3];
|
||||
Ref<Material3D> gizmo_color[3];
|
||||
Ref<Material3D> plane_gizmo_color[3];
|
||||
Ref<ShaderMaterial> rotate_gizmo_color[3];
|
||||
Ref<SpatialMaterial> gizmo_color_hl[3];
|
||||
Ref<SpatialMaterial> plane_gizmo_color_hl[3];
|
||||
Ref<Material3D> gizmo_color_hl[3];
|
||||
Ref<Material3D> plane_gizmo_color_hl[3];
|
||||
Ref<ShaderMaterial> rotate_gizmo_color_hl[3];
|
||||
|
||||
int over_gizmo_handle;
|
||||
|
@ -637,9 +637,9 @@ private:
|
|||
RID indicators_instance;
|
||||
RID cursor_mesh;
|
||||
RID cursor_instance;
|
||||
Ref<SpatialMaterial> indicator_mat;
|
||||
Ref<Material3D> indicator_mat;
|
||||
Ref<ShaderMaterial> grid_mat[3];
|
||||
Ref<SpatialMaterial> cursor_material;
|
||||
Ref<Material3D> cursor_material;
|
||||
|
||||
// Scene drag and drop support
|
||||
Spatial *preview_node;
|
||||
|
@ -896,7 +896,7 @@ public:
|
|||
protected:
|
||||
int current_state;
|
||||
List<EditorSpatialGizmo *> current_gizmos;
|
||||
HashMap<String, Vector<Ref<SpatialMaterial>>> materials;
|
||||
HashMap<String, Vector<Ref<Material3D>>> materials;
|
||||
|
||||
static void _bind_methods();
|
||||
virtual bool has_gizmo(Spatial *p_spatial);
|
||||
|
@ -906,9 +906,9 @@ public:
|
|||
void create_material(const String &p_name, const Color &p_color, bool p_billboard = false, bool p_on_top = false, bool p_use_vertex_color = false);
|
||||
void create_icon_material(const String &p_name, const Ref<Texture> &p_texture, bool p_on_top = false, const Color &p_albedo = Color(1, 1, 1, 1));
|
||||
void create_handle_material(const String &p_name, bool p_billboard = false, const Ref<Texture> &p_icon = nullptr);
|
||||
void add_material(const String &p_name, Ref<SpatialMaterial> p_material);
|
||||
void add_material(const String &p_name, Ref<Material3D> p_material);
|
||||
|
||||
Ref<SpatialMaterial> get_material(const String &p_name, const Ref<EditorSpatialGizmo> &p_gizmo = Ref<EditorSpatialGizmo>());
|
||||
Ref<Material3D> get_material(const String &p_name, const Ref<EditorSpatialGizmo> &p_gizmo = Ref<EditorSpatialGizmo>());
|
||||
|
||||
virtual String get_name() const;
|
||||
virtual int get_priority() const;
|
||||
|
|
|
@ -1644,11 +1644,11 @@ Position3DSpatialGizmoPlugin::Position3DSpatialGizmoPlugin() {
|
|||
cursor_colors.push_back(color_z.linear_interpolate(Color(0, 0, 0), 0.75));
|
||||
cursor_colors.push_back(color_z.linear_interpolate(Color(0, 0, 0), 0.75));
|
||||
|
||||
Ref<SpatialMaterial> mat = memnew(SpatialMaterial);
|
||||
mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
Ref<Material3D> mat = memnew(SpatialMaterial);
|
||||
mat->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
mat->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
mat->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
mat->set_line_width(3);
|
||||
Array d;
|
||||
d.resize(VS::ARRAY_MAX);
|
||||
|
@ -1990,7 +1990,7 @@ void RayCastSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
|
|||
|
||||
p_gizmo->clear();
|
||||
|
||||
const Ref<SpatialMaterial> material = raycast->is_enabled() ? raycast->get_debug_material() : get_material("shape_material_disabled");
|
||||
const Ref<Material3D> material = raycast->is_enabled() ? raycast->get_debug_material() : get_material("shape_material_disabled");
|
||||
|
||||
p_gizmo->add_lines(raycast->get_debug_line_vertices(), material);
|
||||
|
||||
|
@ -2028,7 +2028,7 @@ void ShapeCastGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
|
|||
|
||||
p_gizmo->clear();
|
||||
|
||||
const Ref<SpatialMaterial> material = shapecast->is_enabled() ? shapecast->get_debug_material() : get_material("shape_material_disabled");
|
||||
const Ref<Material3D> material = shapecast->is_enabled() ? shapecast->get_debug_material() : get_material("shape_material_disabled");
|
||||
|
||||
p_gizmo->add_lines(shapecast->get_debug_line_vertices(), material);
|
||||
|
||||
|
@ -2051,7 +2051,7 @@ void SpringArmSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
|
|||
lines.push_back(Vector3());
|
||||
lines.push_back(Vector3(0, 0, 1.0) * spring_arm->get_length());
|
||||
|
||||
Ref<SpatialMaterial> material = get_material("shape_material", p_gizmo);
|
||||
Ref<Material3D> material = get_material("shape_material", p_gizmo);
|
||||
|
||||
p_gizmo->add_lines(lines, material);
|
||||
p_gizmo->add_collision_segments(lines);
|
||||
|
|
|
@ -878,7 +878,7 @@ void SpaceBullet::update_gravity() {
|
|||
|
||||
static ImmediateGeometry *motionVec(NULL);
|
||||
static ImmediateGeometry *normalLine(NULL);
|
||||
static Ref<SpatialMaterial> red_mat;
|
||||
static Ref<Material3D> red_mat;
|
||||
static Ref<SpatialMaterial> blue_mat;
|
||||
#endif
|
||||
|
||||
|
@ -895,21 +895,21 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
|
|||
motionVec->set_as_toplevel(true);
|
||||
normalLine->set_as_toplevel(true);
|
||||
|
||||
red_mat = Ref<SpatialMaterial>(memnew(SpatialMaterial));
|
||||
red_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
red_mat = Ref<Material3D>(memnew(SpatialMaterial));
|
||||
red_mat->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
red_mat->set_line_width(20.0);
|
||||
red_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
red_mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
red_mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
red_mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
red_mat->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
red_mat->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
red_mat->set_albedo(Color(1, 0, 0, 1));
|
||||
motionVec->set_material_override(red_mat);
|
||||
|
||||
blue_mat = Ref<SpatialMaterial>(memnew(SpatialMaterial));
|
||||
blue_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
blue_mat = Ref<Material3D>(memnew(SpatialMaterial));
|
||||
blue_mat->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
blue_mat->set_line_width(20.0);
|
||||
blue_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
blue_mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
blue_mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
blue_mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
blue_mat->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
blue_mat->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
blue_mat->set_albedo(Color(0, 0, 1, 1));
|
||||
normalLine->set_material_override(blue_mat);
|
||||
}
|
||||
|
|
|
@ -961,7 +961,7 @@ void CSGMesh::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_material"), &CSGMesh::get_material);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mesh", PROPERTY_HINT_RESOURCE_TYPE, "Mesh"), "set_mesh", "get_mesh");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ORMSpatialMaterial,ShaderMaterial"), "set_material", "get_material");
|
||||
}
|
||||
|
||||
void CSGMesh::set_mesh(const Ref<Mesh> &p_mesh) {
|
||||
|
@ -1128,7 +1128,7 @@ void CSGSphere::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::INT, "radial_segments", PROPERTY_HINT_RANGE, "1,100,1"), "set_radial_segments", "get_radial_segments");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "rings", PROPERTY_HINT_RANGE, "1,100,1"), "set_rings", "get_rings");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_faces"), "set_smooth_faces", "get_smooth_faces");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ORMSpatialMaterial,ShaderMaterial"), "set_material", "get_material");
|
||||
}
|
||||
|
||||
void CSGSphere::set_radius(const float p_radius) {
|
||||
|
@ -1307,7 +1307,7 @@ void CSGBox::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "width", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_width", "get_width");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_height", "get_height");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "depth", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_depth", "get_depth");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ORMSpatialMaterial,ShaderMaterial"), "set_material", "get_material");
|
||||
}
|
||||
|
||||
void CSGBox::set_width(const float p_width) {
|
||||
|
@ -1521,7 +1521,7 @@ void CSGCylinder::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::INT, "sides", PROPERTY_HINT_RANGE, "3,64,1"), "set_sides", "get_sides");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cone"), "set_cone", "is_cone");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_faces"), "set_smooth_faces", "get_smooth_faces");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ORMSpatialMaterial,ShaderMaterial"), "set_material", "get_material");
|
||||
}
|
||||
|
||||
void CSGCylinder::set_radius(const float p_radius) {
|
||||
|
@ -1748,7 +1748,7 @@ void CSGTorus::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::INT, "sides", PROPERTY_HINT_RANGE, "3,64,1"), "set_sides", "get_sides");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "ring_sides", PROPERTY_HINT_RANGE, "3,64,1"), "set_ring_sides", "get_ring_sides");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_faces"), "set_smooth_faces", "get_smooth_faces");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ORMSpatialMaterial,ShaderMaterial"), "set_material", "get_material");
|
||||
}
|
||||
|
||||
void CSGTorus::set_inner_radius(const float p_inner_radius) {
|
||||
|
@ -2266,7 +2266,7 @@ void CSGPolygon::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "path_u_distance", PROPERTY_HINT_RANGE, "0.0,10.0,0.01,or_greater"), "set_path_u_distance", "get_path_u_distance");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "path_joined"), "set_path_joined", "is_path_joined");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_faces"), "set_smooth_faces", "get_smooth_faces");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ORMSpatialMaterial,ShaderMaterial"), "set_material", "get_material");
|
||||
|
||||
BIND_ENUM_CONSTANT(MODE_DEPTH);
|
||||
BIND_ENUM_CONSTANT(MODE_SPIN);
|
||||
|
|
|
@ -184,7 +184,7 @@ FBXMaterial::MaterialInfo FBXMaterial::extract_material_info(const FBXDocParser:
|
|||
|
||||
const String texture_name = absoulte_fbx_file_path.get_file();
|
||||
print_verbose("Getting FBX mapping mode for " + String(fbx_mapping_name.c_str()));
|
||||
const SpatialMaterial::TextureParam mapping_mode = fbx_texture_mapping_desc.at(fbx_mapping_name);
|
||||
const Material3D::TextureParam mapping_mode = fbx_texture_mapping_desc.at(fbx_mapping_name);
|
||||
print_verbose("Set FBX mapping mode to " + get_texture_param_name(mapping_mode));
|
||||
TextureFileMapping file_mapping;
|
||||
file_mapping.map_mode = mapping_mode;
|
||||
|
@ -194,42 +194,43 @@ FBXMaterial::MaterialInfo FBXMaterial::extract_material_info(const FBXDocParser:
|
|||
|
||||
// Make sure to active the various features.
|
||||
switch (mapping_mode) {
|
||||
case SpatialMaterial::TextureParam::TEXTURE_ALBEDO:
|
||||
case SpatialMaterial::TextureParam::TEXTURE_METALLIC:
|
||||
case SpatialMaterial::TextureParam::TEXTURE_ROUGHNESS:
|
||||
case SpatialMaterial::TextureParam::TEXTURE_FLOWMAP:
|
||||
case SpatialMaterial::TextureParam::TEXTURE_REFRACTION:
|
||||
case SpatialMaterial::TextureParam::TEXTURE_MAX:
|
||||
case Material3D::TextureParam::TEXTURE_ALBEDO:
|
||||
case Material3D::TextureParam::TEXTURE_METALLIC:
|
||||
case Material3D::TextureParam::TEXTURE_ROUGHNESS:
|
||||
case Material3D::TextureParam::TEXTURE_ORM:
|
||||
case Material3D::TextureParam::TEXTURE_FLOWMAP:
|
||||
case Material3D::TextureParam::TEXTURE_REFRACTION:
|
||||
case Material3D::TextureParam::TEXTURE_MAX:
|
||||
// No features required.
|
||||
break;
|
||||
case SpatialMaterial::TextureParam::TEXTURE_EMISSION:
|
||||
mat_info.features.push_back(SpatialMaterial::Feature::FEATURE_EMISSION);
|
||||
case Material3D::TextureParam::TEXTURE_EMISSION:
|
||||
mat_info.features.push_back(Material3D::Feature::FEATURE_EMISSION);
|
||||
break;
|
||||
case SpatialMaterial::TextureParam::TEXTURE_NORMAL:
|
||||
mat_info.features.push_back(SpatialMaterial::Feature::FEATURE_NORMAL_MAPPING);
|
||||
case Material3D::TextureParam::TEXTURE_NORMAL:
|
||||
mat_info.features.push_back(Material3D::Feature::FEATURE_NORMAL_MAPPING);
|
||||
break;
|
||||
case SpatialMaterial::TextureParam::TEXTURE_RIM:
|
||||
mat_info.features.push_back(SpatialMaterial::Feature::FEATURE_RIM);
|
||||
case Material3D::TextureParam::TEXTURE_RIM:
|
||||
mat_info.features.push_back(Material3D::Feature::FEATURE_RIM);
|
||||
break;
|
||||
case SpatialMaterial::TextureParam::TEXTURE_CLEARCOAT:
|
||||
mat_info.features.push_back(SpatialMaterial::Feature::FEATURE_CLEARCOAT);
|
||||
case Material3D::TextureParam::TEXTURE_CLEARCOAT:
|
||||
mat_info.features.push_back(Material3D::Feature::FEATURE_CLEARCOAT);
|
||||
break;
|
||||
case SpatialMaterial::TextureParam::TEXTURE_AMBIENT_OCCLUSION:
|
||||
mat_info.features.push_back(SpatialMaterial::Feature::FEATURE_AMBIENT_OCCLUSION);
|
||||
case Material3D::TextureParam::TEXTURE_AMBIENT_OCCLUSION:
|
||||
mat_info.features.push_back(Material3D::Feature::FEATURE_AMBIENT_OCCLUSION);
|
||||
break;
|
||||
case SpatialMaterial::TextureParam::TEXTURE_DEPTH:
|
||||
mat_info.features.push_back(SpatialMaterial::Feature::FEATURE_DEPTH_MAPPING);
|
||||
case Material3D::TextureParam::TEXTURE_DEPTH:
|
||||
mat_info.features.push_back(Material3D::Feature::FEATURE_DEPTH_MAPPING);
|
||||
break;
|
||||
case SpatialMaterial::TextureParam::TEXTURE_SUBSURFACE_SCATTERING:
|
||||
mat_info.features.push_back(SpatialMaterial::Feature::FEATURE_SUBSURACE_SCATTERING);
|
||||
case Material3D::TextureParam::TEXTURE_SUBSURFACE_SCATTERING:
|
||||
mat_info.features.push_back(Material3D::Feature::FEATURE_SUBSURACE_SCATTERING);
|
||||
break;
|
||||
case SpatialMaterial::TextureParam::TEXTURE_TRANSMISSION:
|
||||
mat_info.features.push_back(SpatialMaterial::Feature::FEATURE_TRANSMISSION);
|
||||
case Material3D::TextureParam::TEXTURE_TRANSMISSION:
|
||||
mat_info.features.push_back(Material3D::Feature::FEATURE_TRANSMISSION);
|
||||
break;
|
||||
case SpatialMaterial::TextureParam::TEXTURE_DETAIL_ALBEDO:
|
||||
case SpatialMaterial::TextureParam::TEXTURE_DETAIL_MASK:
|
||||
case SpatialMaterial::TextureParam::TEXTURE_DETAIL_NORMAL:
|
||||
mat_info.features.push_back(SpatialMaterial::Feature::FEATURE_DETAIL);
|
||||
case Material3D::TextureParam::TEXTURE_DETAIL_ALBEDO:
|
||||
case Material3D::TextureParam::TEXTURE_DETAIL_MASK:
|
||||
case Material3D::TextureParam::TEXTURE_DETAIL_NORMAL:
|
||||
mat_info.features.push_back(Material3D::Feature::FEATURE_DETAIL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -247,12 +248,12 @@ T extract_from_prop(FBXDocParser::PropertyPtr prop, const T &p_default, const st
|
|||
return val->Value();
|
||||
}
|
||||
|
||||
Ref<SpatialMaterial> FBXMaterial::import_material(ImportState &state) {
|
||||
Ref<Material3D> FBXMaterial::import_material(ImportState &state) {
|
||||
ERR_FAIL_COND_V(material == nullptr, nullptr);
|
||||
|
||||
const String p_fbx_current_directory = state.path;
|
||||
|
||||
Ref<SpatialMaterial> spatial_material;
|
||||
Ref<Material3D> spatial_material;
|
||||
|
||||
// read the material file
|
||||
// is material two sided
|
||||
|
@ -364,8 +365,8 @@ Ref<SpatialMaterial> FBXMaterial::import_material(ImportState &state) {
|
|||
Color c = spatial_material->get_albedo();
|
||||
c.a = opacity;
|
||||
spatial_material->set_albedo(c);
|
||||
material_info.features.push_back(SpatialMaterial::Feature::FEATURE_TRANSPARENT);
|
||||
spatial_material->set_depth_draw_mode(SpatialMaterial::DEPTH_DRAW_ALPHA_OPAQUE_PREPASS);
|
||||
material_info.features.push_back(Material3D::Feature::FEATURE_TRANSPARENT);
|
||||
spatial_material->set_depth_draw_mode(Material3D::DEPTH_DRAW_ALPHA_OPAQUE_PREPASS);
|
||||
}
|
||||
} else if (vector_value) {
|
||||
print_error("unsupported transparent desc type vector!");
|
||||
|
@ -410,7 +411,7 @@ Ref<SpatialMaterial> FBXMaterial::import_material(ImportState &state) {
|
|||
} break;
|
||||
case PROPERTY_DESC_COAT: {
|
||||
if (real_value) {
|
||||
material_info.features.push_back(SpatialMaterial::Feature::FEATURE_CLEARCOAT);
|
||||
material_info.features.push_back(Material3D::Feature::FEATURE_CLEARCOAT);
|
||||
print_verbose("clearcoat real value: " + rtos(real_value->Value()));
|
||||
spatial_material->set_clearcoat(MIN(1.0f, real_value->Value()));
|
||||
} else {
|
||||
|
@ -423,7 +424,7 @@ Ref<SpatialMaterial> FBXMaterial::import_material(ImportState &state) {
|
|||
print_verbose("clearcoat real value: " + rtos(real_value->Value()));
|
||||
spatial_material->set_clearcoat_gloss(1.0 - real_value->Value());
|
||||
|
||||
material_info.features.push_back(SpatialMaterial::Feature::FEATURE_CLEARCOAT);
|
||||
material_info.features.push_back(Material3D::Feature::FEATURE_CLEARCOAT);
|
||||
} else {
|
||||
print_error("unsupported value type for clearcoat gloss");
|
||||
}
|
||||
|
@ -432,7 +433,7 @@ Ref<SpatialMaterial> FBXMaterial::import_material(ImportState &state) {
|
|||
if (real_value && Math::is_equal_approx(real_value->Value(), 0.0f)) {
|
||||
print_verbose("Emissive real value: " + rtos(real_value->Value()));
|
||||
spatial_material->set_emission_energy(real_value->Value());
|
||||
material_info.features.push_back(SpatialMaterial::Feature::FEATURE_EMISSION);
|
||||
material_info.features.push_back(Material3D::Feature::FEATURE_EMISSION);
|
||||
} else if (vector_value && !vector_value->Value().is_equal_approx(Vector3(0, 0, 0))) {
|
||||
const Vector3 &color = vector_value->Value();
|
||||
Color c;
|
||||
|
@ -440,7 +441,7 @@ Ref<SpatialMaterial> FBXMaterial::import_material(ImportState &state) {
|
|||
c[1] = color[1];
|
||||
c[2] = color[2];
|
||||
spatial_material->set_emission(c);
|
||||
material_info.features.push_back(SpatialMaterial::Feature::FEATURE_EMISSION);
|
||||
material_info.features.push_back(Material3D::Feature::FEATURE_EMISSION);
|
||||
}
|
||||
} break;
|
||||
case PROPERTY_DESC_EMISSIVE_COLOR: {
|
||||
|
@ -548,31 +549,31 @@ Ref<SpatialMaterial> FBXMaterial::import_material(ImportState &state) {
|
|||
}
|
||||
|
||||
switch (mapping.map_mode) {
|
||||
case SpatialMaterial::TextureParam::TEXTURE_METALLIC:
|
||||
case Material3D::TextureParam::TEXTURE_METALLIC:
|
||||
if (mapping.name.to_lower().find("ser") >= 0) {
|
||||
// SER shader.
|
||||
spatial_material->set_metallic_texture_channel(SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_RED);
|
||||
spatial_material->set_metallic_texture_channel(Material3D::TextureChannel::TEXTURE_CHANNEL_RED);
|
||||
} else {
|
||||
// Use grayscale as default.
|
||||
spatial_material->set_metallic_texture_channel(SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_GRAYSCALE);
|
||||
spatial_material->set_metallic_texture_channel(Material3D::TextureChannel::TEXTURE_CHANNEL_GRAYSCALE);
|
||||
}
|
||||
break;
|
||||
case SpatialMaterial::TextureParam::TEXTURE_ROUGHNESS:
|
||||
case Material3D::TextureParam::TEXTURE_ROUGHNESS:
|
||||
if (mapping.name.to_lower().find("ser") >= 0) {
|
||||
// SER shader.
|
||||
spatial_material->set_roughness_texture_channel(SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_BLUE);
|
||||
spatial_material->set_roughness_texture_channel(Material3D::TextureChannel::TEXTURE_CHANNEL_BLUE);
|
||||
} else {
|
||||
// Use grayscale as default.
|
||||
spatial_material->set_roughness_texture_channel(SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_GRAYSCALE);
|
||||
spatial_material->set_roughness_texture_channel(Material3D::TextureChannel::TEXTURE_CHANNEL_GRAYSCALE);
|
||||
}
|
||||
break;
|
||||
case SpatialMaterial::TextureParam::TEXTURE_AMBIENT_OCCLUSION:
|
||||
case Material3D::TextureParam::TEXTURE_AMBIENT_OCCLUSION:
|
||||
// Use grayscale as default.
|
||||
spatial_material->set_ao_texture_channel(SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_GRAYSCALE);
|
||||
spatial_material->set_ao_texture_channel(Material3D::TextureChannel::TEXTURE_CHANNEL_GRAYSCALE);
|
||||
break;
|
||||
case SpatialMaterial::TextureParam::TEXTURE_REFRACTION:
|
||||
case Material3D::TextureParam::TEXTURE_REFRACTION:
|
||||
// Use grayscale as default.
|
||||
spatial_material->set_refraction_texture_channel(SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_GRAYSCALE);
|
||||
spatial_material->set_refraction_texture_channel(Material3D::TextureChannel::TEXTURE_CHANNEL_GRAYSCALE);
|
||||
break;
|
||||
default:
|
||||
// Nothing to do.
|
||||
|
|
|
@ -71,41 +71,41 @@ struct FBXMaterial : public Reference {
|
|||
};
|
||||
|
||||
/* Returns the string representation of the TextureParam enum */
|
||||
static String get_texture_param_name(SpatialMaterial::TextureParam param) {
|
||||
static String get_texture_param_name(Material3D::TextureParam param) {
|
||||
switch (param) {
|
||||
case SpatialMaterial::TEXTURE_ALBEDO:
|
||||
case Material3D::TEXTURE_ALBEDO:
|
||||
return "TEXTURE_ALBEDO";
|
||||
case SpatialMaterial::TEXTURE_METALLIC:
|
||||
case Material3D::TEXTURE_METALLIC:
|
||||
return "TEXTURE_METALLIC";
|
||||
case SpatialMaterial::TEXTURE_ROUGHNESS:
|
||||
case Material3D::TEXTURE_ROUGHNESS:
|
||||
return "TEXTURE_ROUGHNESS";
|
||||
case SpatialMaterial::TEXTURE_EMISSION:
|
||||
case Material3D::TEXTURE_EMISSION:
|
||||
return "TEXTURE_EMISSION";
|
||||
case SpatialMaterial::TEXTURE_NORMAL:
|
||||
case Material3D::TEXTURE_NORMAL:
|
||||
return "TEXTURE_NORMAL";
|
||||
case SpatialMaterial::TEXTURE_RIM:
|
||||
case Material3D::TEXTURE_RIM:
|
||||
return "TEXTURE_RIM";
|
||||
case SpatialMaterial::TEXTURE_CLEARCOAT:
|
||||
case Material3D::TEXTURE_CLEARCOAT:
|
||||
return "TEXTURE_CLEARCOAT";
|
||||
case SpatialMaterial::TEXTURE_FLOWMAP:
|
||||
case Material3D::TEXTURE_FLOWMAP:
|
||||
return "TEXTURE_FLOWMAP";
|
||||
case SpatialMaterial::TEXTURE_AMBIENT_OCCLUSION:
|
||||
case Material3D::TEXTURE_AMBIENT_OCCLUSION:
|
||||
return "TEXTURE_AMBIENT_OCCLUSION";
|
||||
case SpatialMaterial::TEXTURE_DEPTH:
|
||||
case Material3D::TEXTURE_DEPTH:
|
||||
return "TEXTURE_DEPTH";
|
||||
case SpatialMaterial::TEXTURE_SUBSURFACE_SCATTERING:
|
||||
case Material3D::TEXTURE_SUBSURFACE_SCATTERING:
|
||||
return "TEXTURE_SUBSURFACE_SCATTERING";
|
||||
case SpatialMaterial::TEXTURE_TRANSMISSION:
|
||||
case Material3D::TEXTURE_TRANSMISSION:
|
||||
return "TEXTURE_TRANSMISSION";
|
||||
case SpatialMaterial::TEXTURE_REFRACTION:
|
||||
case Material3D::TEXTURE_REFRACTION:
|
||||
return "TEXTURE_REFRACTION";
|
||||
case SpatialMaterial::TEXTURE_DETAIL_MASK:
|
||||
case Material3D::TEXTURE_DETAIL_MASK:
|
||||
return "TEXTURE_DETAIL_MASK";
|
||||
case SpatialMaterial::TEXTURE_DETAIL_ALBEDO:
|
||||
case Material3D::TEXTURE_DETAIL_ALBEDO:
|
||||
return "TEXTURE_DETAIL_ALBEDO";
|
||||
case SpatialMaterial::TEXTURE_DETAIL_NORMAL:
|
||||
case Material3D::TEXTURE_DETAIL_NORMAL:
|
||||
return "TEXTURE_DETAIL_NORMAL";
|
||||
case SpatialMaterial::TEXTURE_MAX:
|
||||
case Material3D::TEXTURE_MAX:
|
||||
return "TEXTURE_MAX";
|
||||
default:
|
||||
return "broken horribly";
|
||||
|
@ -113,69 +113,69 @@ struct FBXMaterial : public Reference {
|
|||
};
|
||||
|
||||
// TODO make this static?
|
||||
const std::map<std::string, SpatialMaterial::Feature> fbx_feature_mapping_desc = {
|
||||
const std::map<std::string, Material3D::Feature> fbx_feature_mapping_desc = {
|
||||
/* Transparent */
|
||||
{ "TransparentColor", SpatialMaterial::Feature::FEATURE_TRANSPARENT },
|
||||
{ "Maya|opacity", SpatialMaterial::Feature::FEATURE_TRANSPARENT }
|
||||
{ "TransparentColor", Material3D::Feature::FEATURE_TRANSPARENT },
|
||||
{ "Maya|opacity", Material3D::Feature::FEATURE_TRANSPARENT }
|
||||
};
|
||||
|
||||
// TODO make this static?
|
||||
const std::map<std::string, SpatialMaterial::TextureParam> fbx_texture_mapping_desc = {
|
||||
const std::map<std::string, Material3D::TextureParam> fbx_texture_mapping_desc = {
|
||||
/* Diffuse */
|
||||
{ "Maya|base", SpatialMaterial::TextureParam::TEXTURE_ALBEDO },
|
||||
{ "DiffuseColor", SpatialMaterial::TextureParam::TEXTURE_ALBEDO },
|
||||
{ "Maya|DiffuseTexture", SpatialMaterial::TextureParam::TEXTURE_ALBEDO },
|
||||
{ "Maya|baseColor", SpatialMaterial::TextureParam::TEXTURE_ALBEDO },
|
||||
{ "Maya|baseColor|file", SpatialMaterial::TextureParam::TEXTURE_ALBEDO },
|
||||
{ "3dsMax|Parameters|base_color_map", SpatialMaterial::TextureParam::TEXTURE_ALBEDO },
|
||||
{ "Maya|TEX_color_map|file", SpatialMaterial::TextureParam::TEXTURE_ALBEDO },
|
||||
{ "Maya|TEX_color_map", SpatialMaterial::TextureParam::TEXTURE_ALBEDO },
|
||||
{ "Maya|base", Material3D::TextureParam::TEXTURE_ALBEDO },
|
||||
{ "DiffuseColor", Material3D::TextureParam::TEXTURE_ALBEDO },
|
||||
{ "Maya|DiffuseTexture", Material3D::TextureParam::TEXTURE_ALBEDO },
|
||||
{ "Maya|baseColor", Material3D::TextureParam::TEXTURE_ALBEDO },
|
||||
{ "Maya|baseColor|file", Material3D::TextureParam::TEXTURE_ALBEDO },
|
||||
{ "3dsMax|Parameters|base_color_map", Material3D::TextureParam::TEXTURE_ALBEDO },
|
||||
{ "Maya|TEX_color_map|file", Material3D::TextureParam::TEXTURE_ALBEDO },
|
||||
{ "Maya|TEX_color_map", Material3D::TextureParam::TEXTURE_ALBEDO },
|
||||
/* Emission */
|
||||
{ "EmissiveColor", SpatialMaterial::TextureParam::TEXTURE_EMISSION },
|
||||
{ "EmissiveFactor", SpatialMaterial::TextureParam::TEXTURE_EMISSION },
|
||||
{ "Maya|emissionColor", SpatialMaterial::TextureParam::TEXTURE_EMISSION },
|
||||
{ "Maya|emissionColor|file", SpatialMaterial::TextureParam::TEXTURE_EMISSION },
|
||||
{ "3dsMax|Parameters|emission_map", SpatialMaterial::TextureParam::TEXTURE_EMISSION },
|
||||
{ "Maya|TEX_emissive_map", SpatialMaterial::TextureParam::TEXTURE_EMISSION },
|
||||
{ "Maya|TEX_emissive_map|file", SpatialMaterial::TextureParam::TEXTURE_EMISSION },
|
||||
{ "EmissiveColor", Material3D::TextureParam::TEXTURE_EMISSION },
|
||||
{ "EmissiveFactor", Material3D::TextureParam::TEXTURE_EMISSION },
|
||||
{ "Maya|emissionColor", Material3D::TextureParam::TEXTURE_EMISSION },
|
||||
{ "Maya|emissionColor|file", Material3D::TextureParam::TEXTURE_EMISSION },
|
||||
{ "3dsMax|Parameters|emission_map", Material3D::TextureParam::TEXTURE_EMISSION },
|
||||
{ "Maya|TEX_emissive_map", Material3D::TextureParam::TEXTURE_EMISSION },
|
||||
{ "Maya|TEX_emissive_map|file", Material3D::TextureParam::TEXTURE_EMISSION },
|
||||
/* Metallic */
|
||||
{ "Maya|metalness", SpatialMaterial::TextureParam::TEXTURE_METALLIC },
|
||||
{ "Maya|metalness|file", SpatialMaterial::TextureParam::TEXTURE_METALLIC },
|
||||
{ "3dsMax|Parameters|metalness_map", SpatialMaterial::TextureParam::TEXTURE_METALLIC },
|
||||
{ "Maya|TEX_metallic_map", SpatialMaterial::TextureParam::TEXTURE_METALLIC },
|
||||
{ "Maya|TEX_metallic_map|file", SpatialMaterial::TextureParam::TEXTURE_METALLIC },
|
||||
{ "SpecularColor", SpatialMaterial::TextureParam::TEXTURE_METALLIC },
|
||||
{ "Maya|specularColor", SpatialMaterial::TextureParam::TEXTURE_METALLIC },
|
||||
{ "Maya|SpecularTexture", SpatialMaterial::TextureParam::TEXTURE_METALLIC },
|
||||
{ "Maya|SpecularTexture|file", SpatialMaterial::TextureParam::TEXTURE_METALLIC },
|
||||
{ "Maya|metalness", Material3D::TextureParam::TEXTURE_METALLIC },
|
||||
{ "Maya|metalness|file", Material3D::TextureParam::TEXTURE_METALLIC },
|
||||
{ "3dsMax|Parameters|metalness_map", Material3D::TextureParam::TEXTURE_METALLIC },
|
||||
{ "Maya|TEX_metallic_map", Material3D::TextureParam::TEXTURE_METALLIC },
|
||||
{ "Maya|TEX_metallic_map|file", Material3D::TextureParam::TEXTURE_METALLIC },
|
||||
{ "SpecularColor", Material3D::TextureParam::TEXTURE_METALLIC },
|
||||
{ "Maya|specularColor", Material3D::TextureParam::TEXTURE_METALLIC },
|
||||
{ "Maya|SpecularTexture", Material3D::TextureParam::TEXTURE_METALLIC },
|
||||
{ "Maya|SpecularTexture|file", Material3D::TextureParam::TEXTURE_METALLIC },
|
||||
|
||||
/* Roughness */
|
||||
// Arnold Roughness Map
|
||||
{ "Maya|specularRoughness", SpatialMaterial::TextureParam::TEXTURE_ROUGHNESS },
|
||||
{ "Maya|specularRoughness", Material3D::TextureParam::TEXTURE_ROUGHNESS },
|
||||
|
||||
{ "3dsMax|Parameters|roughness_map", SpatialMaterial::TextureParam::TEXTURE_ROUGHNESS },
|
||||
{ "Maya|TEX_roughness_map", SpatialMaterial::TextureParam::TEXTURE_ROUGHNESS },
|
||||
{ "Maya|TEX_roughness_map|file", SpatialMaterial::TextureParam::TEXTURE_ROUGHNESS },
|
||||
{ "3dsMax|Parameters|roughness_map", Material3D::TextureParam::TEXTURE_ROUGHNESS },
|
||||
{ "Maya|TEX_roughness_map", Material3D::TextureParam::TEXTURE_ROUGHNESS },
|
||||
{ "Maya|TEX_roughness_map|file", Material3D::TextureParam::TEXTURE_ROUGHNESS },
|
||||
|
||||
/* Normal */
|
||||
{ "NormalMap", SpatialMaterial::TextureParam::TEXTURE_NORMAL },
|
||||
//{ "Bump", SpatialMaterial::TextureParam::TEXTURE_NORMAL },
|
||||
//{ "3dsMax|Parameters|bump_map", SpatialMaterial::TextureParam::TEXTURE_NORMAL },
|
||||
{ "Maya|NormalTexture", SpatialMaterial::TextureParam::TEXTURE_NORMAL },
|
||||
//{ "Maya|normalCamera", SpatialMaterial::TextureParam::TEXTURE_NORMAL },
|
||||
//{ "Maya|normalCamera|file", SpatialMaterial::TextureParam::TEXTURE_NORMAL },
|
||||
{ "Maya|TEX_normal_map", SpatialMaterial::TextureParam::TEXTURE_NORMAL },
|
||||
{ "Maya|TEX_normal_map|file", SpatialMaterial::TextureParam::TEXTURE_NORMAL },
|
||||
{ "NormalMap", Material3D::TextureParam::TEXTURE_NORMAL },
|
||||
//{ "Bump", Material3D::TextureParam::TEXTURE_NORMAL },
|
||||
//{ "3dsMax|Parameters|bump_map", Material3D::TextureParam::TEXTURE_NORMAL },
|
||||
{ "Maya|NormalTexture", Material3D::TextureParam::TEXTURE_NORMAL },
|
||||
//{ "Maya|normalCamera", Material3D::TextureParam::TEXTURE_NORMAL },
|
||||
//{ "Maya|normalCamera|file", Material3D::TextureParam::TEXTURE_NORMAL },
|
||||
{ "Maya|TEX_normal_map", Material3D::TextureParam::TEXTURE_NORMAL },
|
||||
{ "Maya|TEX_normal_map|file", Material3D::TextureParam::TEXTURE_NORMAL },
|
||||
/* AO */
|
||||
{ "Maya|TEX_ao_map", SpatialMaterial::TextureParam::TEXTURE_AMBIENT_OCCLUSION },
|
||||
{ "Maya|TEX_ao_map|file", SpatialMaterial::TextureParam::TEXTURE_AMBIENT_OCCLUSION },
|
||||
{ "Maya|TEX_ao_map", Material3D::TextureParam::TEXTURE_AMBIENT_OCCLUSION },
|
||||
{ "Maya|TEX_ao_map|file", Material3D::TextureParam::TEXTURE_AMBIENT_OCCLUSION },
|
||||
|
||||
//{ "Maya|diffuseRoughness", SpatialMaterial::TextureParam::UNSUPPORTED },
|
||||
//{ "Maya|diffuseRoughness|file", SpatialMaterial::TextureParam::UNSUPPORTED },
|
||||
//{ "ShininessExponent", SpatialMaterial::TextureParam::UNSUPPORTED },
|
||||
//{ "ReflectionFactor", SpatialMaterial::TextureParam::UNSUPPORTED },
|
||||
//{ "TransparentColor",SpatialMaterial::TextureParam::TEXTURE_CHANNEL_ALPHA },
|
||||
//{ "TransparencyFactor",SpatialMaterial::TextureParam::TEXTURE_CHANNEL_ALPHA }
|
||||
//{ "Maya|diffuseRoughness", Material3D::TextureParam::UNSUPPORTED },
|
||||
//{ "Maya|diffuseRoughness|file", Material3D::TextureParam::UNSUPPORTED },
|
||||
//{ "ShininessExponent", Material3D::TextureParam::UNSUPPORTED },
|
||||
//{ "ReflectionFactor", Material3D::TextureParam::UNSUPPORTED },
|
||||
//{ "TransparentColor",Material3D::TextureParam::TEXTURE_CHANNEL_ALPHA },
|
||||
//{ "TransparencyFactor",Material3D::TextureParam::TEXTURE_CHANNEL_ALPHA }
|
||||
};
|
||||
|
||||
// TODO make this static?
|
||||
|
@ -261,7 +261,7 @@ struct FBXMaterial : public Reference {
|
|||
};
|
||||
|
||||
struct TextureFileMapping {
|
||||
SpatialMaterial::TextureParam map_mode = SpatialMaterial::TEXTURE_ALBEDO;
|
||||
Material3D::TextureParam map_mode = Material3D::TEXTURE_ALBEDO;
|
||||
String name = String();
|
||||
const FBXDocParser::Texture *texture = nullptr;
|
||||
};
|
||||
|
@ -269,7 +269,7 @@ struct FBXMaterial : public Reference {
|
|||
/* storing the texture properties like color */
|
||||
template <class T>
|
||||
struct TexturePropertyMapping : Reference {
|
||||
SpatialMaterial::TextureParam map_mode = SpatialMaterial::TextureParam::TEXTURE_ALBEDO;
|
||||
Material3D::TextureParam map_mode = Material3D::TextureParam::TEXTURE_ALBEDO;
|
||||
const T property = T();
|
||||
};
|
||||
|
||||
|
@ -283,12 +283,12 @@ struct FBXMaterial : public Reference {
|
|||
|
||||
struct MaterialInfo {
|
||||
Vector<TextureFileMapping> textures;
|
||||
Vector<SpatialMaterial::Feature> features;
|
||||
Vector<Material3D::Feature> features;
|
||||
};
|
||||
/// Extracts the material information.
|
||||
MaterialInfo extract_material_info(const FBXDocParser::Material *material) const;
|
||||
|
||||
Ref<SpatialMaterial> import_material(ImportState &state);
|
||||
Ref<Material3D> import_material(ImportState &state);
|
||||
};
|
||||
|
||||
#endif // FBX_MATERIAL_H
|
||||
|
|
|
@ -110,7 +110,7 @@ struct SurfaceData {
|
|||
Ref<SurfaceTool> surface_tool;
|
||||
OrderedHashMap<Vertex, int> lookup_table; // proposed fix is to replace lookup_table[vertex_id] to give the position of the vertices_map[int] index.
|
||||
LocalVector<Vertex> vertices_map; // this must be ordered the same as insertion <-- slow to do find() operation.
|
||||
Ref<SpatialMaterial> material;
|
||||
Ref<Material3D> material;
|
||||
HashMap<PolygonId, Vector<DataIndex>> surface_polygon_vertex;
|
||||
Array morphs;
|
||||
};
|
||||
|
|
|
@ -67,7 +67,7 @@ struct ImportState {
|
|||
bool is_blender_fbx = false;
|
||||
|
||||
Map<StringName, Ref<Texture>> cached_image_searches;
|
||||
Map<uint64_t, Ref<SpatialMaterial>> cached_materials;
|
||||
Map<uint64_t, Ref<Material3D>> cached_materials;
|
||||
|
||||
String path = String();
|
||||
Spatial *root_owner = nullptr;
|
||||
|
|
|
@ -530,7 +530,7 @@ Spatial *EditorSceneImporterFBX::_generate_scene(
|
|||
material.instance();
|
||||
material->set_imported_material(mat);
|
||||
|
||||
Ref<SpatialMaterial> godot_material = material->import_material(state);
|
||||
Ref<Material3D> godot_material = material->import_material(state);
|
||||
|
||||
state.cached_materials.insert(material_id, godot_material);
|
||||
}
|
||||
|
|
|
@ -2587,7 +2587,7 @@ Error GLTFDocument::_serialize_meshes(Ref<GLTFState> p_state) {
|
|||
if (surface_i < instance_materials.size()) {
|
||||
v = instance_materials.get(surface_i);
|
||||
}
|
||||
Ref<SpatialMaterial> mat = v;
|
||||
Ref<Material3D> mat = v;
|
||||
if (!mat.is_valid()) {
|
||||
mat = import_mesh->surface_get_material(surface_i);
|
||||
}
|
||||
|
@ -2919,20 +2919,20 @@ Error GLTFDocument::_parse_meshes(Ref<GLTFState> p_state) {
|
|||
|
||||
//just add it
|
||||
|
||||
Ref<SpatialMaterial> mat;
|
||||
Ref<Material3D> mat;
|
||||
if (p.has("material")) {
|
||||
const int material = p["material"];
|
||||
ERR_FAIL_INDEX_V(material, p_state->materials.size(), ERR_FILE_CORRUPT);
|
||||
Ref<SpatialMaterial> mat3d = p_state->materials[material];
|
||||
Ref<Material3D> mat3d = p_state->materials[material];
|
||||
if (has_vertex_color) {
|
||||
mat3d->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
mat3d->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
}
|
||||
mat = mat3d;
|
||||
|
||||
} else if (has_vertex_color) {
|
||||
Ref<SpatialMaterial> mat3d;
|
||||
Ref<Material3D> mat3d;
|
||||
mat3d.instance();
|
||||
mat3d->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
mat3d->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
mat = mat3d;
|
||||
}
|
||||
int32_t mat_idx = import_mesh->get_surface_count();
|
||||
|
@ -3377,7 +3377,7 @@ Error GLTFDocument::_serialize_materials(Ref<GLTFState> p_state) {
|
|||
for (int32_t i = 0; i < p_state->materials.size(); i++) {
|
||||
Dictionary d;
|
||||
|
||||
Ref<SpatialMaterial> material = p_state->materials[i];
|
||||
Ref<Material3D> material = p_state->materials[i];
|
||||
if (material.is_null()) {
|
||||
materials.push_back(d);
|
||||
continue;
|
||||
|
@ -3398,7 +3398,7 @@ Error GLTFDocument::_serialize_materials(Ref<GLTFState> p_state) {
|
|||
}
|
||||
{
|
||||
Dictionary bct;
|
||||
Ref<Texture> albedo_texture = material->get_texture(SpatialMaterial::TEXTURE_ALBEDO);
|
||||
Ref<Texture> albedo_texture = material->get_texture(Material3D::TEXTURE_ALBEDO);
|
||||
GLTFTextureIndex gltf_texture_index = -1;
|
||||
|
||||
if (albedo_texture.is_valid() && albedo_texture->get_data().is_valid()) {
|
||||
|
@ -3418,17 +3418,17 @@ Error GLTFDocument::_serialize_materials(Ref<GLTFState> p_state) {
|
|||
|
||||
mr["metallicFactor"] = material->get_metallic();
|
||||
mr["roughnessFactor"] = material->get_roughness();
|
||||
bool has_roughness = material->get_texture(SpatialMaterial::TEXTURE_ROUGHNESS).is_valid() && material->get_texture(SpatialMaterial::TEXTURE_ROUGHNESS)->get_data().is_valid();
|
||||
bool has_ao = material->get_feature(SpatialMaterial::FEATURE_AMBIENT_OCCLUSION) && material->get_texture(SpatialMaterial::TEXTURE_AMBIENT_OCCLUSION).is_valid();
|
||||
bool has_metalness = material->get_texture(SpatialMaterial::TEXTURE_METALLIC).is_valid() && material->get_texture(SpatialMaterial::TEXTURE_METALLIC)->get_data().is_valid();
|
||||
bool has_roughness = material->get_texture(Material3D::TEXTURE_ROUGHNESS).is_valid() && material->get_texture(Material3D::TEXTURE_ROUGHNESS)->get_data().is_valid();
|
||||
bool has_ao = material->get_feature(Material3D::FEATURE_AMBIENT_OCCLUSION) && material->get_texture(Material3D::TEXTURE_AMBIENT_OCCLUSION).is_valid();
|
||||
bool has_metalness = material->get_texture(Material3D::TEXTURE_METALLIC).is_valid() && material->get_texture(Material3D::TEXTURE_METALLIC)->get_data().is_valid();
|
||||
if (has_ao || has_roughness || has_metalness) {
|
||||
Dictionary mrt;
|
||||
Ref<Texture> roughness_texture = material->get_texture(SpatialMaterial::TEXTURE_ROUGHNESS);
|
||||
SpatialMaterial::TextureChannel roughness_channel = material->get_roughness_texture_channel();
|
||||
Ref<Texture> metallic_texture = material->get_texture(SpatialMaterial::TEXTURE_METALLIC);
|
||||
SpatialMaterial::TextureChannel metalness_channel = material->get_metallic_texture_channel();
|
||||
Ref<Texture> ao_texture = material->get_texture(SpatialMaterial::TEXTURE_AMBIENT_OCCLUSION);
|
||||
SpatialMaterial::TextureChannel ao_channel = material->get_ao_texture_channel();
|
||||
Ref<Texture> roughness_texture = material->get_texture(Material3D::TEXTURE_ROUGHNESS);
|
||||
Material3D::TextureChannel roughness_channel = material->get_roughness_texture_channel();
|
||||
Ref<Texture> metallic_texture = material->get_texture(Material3D::TEXTURE_METALLIC);
|
||||
Material3D::TextureChannel metalness_channel = material->get_metallic_texture_channel();
|
||||
Ref<Texture> ao_texture = material->get_texture(Material3D::TEXTURE_AMBIENT_OCCLUSION);
|
||||
Material3D::TextureChannel ao_channel = material->get_ao_texture_channel();
|
||||
Ref<ImageTexture> orm_texture;
|
||||
orm_texture.instance();
|
||||
Ref<Image> orm_image;
|
||||
|
@ -3474,7 +3474,7 @@ Error GLTFDocument::_serialize_materials(Ref<GLTFState> p_state) {
|
|||
metallness_image->decompress();
|
||||
}
|
||||
}
|
||||
Ref<Texture> albedo_texture = material->get_texture(SpatialMaterial::TEXTURE_ALBEDO);
|
||||
Ref<Texture> albedo_texture = material->get_texture(Material3D::TEXTURE_ALBEDO);
|
||||
if (albedo_texture.is_valid() && albedo_texture->get_data().is_valid()) {
|
||||
height = albedo_texture->get_height();
|
||||
width = albedo_texture->get_width();
|
||||
|
@ -3495,39 +3495,39 @@ Error GLTFDocument::_serialize_materials(Ref<GLTFState> p_state) {
|
|||
Color c = Color(1.0f, 1.0f, 1.0f);
|
||||
if (has_ao) {
|
||||
ao_image->lock();
|
||||
if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_RED == ao_channel) {
|
||||
if (Material3D::TextureChannel::TEXTURE_CHANNEL_RED == ao_channel) {
|
||||
c.r = ao_image->get_pixel(w, h).r;
|
||||
} else if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_GREEN == ao_channel) {
|
||||
} else if (Material3D::TextureChannel::TEXTURE_CHANNEL_GREEN == ao_channel) {
|
||||
c.r = ao_image->get_pixel(w, h).g;
|
||||
} else if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_BLUE == ao_channel) {
|
||||
} else if (Material3D::TextureChannel::TEXTURE_CHANNEL_BLUE == ao_channel) {
|
||||
c.r = ao_image->get_pixel(w, h).b;
|
||||
} else if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_ALPHA == ao_channel) {
|
||||
} else if (Material3D::TextureChannel::TEXTURE_CHANNEL_ALPHA == ao_channel) {
|
||||
c.r = ao_image->get_pixel(w, h).a;
|
||||
}
|
||||
ao_image->lock();
|
||||
}
|
||||
if (has_roughness) {
|
||||
roughness_image->lock();
|
||||
if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_RED == roughness_channel) {
|
||||
if (Material3D::TextureChannel::TEXTURE_CHANNEL_RED == roughness_channel) {
|
||||
c.g = roughness_image->get_pixel(w, h).r;
|
||||
} else if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_GREEN == roughness_channel) {
|
||||
} else if (Material3D::TextureChannel::TEXTURE_CHANNEL_GREEN == roughness_channel) {
|
||||
c.g = roughness_image->get_pixel(w, h).g;
|
||||
} else if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_BLUE == roughness_channel) {
|
||||
} else if (Material3D::TextureChannel::TEXTURE_CHANNEL_BLUE == roughness_channel) {
|
||||
c.g = roughness_image->get_pixel(w, h).b;
|
||||
} else if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_ALPHA == roughness_channel) {
|
||||
} else if (Material3D::TextureChannel::TEXTURE_CHANNEL_ALPHA == roughness_channel) {
|
||||
c.g = roughness_image->get_pixel(w, h).a;
|
||||
}
|
||||
roughness_image->unlock();
|
||||
}
|
||||
if (has_metalness) {
|
||||
metallness_image->lock();
|
||||
if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_RED == metalness_channel) {
|
||||
if (Material3D::TextureChannel::TEXTURE_CHANNEL_RED == metalness_channel) {
|
||||
c.b = metallness_image->get_pixel(w, h).r;
|
||||
} else if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_GREEN == metalness_channel) {
|
||||
} else if (Material3D::TextureChannel::TEXTURE_CHANNEL_GREEN == metalness_channel) {
|
||||
c.b = metallness_image->get_pixel(w, h).g;
|
||||
} else if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_BLUE == metalness_channel) {
|
||||
} else if (Material3D::TextureChannel::TEXTURE_CHANNEL_BLUE == metalness_channel) {
|
||||
c.b = metallness_image->get_pixel(w, h).b;
|
||||
} else if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_ALPHA == metalness_channel) {
|
||||
} else if (Material3D::TextureChannel::TEXTURE_CHANNEL_ALPHA == metalness_channel) {
|
||||
c.b = metallness_image->get_pixel(w, h).a;
|
||||
}
|
||||
metallness_image->unlock();
|
||||
|
@ -3561,12 +3561,12 @@ Error GLTFDocument::_serialize_materials(Ref<GLTFState> p_state) {
|
|||
d["pbrMetallicRoughness"] = mr;
|
||||
}
|
||||
|
||||
if (material->get_feature(SpatialMaterial::FEATURE_NORMAL_MAPPING)) {
|
||||
if (material->get_feature(Material3D::FEATURE_NORMAL_MAPPING)) {
|
||||
Dictionary nt;
|
||||
Ref<ImageTexture> tex;
|
||||
tex.instance();
|
||||
{
|
||||
Ref<Texture> normal_texture = material->get_texture(SpatialMaterial::TEXTURE_NORMAL);
|
||||
Ref<Texture> normal_texture = material->get_texture(Material3D::TEXTURE_NORMAL);
|
||||
if (normal_texture.is_valid()) {
|
||||
// Code for uncompressing RG normal maps
|
||||
Ref<Image> img = normal_texture->get_data();
|
||||
|
@ -3606,7 +3606,7 @@ Error GLTFDocument::_serialize_materials(Ref<GLTFState> p_state) {
|
|||
}
|
||||
}
|
||||
|
||||
if (material->get_feature(SpatialMaterial::FEATURE_EMISSION)) {
|
||||
if (material->get_feature(Material3D::FEATURE_EMISSION)) {
|
||||
const Color c = material->get_emission().to_srgb();
|
||||
Array arr;
|
||||
arr.push_back(c.r);
|
||||
|
@ -3614,9 +3614,9 @@ Error GLTFDocument::_serialize_materials(Ref<GLTFState> p_state) {
|
|||
arr.push_back(c.b);
|
||||
d["emissiveFactor"] = arr;
|
||||
}
|
||||
if (material->get_feature(SpatialMaterial::FEATURE_EMISSION)) {
|
||||
if (material->get_feature(Material3D::FEATURE_EMISSION)) {
|
||||
Dictionary et;
|
||||
Ref<Texture> emission_texture = material->get_texture(SpatialMaterial::TEXTURE_EMISSION);
|
||||
Ref<Texture> emission_texture = material->get_texture(Material3D::TEXTURE_EMISSION);
|
||||
GLTFTextureIndex gltf_texture_index = -1;
|
||||
if (emission_texture.is_valid() && emission_texture->get_data().is_valid()) {
|
||||
emission_texture->set_name(material->get_name() + "_emission");
|
||||
|
@ -3628,12 +3628,12 @@ Error GLTFDocument::_serialize_materials(Ref<GLTFState> p_state) {
|
|||
d["emissiveTexture"] = et;
|
||||
}
|
||||
}
|
||||
const bool ds = material->get_cull_mode() == SpatialMaterial::CULL_DISABLED;
|
||||
const bool ds = material->get_cull_mode() == Material3D::CULL_DISABLED;
|
||||
if (ds) {
|
||||
d["doubleSided"] = ds;
|
||||
}
|
||||
if (material->get_feature(SpatialMaterial::FEATURE_TRANSPARENT)) {
|
||||
if (material->get_flag(SpatialMaterial::FLAG_USE_ALPHA_SCISSOR)) {
|
||||
if (material->get_feature(Material3D::FEATURE_TRANSPARENT)) {
|
||||
if (material->get_flag(Material3D::FLAG_USE_ALPHA_SCISSOR)) {
|
||||
d["alphaMode"] = "MASK";
|
||||
d["alphaCutoff"] = material->get_alpha_scissor_threshold();
|
||||
} else {
|
||||
|
@ -3642,7 +3642,7 @@ Error GLTFDocument::_serialize_materials(Ref<GLTFState> p_state) {
|
|||
}
|
||||
|
||||
Dictionary extensions;
|
||||
if (material->get_flag(SpatialMaterial::FLAG_UNSHADED)) {
|
||||
if (material->get_flag(Material3D::FLAG_UNSHADED)) {
|
||||
Dictionary mat_unlit;
|
||||
extensions["KHR_materials_unlit"] = mat_unlit;
|
||||
p_state->add_used_extension("KHR_materials_unlit");
|
||||
|
@ -3669,7 +3669,7 @@ Error GLTFDocument::_parse_materials(Ref<GLTFState> p_state) {
|
|||
for (GLTFMaterialIndex i = 0; i < materials.size(); i++) {
|
||||
const Dictionary &d = materials[i];
|
||||
|
||||
Ref<SpatialMaterial> material;
|
||||
Ref<Material3D> material;
|
||||
material.instance();
|
||||
if (d.has("name") && !String(d["name"]).empty()) {
|
||||
material->set_name(d["name"]);
|
||||
|
@ -3677,14 +3677,14 @@ Error GLTFDocument::_parse_materials(Ref<GLTFState> p_state) {
|
|||
material->set_name(vformat("material_%s", itos(i)));
|
||||
}
|
||||
|
||||
material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
material->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
Dictionary pbr_spec_gloss_extensions;
|
||||
if (d.has("extensions")) {
|
||||
pbr_spec_gloss_extensions = d["extensions"];
|
||||
}
|
||||
|
||||
if (pbr_spec_gloss_extensions.has("KHR_materials_unlit")) {
|
||||
material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
material->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
}
|
||||
|
||||
if (pbr_spec_gloss_extensions.has("KHR_materials_pbrSpecularGlossiness")) {
|
||||
|
@ -3699,7 +3699,7 @@ Error GLTFDocument::_parse_materials(Ref<GLTFState> p_state) {
|
|||
Ref<Texture> diffuse_texture = _get_texture(p_state, diffuse_texture_dict["index"]);
|
||||
if (diffuse_texture.is_valid()) {
|
||||
spec_gloss->diffuse_img = diffuse_texture->get_data();
|
||||
material->set_texture(SpatialMaterial::TEXTURE_ALBEDO, diffuse_texture);
|
||||
material->set_texture(Material3D::TEXTURE_ALBEDO, diffuse_texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3744,7 +3744,7 @@ Error GLTFDocument::_parse_materials(Ref<GLTFState> p_state) {
|
|||
if (mr.has("baseColorTexture")) {
|
||||
const Dictionary &bct = mr["baseColorTexture"];
|
||||
if (bct.has("index")) {
|
||||
material->set_texture(SpatialMaterial::TEXTURE_ALBEDO, _get_texture(p_state, bct["index"]));
|
||||
material->set_texture(Material3D::TEXTURE_ALBEDO, _get_texture(p_state, bct["index"]));
|
||||
}
|
||||
if (!mr.has("baseColorFactor")) {
|
||||
material->set_albedo(Color(1, 1, 1));
|
||||
|
@ -3768,10 +3768,10 @@ Error GLTFDocument::_parse_materials(Ref<GLTFState> p_state) {
|
|||
const Dictionary &bct = mr["metallicRoughnessTexture"];
|
||||
if (bct.has("index")) {
|
||||
const Ref<Texture> t = _get_texture(p_state, bct["index"]);
|
||||
material->set_texture(SpatialMaterial::TEXTURE_METALLIC, t);
|
||||
material->set_metallic_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_BLUE);
|
||||
material->set_texture(SpatialMaterial::TEXTURE_ROUGHNESS, t);
|
||||
material->set_roughness_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_GREEN);
|
||||
material->set_texture(Material3D::TEXTURE_METALLIC, t);
|
||||
material->set_metallic_texture_channel(Material3D::TEXTURE_CHANNEL_BLUE);
|
||||
material->set_texture(Material3D::TEXTURE_ROUGHNESS, t);
|
||||
material->set_roughness_texture_channel(Material3D::TEXTURE_CHANNEL_GREEN);
|
||||
if (!mr.has("metallicFactor")) {
|
||||
material->set_metallic(1);
|
||||
}
|
||||
|
@ -3785,8 +3785,8 @@ Error GLTFDocument::_parse_materials(Ref<GLTFState> p_state) {
|
|||
if (d.has("normalTexture")) {
|
||||
const Dictionary &bct = d["normalTexture"];
|
||||
if (bct.has("index")) {
|
||||
material->set_texture(SpatialMaterial::TEXTURE_NORMAL, _get_texture(p_state, bct["index"]));
|
||||
material->set_feature(SpatialMaterial::FEATURE_NORMAL_MAPPING, true);
|
||||
material->set_texture(Material3D::TEXTURE_NORMAL, _get_texture(p_state, bct["index"]));
|
||||
material->set_feature(Material3D::FEATURE_NORMAL_MAPPING, true);
|
||||
}
|
||||
if (bct.has("scale")) {
|
||||
material->set_normal_scale(bct["scale"]);
|
||||
|
@ -3795,9 +3795,9 @@ Error GLTFDocument::_parse_materials(Ref<GLTFState> p_state) {
|
|||
if (d.has("occlusionTexture")) {
|
||||
const Dictionary &bct = d["occlusionTexture"];
|
||||
if (bct.has("index")) {
|
||||
material->set_texture(SpatialMaterial::TEXTURE_AMBIENT_OCCLUSION, _get_texture(p_state, bct["index"]));
|
||||
material->set_ao_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_RED);
|
||||
material->set_feature(SpatialMaterial::FEATURE_AMBIENT_OCCLUSION, true);
|
||||
material->set_texture(Material3D::TEXTURE_AMBIENT_OCCLUSION, _get_texture(p_state, bct["index"]));
|
||||
material->set_ao_texture_channel(Material3D::TEXTURE_CHANNEL_RED);
|
||||
material->set_feature(Material3D::FEATURE_AMBIENT_OCCLUSION, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3805,7 +3805,7 @@ Error GLTFDocument::_parse_materials(Ref<GLTFState> p_state) {
|
|||
const Array &arr = d["emissiveFactor"];
|
||||
ERR_FAIL_COND_V(arr.size() != 3, ERR_PARSE_ERROR);
|
||||
const Color c = Color(arr[0], arr[1], arr[2]).to_srgb();
|
||||
material->set_feature(SpatialMaterial::FEATURE_EMISSION, true);
|
||||
material->set_feature(Material3D::FEATURE_EMISSION, true);
|
||||
|
||||
material->set_emission(c);
|
||||
}
|
||||
|
@ -3813,8 +3813,8 @@ Error GLTFDocument::_parse_materials(Ref<GLTFState> p_state) {
|
|||
if (d.has("emissiveTexture")) {
|
||||
const Dictionary &bct = d["emissiveTexture"];
|
||||
if (bct.has("index")) {
|
||||
material->set_texture(SpatialMaterial::TEXTURE_EMISSION, _get_texture(p_state, bct["index"]));
|
||||
material->set_feature(SpatialMaterial::FEATURE_EMISSION, true);
|
||||
material->set_texture(Material3D::TEXTURE_EMISSION, _get_texture(p_state, bct["index"]));
|
||||
material->set_feature(Material3D::FEATURE_EMISSION, true);
|
||||
material->set_emission(Color(0, 0, 0));
|
||||
}
|
||||
}
|
||||
|
@ -3822,17 +3822,17 @@ Error GLTFDocument::_parse_materials(Ref<GLTFState> p_state) {
|
|||
if (d.has("doubleSided")) {
|
||||
const bool ds = d["doubleSided"];
|
||||
if (ds) {
|
||||
material->set_cull_mode(SpatialMaterial::CULL_DISABLED);
|
||||
material->set_cull_mode(Material3D::CULL_DISABLED);
|
||||
}
|
||||
}
|
||||
|
||||
if (d.has("alphaMode")) {
|
||||
const String &am = d["alphaMode"];
|
||||
if (am == "BLEND") {
|
||||
material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
material->set_depth_draw_mode(SpatialMaterial::DEPTH_DRAW_ALPHA_OPAQUE_PREPASS);
|
||||
material->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
material->set_depth_draw_mode(Material3D::DEPTH_DRAW_ALPHA_OPAQUE_PREPASS);
|
||||
} else if (am == "MASK") {
|
||||
material->set_flag(SpatialMaterial::FLAG_USE_ALPHA_SCISSOR, true);
|
||||
material->set_flag(Material3D::FLAG_USE_ALPHA_SCISSOR, true);
|
||||
if (d.has("alphaCutoff")) {
|
||||
material->set_alpha_scissor_threshold(d["alphaCutoff"]);
|
||||
} else {
|
||||
|
@ -3848,7 +3848,7 @@ Error GLTFDocument::_parse_materials(Ref<GLTFState> p_state) {
|
|||
return OK;
|
||||
}
|
||||
|
||||
void GLTFDocument::_set_texture_transform_uv1(const Dictionary &p_dict, Ref<SpatialMaterial> p_material) {
|
||||
void GLTFDocument::_set_texture_transform_uv1(const Dictionary &p_dict, Ref<Material3D> p_material) {
|
||||
if (p_dict.has("extensions")) {
|
||||
const Dictionary &extensions = p_dict["extensions"];
|
||||
if (extensions.has("KHR_texture_transform")) {
|
||||
|
@ -3868,7 +3868,7 @@ void GLTFDocument::_set_texture_transform_uv1(const Dictionary &p_dict, Ref<Spat
|
|||
}
|
||||
}
|
||||
|
||||
void GLTFDocument::spec_gloss_to_rough_metal(Ref<GLTFSpecGloss> r_spec_gloss, Ref<SpatialMaterial> p_material) {
|
||||
void GLTFDocument::spec_gloss_to_rough_metal(Ref<GLTFSpecGloss> r_spec_gloss, Ref<Material3D> p_material) {
|
||||
if (r_spec_gloss->spec_gloss_img.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
@ -3922,18 +3922,18 @@ void GLTFDocument::spec_gloss_to_rough_metal(Ref<GLTFSpecGloss> r_spec_gloss, Re
|
|||
Ref<ImageTexture> diffuse_image_texture;
|
||||
diffuse_image_texture.instance();
|
||||
diffuse_image_texture->create_from_image(r_spec_gloss->diffuse_img);
|
||||
p_material->set_texture(SpatialMaterial::TEXTURE_ALBEDO, diffuse_image_texture);
|
||||
p_material->set_texture(Material3D::TEXTURE_ALBEDO, diffuse_image_texture);
|
||||
Ref<ImageTexture> rm_image_texture;
|
||||
rm_image_texture.instance();
|
||||
rm_image_texture->create_from_image(rm_img);
|
||||
if (has_roughness) {
|
||||
p_material->set_texture(SpatialMaterial::TEXTURE_ROUGHNESS, rm_image_texture);
|
||||
p_material->set_roughness_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_GREEN);
|
||||
p_material->set_texture(Material3D::TEXTURE_ROUGHNESS, rm_image_texture);
|
||||
p_material->set_roughness_texture_channel(Material3D::TEXTURE_CHANNEL_GREEN);
|
||||
}
|
||||
|
||||
if (has_metal) {
|
||||
p_material->set_texture(SpatialMaterial::TEXTURE_METALLIC, rm_image_texture);
|
||||
p_material->set_metallic_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_BLUE);
|
||||
p_material->set_texture(Material3D::TEXTURE_METALLIC, rm_image_texture);
|
||||
p_material->set_metallic_texture_channel(Material3D::TEXTURE_CHANNEL_BLUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6859,7 +6859,7 @@ Dictionary _serialize_texture_transform_uv(Vector2 p_offset, Vector2 p_scale) {
|
|||
return extension;
|
||||
}
|
||||
|
||||
Dictionary GLTFDocument::_serialize_texture_transform_uv1(Ref<SpatialMaterial> p_material) {
|
||||
Dictionary GLTFDocument::_serialize_texture_transform_uv1(Ref<Material3D> p_material) {
|
||||
if (p_material.is_valid()) {
|
||||
Vector3 offset = p_material->get_uv1_offset();
|
||||
Vector3 scale = p_material->get_uv1_scale();
|
||||
|
@ -6868,7 +6868,7 @@ Dictionary GLTFDocument::_serialize_texture_transform_uv1(Ref<SpatialMaterial> p
|
|||
return Dictionary();
|
||||
}
|
||||
|
||||
Dictionary GLTFDocument::_serialize_texture_transform_uv2(Ref<SpatialMaterial> p_material) {
|
||||
Dictionary GLTFDocument::_serialize_texture_transform_uv2(Ref<Material3D> p_material) {
|
||||
if (p_material.is_valid()) {
|
||||
Vector3 offset = p_material->get_uv2_offset();
|
||||
Vector3 scale = p_material->get_uv2_scale();
|
||||
|
|
|
@ -171,9 +171,9 @@ private:
|
|||
Error _parse_textures(Ref<GLTFState> p_state);
|
||||
Error _parse_texture_samplers(Ref<GLTFState> p_state);
|
||||
Error _parse_materials(Ref<GLTFState> p_state);
|
||||
void _set_texture_transform_uv1(const Dictionary &p_dict, Ref<SpatialMaterial> p_material);
|
||||
void _set_texture_transform_uv1(const Dictionary &p_dict, Ref<Material3D> p_material);
|
||||
void spec_gloss_to_rough_metal(Ref<GLTFSpecGloss> r_spec_gloss,
|
||||
Ref<SpatialMaterial> p_material);
|
||||
Ref<Material3D> p_material);
|
||||
static void spec_gloss_to_metal_base_color(const Color &p_specular_factor,
|
||||
const Color &p_diffuse,
|
||||
Color &r_base_color,
|
||||
|
@ -283,8 +283,8 @@ private:
|
|||
GLTFNodeIndex p_node_i);
|
||||
Error _encode_buffer_bins(Ref<GLTFState> p_state, const String &p_path);
|
||||
Error _encode_buffer_glb(Ref<GLTFState> p_state, const String &p_path);
|
||||
Dictionary _serialize_texture_transform_uv1(Ref<SpatialMaterial> p_material);
|
||||
Dictionary _serialize_texture_transform_uv2(Ref<SpatialMaterial> p_material);
|
||||
Dictionary _serialize_texture_transform_uv1(Ref<Material3D> p_material);
|
||||
Dictionary _serialize_texture_transform_uv2(Ref<Material3D> p_material);
|
||||
Error _serialize_version(Ref<GLTFState> p_state);
|
||||
Error _serialize_file(Ref<GLTFState> p_state, const String p_path);
|
||||
Error _serialize_gltf_extensions(Ref<GLTFState> p_state) const;
|
||||
|
|
|
@ -1421,8 +1421,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|||
|
||||
inner_mat.instance();
|
||||
inner_mat->set_albedo(Color(0.7, 0.7, 1.0, 0.2));
|
||||
inner_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
inner_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
inner_mat->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
inner_mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
|
||||
d[VS::ARRAY_VERTEX] = triangles;
|
||||
VisualServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh, VS::PRIMITIVE_TRIANGLES, d);
|
||||
|
@ -1431,14 +1431,14 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|||
outer_mat.instance();
|
||||
outer_mat->set_albedo(Color(0.7, 0.7, 1.0, 0.8));
|
||||
outer_mat->set_on_top_of_alpha();
|
||||
outer_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
outer_mat->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
outer_mat->set_line_width(3.0);
|
||||
outer_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
outer_mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
|
||||
selection_floor_mat.instance();
|
||||
selection_floor_mat->set_albedo(Color(0.80, 0.80, 1.0, 1));
|
||||
selection_floor_mat->set_on_top_of_alpha();
|
||||
selection_floor_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
selection_floor_mat->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
selection_floor_mat->set_line_width(3.0);
|
||||
|
||||
d[VS::ARRAY_VERTEX] = lines;
|
||||
|
@ -1466,10 +1466,10 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|||
accumulated_floor_delta = 0.0;
|
||||
|
||||
indicator_mat.instance();
|
||||
indicator_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
indicator_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
indicator_mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
indicator_mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
indicator_mat->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
indicator_mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
indicator_mat->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
indicator_mat->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
indicator_mat->set_albedo(Color(0.8, 0.5, 0.1));
|
||||
}
|
||||
|
||||
|
|
|
@ -124,10 +124,10 @@ class GridMapEditor : public VBoxContainer {
|
|||
|
||||
List<ClipboardItem> clipboard_items;
|
||||
|
||||
Ref<SpatialMaterial> indicator_mat;
|
||||
Ref<SpatialMaterial> inner_mat;
|
||||
Ref<SpatialMaterial> outer_mat;
|
||||
Ref<SpatialMaterial> selection_floor_mat;
|
||||
Ref<Material3D> indicator_mat;
|
||||
Ref<Material3D> inner_mat;
|
||||
Ref<Material3D> outer_mat;
|
||||
Ref<Material3D> selection_floor_mat;
|
||||
|
||||
bool updating;
|
||||
|
||||
|
|
|
@ -451,7 +451,7 @@ void BakedLightmap::_find_meshes_and_lights(Node *p_at_node, Vector<MeshesFound>
|
|||
|
||||
void BakedLightmap::_get_material_images(const MeshesFound &p_found_mesh, Lightmapper::MeshData &r_mesh_data, Vector<Ref<Texture>> &r_albedo_textures, Vector<Ref<Texture>> &r_emission_textures) {
|
||||
for (int i = 0; i < p_found_mesh.mesh->get_surface_count(); ++i) {
|
||||
Ref<SpatialMaterial> mat = p_found_mesh.overrides[i];
|
||||
Ref<Material3D> mat = p_found_mesh.overrides[i];
|
||||
|
||||
if (mat.is_null()) {
|
||||
mat = p_found_mesh.mesh->surface_get_material(i);
|
||||
|
@ -466,7 +466,7 @@ void BakedLightmap::_get_material_images(const MeshesFound &p_found_mesh, Lightm
|
|||
Color emission_mul = Color(1, 1, 1, 1);
|
||||
|
||||
if (mat.is_valid()) {
|
||||
albedo_texture = mat->get_texture(SpatialMaterial::TEXTURE_ALBEDO);
|
||||
albedo_texture = mat->get_texture(Material3D::TEXTURE_ALBEDO);
|
||||
|
||||
if (albedo_texture.is_valid()) {
|
||||
albedo_mul = mat->get_albedo();
|
||||
|
@ -475,11 +475,11 @@ void BakedLightmap::_get_material_images(const MeshesFound &p_found_mesh, Lightm
|
|||
albedo_add = mat->get_albedo();
|
||||
}
|
||||
|
||||
emission_texture = mat->get_texture(SpatialMaterial::TEXTURE_EMISSION);
|
||||
emission_texture = mat->get_texture(Material3D::TEXTURE_EMISSION);
|
||||
Color emission_color = mat->get_emission();
|
||||
float emission_energy = mat->get_emission_energy();
|
||||
|
||||
if (mat->get_emission_operator() == SpatialMaterial::EMISSION_OP_ADD) {
|
||||
if (mat->get_emission_operator() == Material3D::EMISSION_OP_ADD) {
|
||||
emission_mul = Color(1, 1, 1) * emission_energy;
|
||||
emission_add = emission_color * emission_energy;
|
||||
} else {
|
||||
|
|
|
@ -209,14 +209,14 @@ String CPUParticles::get_configuration_warning() const {
|
|||
mesh_found = true;
|
||||
for (int j = 0; j < get_mesh()->get_surface_count(); j++) {
|
||||
anim_material_found = Object::cast_to<ShaderMaterial>(get_mesh()->surface_get_material(j).ptr()) != nullptr;
|
||||
SpatialMaterial *spat = Object::cast_to<SpatialMaterial>(get_mesh()->surface_get_material(j).ptr());
|
||||
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == SpatialMaterial::BILLBOARD_PARTICLES);
|
||||
Material3D *spat = Object::cast_to<Material3D>(get_mesh()->surface_get_material(j).ptr());
|
||||
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == Material3D::BILLBOARD_PARTICLES);
|
||||
}
|
||||
}
|
||||
|
||||
anim_material_found = anim_material_found || Object::cast_to<ShaderMaterial>(get_material_override().ptr()) != nullptr;
|
||||
SpatialMaterial *spat = Object::cast_to<SpatialMaterial>(get_material_override().ptr());
|
||||
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == SpatialMaterial::BILLBOARD_PARTICLES);
|
||||
Material3D *spat = Object::cast_to<Material3D>(get_material_override().ptr());
|
||||
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == Material3D::BILLBOARD_PARTICLES);
|
||||
|
||||
if (!mesh_found) {
|
||||
if (warnings != String()) {
|
||||
|
|
|
@ -539,7 +539,7 @@ float Label3D::_generate_glyph_surfaces(const Ref<Font> &p_font, CharType p_char
|
|||
if (!surfaces.has(key)) {
|
||||
SurfaceData surf;
|
||||
surf.material = RID_PRIME(VisualServer::get_singleton()->material_create());
|
||||
// Set defaults for material, names need to match up those in SpatialMaterial
|
||||
// Set defaults for material, names need to match up those in Material3D
|
||||
VS::get_singleton()->material_set_param(surf.material, "albedo", Color(1, 1, 1, 1));
|
||||
VS::get_singleton()->material_set_param(surf.material, "specular", 0.5);
|
||||
VS::get_singleton()->material_set_param(surf.material, "metallic", 0.0);
|
||||
|
@ -550,7 +550,7 @@ float Label3D::_generate_glyph_surfaces(const Ref<Font> &p_font, CharType p_char
|
|||
VS::get_singleton()->material_set_param(surf.material, "uv2_scale", Vector3(1, 1, 1));
|
||||
VS::get_singleton()->material_set_param(surf.material, "alpha_scissor_threshold", alpha_scissor_threshold);
|
||||
|
||||
RID shader_rid = SpatialMaterial::get_material_rid_for_2d(get_draw_flag(FLAG_SHADED), true, get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS, get_billboard_mode() == SpatialMaterial::BILLBOARD_ENABLED, get_billboard_mode() == SpatialMaterial::BILLBOARD_FIXED_Y, get_draw_flag(FLAG_DISABLE_DEPTH_TEST), get_draw_flag(FLAG_FIXED_SIZE), p_font->is_distance_field_hint());
|
||||
RID shader_rid = Material3D::get_material_rid_for_2d(get_draw_flag(FLAG_SHADED), true, get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS, get_billboard_mode() == Material3D::BILLBOARD_ENABLED, get_billboard_mode() == Material3D::BILLBOARD_FIXED_Y, get_draw_flag(FLAG_DISABLE_DEPTH_TEST), get_draw_flag(FLAG_FIXED_SIZE), p_font->is_distance_field_hint());
|
||||
|
||||
VS::get_singleton()->material_set_shader(surf.material, VS::get_singleton()->material_get_shader(shader_rid));
|
||||
VS::get_singleton()->material_set_param(surf.material, "texture_albedo", tex);
|
||||
|
@ -1003,7 +1003,7 @@ bool Label3D::get_draw_flag(DrawFlags p_flag) const {
|
|||
return flags[p_flag];
|
||||
}
|
||||
|
||||
void Label3D::set_billboard_mode(SpatialMaterial::BillboardMode p_mode) {
|
||||
void Label3D::set_billboard_mode(Material3D::BillboardMode p_mode) {
|
||||
ERR_FAIL_INDEX(p_mode, 3);
|
||||
if (billboard_mode != p_mode) {
|
||||
billboard_mode = p_mode;
|
||||
|
@ -1011,7 +1011,7 @@ void Label3D::set_billboard_mode(SpatialMaterial::BillboardMode p_mode) {
|
|||
}
|
||||
}
|
||||
|
||||
SpatialMaterial::BillboardMode Label3D::get_billboard_mode() const {
|
||||
Material3D::BillboardMode Label3D::get_billboard_mode() const {
|
||||
return billboard_mode;
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ private:
|
|||
float line_spacing = 0.f;
|
||||
|
||||
RID base_material;
|
||||
SpatialMaterial::BillboardMode billboard_mode = SpatialMaterial::BILLBOARD_DISABLED;
|
||||
Material3D::BillboardMode billboard_mode = Material3D::BILLBOARD_DISABLED;
|
||||
|
||||
bool pending_update = false;
|
||||
|
||||
|
@ -232,8 +232,8 @@ public:
|
|||
void set_alpha_scissor_threshold(float p_threshold);
|
||||
float get_alpha_scissor_threshold() const;
|
||||
|
||||
void set_billboard_mode(SpatialMaterial::BillboardMode p_mode);
|
||||
SpatialMaterial::BillboardMode get_billboard_mode() const;
|
||||
void set_billboard_mode(Material3D::BillboardMode p_mode);
|
||||
Material3D::BillboardMode get_billboard_mode() const;
|
||||
|
||||
virtual AABB get_aabb() const;
|
||||
Ref<TriangleMesh> generate_triangle_mesh() const;
|
||||
|
|
|
@ -104,7 +104,7 @@ void MeshInstance::_get_property_list(List<PropertyInfo> *p_list) const {
|
|||
|
||||
if (mesh.is_valid()) {
|
||||
for (int i = 0; i < mesh->get_surface_count(); i++) {
|
||||
p_list->push_back(PropertyInfo(Variant::OBJECT, vformat("%s/%d", PNAME("material"), i), PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,SpatialMaterial"));
|
||||
p_list->push_back(PropertyInfo(Variant::OBJECT, vformat("%s/%d", PNAME("material"), i), PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,SpatialMaterial,ORMSpatialMaterial"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -277,11 +277,11 @@ void MeshInstance::_initialize_skinning(bool p_force_reset, bool p_call_attach_s
|
|||
|
||||
Ref<Material> mat = get_active_material(surface_index);
|
||||
if (mat.is_valid()) {
|
||||
Ref<SpatialMaterial> spatial_mat = mat;
|
||||
Ref<Material3D> spatial_mat = mat;
|
||||
if (spatial_mat.is_valid()) {
|
||||
// Spatial material, check from material settings.
|
||||
surface_data.transform_tangents = spatial_mat->get_feature(SpatialMaterial::FEATURE_NORMAL_MAPPING);
|
||||
surface_data.ensure_correct_normals = spatial_mat->get_flag(SpatialMaterial::FLAG_ENSURE_CORRECT_NORMALS);
|
||||
surface_data.transform_tangents = spatial_mat->get_feature(Material3D::FEATURE_NORMAL_MAPPING);
|
||||
surface_data.ensure_correct_normals = spatial_mat->get_flag(Material3D::FLAG_ENSURE_CORRECT_NORMALS);
|
||||
} else {
|
||||
// Custom shader, must check for compiled flags.
|
||||
surface_data.transform_tangents = VSG::storage->material_uses_tangents(mat->get_rid());
|
||||
|
@ -822,12 +822,12 @@ void MeshInstance::create_debug_tangents() {
|
|||
}
|
||||
|
||||
if (lines.size()) {
|
||||
Ref<SpatialMaterial> sm;
|
||||
Ref<Material3D> sm;
|
||||
sm.instance();
|
||||
|
||||
sm->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
sm->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
sm->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
sm->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
sm->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
sm->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
|
||||
Ref<ArrayMesh> am;
|
||||
am.instance();
|
||||
|
|
|
@ -257,8 +257,8 @@ String Particles::get_configuration_warning() const {
|
|||
meshes_found = true;
|
||||
for (int j = 0; j < draw_passes[i]->get_surface_count(); j++) {
|
||||
anim_material_found = Object::cast_to<ShaderMaterial>(draw_passes[i]->surface_get_material(j).ptr()) != nullptr;
|
||||
SpatialMaterial *spat = Object::cast_to<SpatialMaterial>(draw_passes[i]->surface_get_material(j).ptr());
|
||||
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == SpatialMaterial::BILLBOARD_PARTICLES);
|
||||
Material3D *spat = Object::cast_to<Material3D>(draw_passes[i]->surface_get_material(j).ptr());
|
||||
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == Material3D::BILLBOARD_PARTICLES);
|
||||
}
|
||||
if (anim_material_found) {
|
||||
break;
|
||||
|
@ -267,8 +267,8 @@ String Particles::get_configuration_warning() const {
|
|||
}
|
||||
|
||||
anim_material_found = anim_material_found || Object::cast_to<ShaderMaterial>(get_material_override().ptr()) != nullptr;
|
||||
SpatialMaterial *spat = Object::cast_to<SpatialMaterial>(get_material_override().ptr());
|
||||
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == SpatialMaterial::BILLBOARD_PARTICLES);
|
||||
Material3D *spat = Object::cast_to<Material3D>(get_material_override().ptr());
|
||||
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == Material3D::BILLBOARD_PARTICLES);
|
||||
|
||||
if (!meshes_found) {
|
||||
if (warnings != String()) {
|
||||
|
|
|
@ -392,7 +392,7 @@ void RayCast::set_debug_shape_custom_color(const Color &p_color) {
|
|||
}
|
||||
}
|
||||
|
||||
Ref<SpatialMaterial> RayCast::get_debug_material() {
|
||||
Ref<Material3D> RayCast::get_debug_material() {
|
||||
_update_debug_shape_material();
|
||||
return debug_material;
|
||||
}
|
||||
|
@ -421,13 +421,13 @@ void RayCast::_create_debug_shape() {
|
|||
|
||||
void RayCast::_update_debug_shape_material(bool p_check_collision) {
|
||||
if (!debug_material.is_valid()) {
|
||||
Ref<SpatialMaterial> material = memnew(SpatialMaterial);
|
||||
Ref<Material3D> material = memnew(Material3D);
|
||||
debug_material = material;
|
||||
|
||||
material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
material->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
material->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
// Use double-sided rendering so that the RayCast can be seen if the camera is inside.
|
||||
material->set_cull_mode(SpatialMaterial::CULL_DISABLED);
|
||||
material->set_cull_mode(Material3D::CULL_DISABLED);
|
||||
}
|
||||
|
||||
Color color = debug_shape_custom_color;
|
||||
|
@ -446,7 +446,7 @@ void RayCast::_update_debug_shape_material(bool p_check_collision) {
|
|||
}
|
||||
}
|
||||
|
||||
Ref<SpatialMaterial> material = static_cast<Ref<SpatialMaterial>>(debug_material);
|
||||
Ref<Material3D> material = static_cast<Ref<Material3D>>(debug_material);
|
||||
material->set_albedo(color);
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
const Vector<Vector3> &get_debug_shape_vertices() const;
|
||||
const Vector<Vector3> &get_debug_line_vertices() const;
|
||||
|
||||
Ref<SpatialMaterial> get_debug_material();
|
||||
Ref<Material3D> get_debug_material();
|
||||
|
||||
int get_debug_shape_thickness() const;
|
||||
void set_debug_shape_thickness(const int p_debug_thickness);
|
||||
|
|
|
@ -516,7 +516,7 @@ void ShapeCast::set_debug_shape_custom_color(const Color &p_color) {
|
|||
}
|
||||
}
|
||||
|
||||
Ref<SpatialMaterial> ShapeCast::get_debug_material() {
|
||||
Ref<Material3D> ShapeCast::get_debug_material() {
|
||||
_update_debug_shape_material();
|
||||
return debug_material;
|
||||
}
|
||||
|
@ -539,13 +539,13 @@ void ShapeCast::_create_debug_shape() {
|
|||
|
||||
void ShapeCast::_update_debug_shape_material(bool p_check_collision) {
|
||||
if (!debug_material.is_valid()) {
|
||||
Ref<SpatialMaterial> material = memnew(SpatialMaterial);
|
||||
Ref<Material3D> material = memnew(Material3D);
|
||||
debug_material = material;
|
||||
|
||||
material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
material->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
material->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
// Use double-sided rendering so that the RayCast can be seen if the camera is inside.
|
||||
material->set_cull_mode(SpatialMaterial::CULL_DISABLED);
|
||||
material->set_cull_mode(Material3D::CULL_DISABLED);
|
||||
}
|
||||
|
||||
Color color = debug_shape_custom_color;
|
||||
|
@ -564,7 +564,7 @@ void ShapeCast::_update_debug_shape_material(bool p_check_collision) {
|
|||
}
|
||||
}
|
||||
|
||||
Ref<SpatialMaterial> material = static_cast<Ref<SpatialMaterial>>(debug_material);
|
||||
Ref<Material3D> material = static_cast<Ref<Material3D>>(debug_material);
|
||||
material->set_albedo(color);
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ public:
|
|||
const Vector<Vector3> &get_debug_shape_vertices() const;
|
||||
const Vector<Vector3> &get_debug_line_vertices() const;
|
||||
|
||||
Ref<SpatialMaterial> get_debug_material();
|
||||
Ref<Material3D> get_debug_material();
|
||||
|
||||
int get_collision_count() const;
|
||||
Object *get_collider(int p_idx) const;
|
||||
|
|
|
@ -231,7 +231,7 @@ void SpriteBase3D::draw_texture_rect(Ref<Texture> p_texture, Rect2 p_dst_rect, R
|
|||
VS::get_singleton()->mesh_set_custom_aabb(mesh, aabb);
|
||||
set_aabb(aabb);
|
||||
|
||||
RID mat = SpatialMaterial::get_material_rid_for_2d(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS, get_billboard_mode() == SpatialMaterial::BILLBOARD_ENABLED, get_billboard_mode() == SpatialMaterial::BILLBOARD_FIXED_Y, get_draw_flag(FLAG_DISABLE_DEPTH_TEST), get_draw_flag(FLAG_FIXED_SIZE));
|
||||
RID mat = Material3D::get_material_rid_for_2d(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS, get_billboard_mode() == Material3D::BILLBOARD_ENABLED, get_billboard_mode() == Material3D::BILLBOARD_FIXED_Y, get_draw_flag(FLAG_DISABLE_DEPTH_TEST), get_draw_flag(FLAG_FIXED_SIZE));
|
||||
VS::get_singleton()->material_set_shader(get_material(), VS::get_singleton()->material_get_shader(mat));
|
||||
VS::get_singleton()->material_set_param(get_material(), "texture_albedo", p_texture->get_rid());
|
||||
if (get_alpha_cut_mode() == ALPHA_CUT_DISABLED) {
|
||||
|
@ -428,13 +428,13 @@ SpriteBase3D::AlphaCutMode SpriteBase3D::get_alpha_cut_mode() const {
|
|||
return alpha_cut;
|
||||
}
|
||||
|
||||
void SpriteBase3D::set_billboard_mode(SpatialMaterial::BillboardMode p_mode) {
|
||||
void SpriteBase3D::set_billboard_mode(Material3D::BillboardMode p_mode) {
|
||||
ERR_FAIL_INDEX(p_mode, 3);
|
||||
billboard_mode = p_mode;
|
||||
_queue_update();
|
||||
}
|
||||
|
||||
SpatialMaterial::BillboardMode SpriteBase3D::get_billboard_mode() const {
|
||||
Material3D::BillboardMode SpriteBase3D::get_billboard_mode() const {
|
||||
return billboard_mode;
|
||||
}
|
||||
|
||||
|
@ -524,7 +524,7 @@ SpriteBase3D::SpriteBase3D() {
|
|||
}
|
||||
|
||||
alpha_cut = ALPHA_CUT_DISABLED;
|
||||
billboard_mode = SpatialMaterial::BILLBOARD_DISABLED;
|
||||
billboard_mode = Material3D::BILLBOARD_DISABLED;
|
||||
axis = Vector3::AXIS_Z;
|
||||
pixel_size = 0.01;
|
||||
modulate = Color(1, 1, 1, 1);
|
||||
|
|
|
@ -83,7 +83,7 @@ private:
|
|||
|
||||
bool flags[FLAG_MAX];
|
||||
AlphaCutMode alpha_cut;
|
||||
SpatialMaterial::BillboardMode billboard_mode;
|
||||
Material3D::BillboardMode billboard_mode;
|
||||
bool pending_update;
|
||||
void _im_update();
|
||||
|
||||
|
@ -139,8 +139,8 @@ public:
|
|||
|
||||
void set_alpha_cut_mode(AlphaCutMode p_mode);
|
||||
AlphaCutMode get_alpha_cut_mode() const;
|
||||
void set_billboard_mode(SpatialMaterial::BillboardMode p_mode);
|
||||
SpatialMaterial::BillboardMode get_billboard_mode() const;
|
||||
void set_billboard_mode(Material3D::BillboardMode p_mode);
|
||||
Material3D::BillboardMode get_billboard_mode() const;
|
||||
|
||||
virtual Rect2 get_item_rect() const = 0;
|
||||
|
||||
|
|
|
@ -387,8 +387,8 @@ void GeometryInstance::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_aabb"), &GeometryInstance::get_aabb);
|
||||
|
||||
ADD_GROUP("Geometry", "");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material_override", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,SpatialMaterial"), "set_material_override", "get_material_override");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material_overlay", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,SpatialMaterial"), "set_material_overlay", "get_material_overlay");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material_override", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,SpatialMaterial,ORMSpatialMaterial"), "set_material_override", "get_material_override");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material_overlay", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,SpatialMaterial,ORMSpatialMaterial"), "set_material_overlay", "get_material_overlay");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "cast_shadow", PROPERTY_HINT_ENUM, "Off,On,Double-Sided,Shadows Only"), "set_cast_shadows_setting", "get_cast_shadows_setting");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "extra_cull_margin", PROPERTY_HINT_RANGE, "0,16384,0.01"), "set_extra_cull_margin", "get_extra_cull_margin");
|
||||
|
||||
|
|
|
@ -526,7 +526,7 @@ Vector<Color> VoxelLightBaker::_get_bake_texture(Ref<Image> p_image, const Color
|
|||
|
||||
VoxelLightBaker::MaterialCache VoxelLightBaker::_get_material_cache(Ref<Material> p_material) {
|
||||
//this way of obtaining materials is inaccurate and also does not support some compressed formats very well
|
||||
Ref<SpatialMaterial> mat = p_material;
|
||||
Ref<Material3D> mat = p_material;
|
||||
|
||||
Ref<Material> material = mat; //hack for now
|
||||
|
||||
|
@ -539,7 +539,7 @@ VoxelLightBaker::MaterialCache VoxelLightBaker::_get_material_cache(Ref<Material
|
|||
Ref<Image> empty;
|
||||
|
||||
if (mat.is_valid()) {
|
||||
Ref<Texture> albedo_tex = mat->get_texture(SpatialMaterial::TEXTURE_ALBEDO);
|
||||
Ref<Texture> albedo_tex = mat->get_texture(Material3D::TEXTURE_ALBEDO);
|
||||
|
||||
Ref<Image> img_albedo;
|
||||
if (albedo_tex.is_valid()) {
|
||||
|
@ -549,8 +549,8 @@ VoxelLightBaker::MaterialCache VoxelLightBaker::_get_material_cache(Ref<Material
|
|||
mc.albedo = _get_bake_texture(img_albedo, Color(1, 1, 1), mat->get_albedo()); // no albedo texture, color is additive
|
||||
}
|
||||
|
||||
if (mat->get_feature(SpatialMaterial::FEATURE_EMISSION)) {
|
||||
Ref<Texture> emission_tex = mat->get_texture(SpatialMaterial::TEXTURE_EMISSION);
|
||||
if (mat->get_feature(Material3D::FEATURE_EMISSION)) {
|
||||
Ref<Texture> emission_tex = mat->get_texture(Material3D::TEXTURE_EMISSION);
|
||||
|
||||
Color emission_col = mat->get_emission();
|
||||
float emission_energy = mat->get_emission_energy();
|
||||
|
@ -561,7 +561,7 @@ VoxelLightBaker::MaterialCache VoxelLightBaker::_get_material_cache(Ref<Material
|
|||
img_emission = emission_tex->get_data();
|
||||
}
|
||||
|
||||
if (mat->get_emission_operator() == SpatialMaterial::EMISSION_OP_ADD) {
|
||||
if (mat->get_emission_operator() == Material3D::EMISSION_OP_ADD) {
|
||||
mc.emission = _get_bake_texture(img_emission, Color(1, 1, 1) * emission_energy, emission_col * emission_energy);
|
||||
} else {
|
||||
mc.emission = _get_bake_texture(img_emission, emission_col * emission_energy, Color(0, 0, 0));
|
||||
|
@ -1507,11 +1507,11 @@ Ref<MultiMesh> VoxelLightBaker::create_debug_multimesh(DebugMode p_mode) {
|
|||
}
|
||||
|
||||
{
|
||||
Ref<SpatialMaterial> fsm;
|
||||
Ref<Material3D> fsm;
|
||||
fsm.instance();
|
||||
fsm->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
fsm->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
fsm->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
fsm->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
fsm->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
fsm->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
fsm->set_albedo(Color(1, 1, 1, 1));
|
||||
|
||||
mesh->surface_set_material(0, fsm);
|
||||
|
|
|
@ -77,7 +77,7 @@ bool RootMotionView::get_zero_y() const {
|
|||
|
||||
void RootMotionView::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
VS::get_singleton()->immediate_set_material(immediate, SpatialMaterial::get_material_rid_for_2d(false, true, false, false, false));
|
||||
VS::get_singleton()->immediate_set_material(immediate, Material3D::get_material_rid_for_2d(false, true, false, false, false));
|
||||
first = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -935,11 +935,11 @@ Ref<Material> SceneTree::get_debug_navigation_material() {
|
|||
return navigation_material;
|
||||
}
|
||||
|
||||
Ref<SpatialMaterial> line_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
|
||||
line_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
line_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
line_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
line_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
Ref<Material3D> line_material = Ref<Material3D>(memnew(SpatialMaterial));
|
||||
line_material->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
line_material->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
line_material->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
line_material->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
line_material->set_albedo(get_debug_navigation_color());
|
||||
|
||||
navigation_material = line_material;
|
||||
|
@ -952,11 +952,11 @@ Ref<Material> SceneTree::get_debug_navigation_disabled_material() {
|
|||
return navigation_disabled_material;
|
||||
}
|
||||
|
||||
Ref<SpatialMaterial> line_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
|
||||
line_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
line_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
line_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
line_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
Ref<Material3D> line_material = Ref<Material3D>(memnew(SpatialMaterial));
|
||||
line_material->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
line_material->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
line_material->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
line_material->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
line_material->set_albedo(get_debug_navigation_disabled_color());
|
||||
|
||||
navigation_disabled_material = line_material;
|
||||
|
@ -968,11 +968,11 @@ Ref<Material> SceneTree::get_debug_collision_material() {
|
|||
return collision_material;
|
||||
}
|
||||
|
||||
Ref<SpatialMaterial> line_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
|
||||
line_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
line_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
line_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
line_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
Ref<Material3D> line_material = Ref<Material3D>(memnew(SpatialMaterial));
|
||||
line_material->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
line_material->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
line_material->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
line_material->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
line_material->set_albedo(get_debug_collisions_color());
|
||||
|
||||
collision_material = line_material;
|
||||
|
@ -987,11 +987,11 @@ Ref<ArrayMesh> SceneTree::get_debug_contact_mesh() {
|
|||
|
||||
debug_contact_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
|
||||
Ref<SpatialMaterial> mat = Ref<SpatialMaterial>(memnew(SpatialMaterial));
|
||||
mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
Ref<Material3D> mat = Ref<Material3D>(memnew(SpatialMaterial));
|
||||
mat->set_flag(Material3D::FLAG_UNSHADED, true);
|
||||
mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
|
||||
mat->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
mat->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
mat->set_albedo(get_debug_collision_contact_color());
|
||||
|
||||
Vector3 diamond[6] = {
|
||||
|
|
|
@ -670,9 +670,11 @@ void register_scene_types() {
|
|||
ClassDB::register_class<TorusMesh>();
|
||||
ClassDB::register_class<PointMesh>();
|
||||
ClassDB::register_virtual_class<Material>();
|
||||
ClassDB::register_virtual_class<Material3D>();
|
||||
ClassDB::register_class<SpatialMaterial>();
|
||||
SceneTree::add_idle_callback(SpatialMaterial::flush_changes);
|
||||
SpatialMaterial::init_shaders();
|
||||
ClassDB::register_class<ORMSpatialMaterial>();
|
||||
SceneTree::add_idle_callback(Material3D::flush_changes);
|
||||
Material3D::init_shaders();
|
||||
|
||||
ClassDB::register_class<MeshLibrary>();
|
||||
|
||||
|
@ -875,7 +877,7 @@ void unregister_scene_types() {
|
|||
|
||||
//SpatialMaterial is not initialised when 3D is disabled, so it shouldn't be cleaned up either
|
||||
#ifndef _3D_DISABLED
|
||||
SpatialMaterial::finish_shaders();
|
||||
Material3D::finish_shaders();
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
ParticlesMaterial::finish_shaders();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -104,8 +104,8 @@ public:
|
|||
~ShaderMaterial();
|
||||
};
|
||||
|
||||
class SpatialMaterial : public Material {
|
||||
GDCLASS(SpatialMaterial, Material);
|
||||
class Material3D : public Material {
|
||||
GDCLASS(Material3D, Material);
|
||||
|
||||
public:
|
||||
enum TextureParam {
|
||||
|
@ -125,6 +125,7 @@ public:
|
|||
TEXTURE_DETAIL_MASK,
|
||||
TEXTURE_DETAIL_ALBEDO,
|
||||
TEXTURE_DETAIL_NORMAL,
|
||||
TEXTURE_ORM,
|
||||
TEXTURE_MAX
|
||||
|
||||
};
|
||||
|
@ -364,15 +365,16 @@ private:
|
|||
};
|
||||
|
||||
static Mutex material_mutex;
|
||||
static SelfList<SpatialMaterial>::List *dirty_materials;
|
||||
static SelfList<Material3D>::List *dirty_materials;
|
||||
static ShaderNames *shader_names;
|
||||
|
||||
SelfList<SpatialMaterial> element;
|
||||
SelfList<Material3D> element;
|
||||
|
||||
void _update_shader();
|
||||
_FORCE_INLINE_ void _queue_shader_change();
|
||||
_FORCE_INLINE_ bool _is_shader_dirty() const;
|
||||
|
||||
bool orm;
|
||||
bool is_initialized = false;
|
||||
Color albedo;
|
||||
float specular;
|
||||
|
@ -447,7 +449,7 @@ private:
|
|||
|
||||
_FORCE_INLINE_ void _validate_feature(const String &text, Feature feature, PropertyInfo &property) const;
|
||||
|
||||
static HashMap<uint64_t, Ref<SpatialMaterial>> materials_for_2d; //used by Sprite3D and other stuff
|
||||
static HashMap<uint64_t, Ref<Material3D>> materials_for_2d; //used by Sprite3D and other stuff
|
||||
|
||||
void _validate_high_end(const String &text, PropertyInfo &property) const;
|
||||
|
||||
|
@ -641,24 +643,38 @@ public:
|
|||
|
||||
virtual Shader::Mode get_shader_mode() const;
|
||||
|
||||
SpatialMaterial();
|
||||
virtual ~SpatialMaterial();
|
||||
Material3D(bool p_orm = false);
|
||||
virtual ~Material3D();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(SpatialMaterial::TextureParam)
|
||||
VARIANT_ENUM_CAST(SpatialMaterial::DetailUV)
|
||||
VARIANT_ENUM_CAST(SpatialMaterial::Feature)
|
||||
VARIANT_ENUM_CAST(SpatialMaterial::BlendMode)
|
||||
VARIANT_ENUM_CAST(SpatialMaterial::DepthDrawMode)
|
||||
VARIANT_ENUM_CAST(SpatialMaterial::CullMode)
|
||||
VARIANT_ENUM_CAST(SpatialMaterial::Flags)
|
||||
VARIANT_ENUM_CAST(SpatialMaterial::DiffuseMode)
|
||||
VARIANT_ENUM_CAST(SpatialMaterial::SpecularMode)
|
||||
VARIANT_ENUM_CAST(SpatialMaterial::BillboardMode)
|
||||
VARIANT_ENUM_CAST(SpatialMaterial::TextureChannel)
|
||||
VARIANT_ENUM_CAST(SpatialMaterial::EmissionOperator)
|
||||
VARIANT_ENUM_CAST(SpatialMaterial::DistanceFadeMode)
|
||||
VARIANT_ENUM_CAST(SpatialMaterial::AsyncMode)
|
||||
class SpatialMaterial : public Material3D {
|
||||
GDCLASS(SpatialMaterial, Material3D)
|
||||
public:
|
||||
SpatialMaterial() :
|
||||
Material3D(false) {}
|
||||
};
|
||||
|
||||
class ORMSpatialMaterial : public Material3D {
|
||||
GDCLASS(ORMSpatialMaterial, Material3D)
|
||||
public:
|
||||
ORMSpatialMaterial() :
|
||||
Material3D(true) {}
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(Material3D::TextureParam)
|
||||
VARIANT_ENUM_CAST(Material3D::DetailUV)
|
||||
VARIANT_ENUM_CAST(Material3D::Feature)
|
||||
VARIANT_ENUM_CAST(Material3D::BlendMode)
|
||||
VARIANT_ENUM_CAST(Material3D::DepthDrawMode)
|
||||
VARIANT_ENUM_CAST(Material3D::CullMode)
|
||||
VARIANT_ENUM_CAST(Material3D::Flags)
|
||||
VARIANT_ENUM_CAST(Material3D::DiffuseMode)
|
||||
VARIANT_ENUM_CAST(Material3D::SpecularMode)
|
||||
VARIANT_ENUM_CAST(Material3D::BillboardMode)
|
||||
VARIANT_ENUM_CAST(Material3D::TextureChannel)
|
||||
VARIANT_ENUM_CAST(Material3D::EmissionOperator)
|
||||
VARIANT_ENUM_CAST(Material3D::DistanceFadeMode)
|
||||
VARIANT_ENUM_CAST(Material3D::AsyncMode)
|
||||
|
||||
//////////////////////
|
||||
|
||||
|
|
|
@ -876,7 +876,7 @@ void ArrayMesh::_get_property_list(List<PropertyInfo> *p_list) const {
|
|||
if (surfaces[i].is_2d) {
|
||||
p_list->push_back(PropertyInfo(Variant::OBJECT, "surface_" + itos(i + 1) + "/material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,CanvasItemMaterial", PROPERTY_USAGE_EDITOR));
|
||||
} else {
|
||||
p_list->push_back(PropertyInfo(Variant::OBJECT, "surface_" + itos(i + 1) + "/material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,SpatialMaterial", PROPERTY_USAGE_EDITOR));
|
||||
p_list->push_back(PropertyInfo(Variant::OBJECT, "surface_" + itos(i + 1) + "/material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,SpatialMaterial,ORMSpatialMaterial", PROPERTY_USAGE_EDITOR));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@ void PrimitiveMesh::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_flip_faces", "flip_faces"), &PrimitiveMesh::set_flip_faces);
|
||||
ClassDB::bind_method(D_METHOD("get_flip_faces"), &PrimitiveMesh::get_flip_faces);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ORMSpatialMaterial,ShaderMaterial"), "set_material", "get_material");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::AABB, "custom_aabb", PROPERTY_HINT_NONE, ""), "set_custom_aabb", "get_custom_aabb");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flip_faces"), "set_flip_faces", "get_flip_faces");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue