diff options
Diffstat (limited to 'scene/resources/material.h')
-rw-r--r-- | scene/resources/material.h | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/scene/resources/material.h b/scene/resources/material.h index 140b2142c9..fdb11982a8 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -48,15 +48,26 @@ class Material : public Resource { RID material; Ref<Material> next_pass; + int render_priority; protected: _FORCE_INLINE_ RID _get_material() const { return material; } static void _bind_methods(); + virtual bool _can_do_next_pass() const { return false; } + + void _validate_property(PropertyInfo &property) const; public: + enum { + RENDER_PRIORITY_MAX = VS::MATERIAL_RENDER_PRIORITY_MAX, + RENDER_PRIORITY_MIN = VS::MATERIAL_RENDER_PRIORITY_MIN, + }; void set_next_pass(const Ref<Material> &p_pass); Ref<Material> get_next_pass() const; + void set_render_priority(int p_priority); + int get_render_priority() const; + virtual RID get_rid() const; Material(); virtual ~Material(); @@ -76,6 +87,8 @@ protected: void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const; + virtual bool _can_do_next_pass() const; + public: void set_shader(const Ref<Shader> &p_shader); Ref<Shader> get_shader() const; @@ -104,6 +117,7 @@ public: TEXTURE_AMBIENT_OCCLUSION, TEXTURE_DEPTH, TEXTURE_SUBSURFACE_SCATTERING, + TEXTURE_TRANSMISSION, TEXTURE_REFRACTION, TEXTURE_DETAIL_MASK, TEXTURE_DETAIL_ALBEDO, @@ -127,6 +141,7 @@ public: FEATURE_AMBIENT_OCCLUSION, FEATURE_DEPTH_MAPPING, FEATURE_SUBSURACE_SCATTERING, + FEATURE_TRANSMISSION, FEATURE_REFRACTION, FEATURE_DETAIL, FEATURE_MAX @@ -156,13 +171,14 @@ public: enum Flags { FLAG_UNSHADED, FLAG_USE_VERTEX_LIGHTING, - FLAG_ONTOP, + FLAG_DISABLE_DEPTH_TEST, FLAG_ALBEDO_FROM_VERTEX_COLOR, FLAG_SRGB_VERTEX_COLOR, FLAG_USE_POINT_SIZE, FLAG_FIXED_SIZE, FLAG_UV1_USE_TRIPLANAR, FLAG_UV2_USE_TRIPLANAR, + FLAG_TRIPLANAR_USE_WORLD, FLAG_AO_ON_UV2, FLAG_USE_ALPHA_SCISSOR, FLAG_MAX @@ -170,7 +186,7 @@ public: enum DiffuseMode { DIFFUSE_LAMBERT, - DIFFUSE_HALF_LAMBERT, + DIFFUSE_LAMBERT_WRAP, DIFFUSE_OREN_NAYAR, DIFFUSE_BURLEY, DIFFUSE_TOON, @@ -203,12 +219,12 @@ private: union MaterialKey { struct { - uint64_t feature_mask : 11; + uint64_t feature_mask : 12; uint64_t detail_uv : 1; uint64_t blend_mode : 2; uint64_t depth_draw_mode : 2; uint64_t cull_mode : 2; - uint64_t flags : 11; + uint64_t flags : 12; uint64_t detail_blend_mode : 2; uint64_t diffuse_mode : 3; uint64_t specular_mode : 2; @@ -277,14 +293,15 @@ private: StringName anisotropy; StringName depth_scale; StringName subsurface_scattering_strength; + StringName transmission; StringName refraction; StringName point_size; StringName uv1_scale; StringName uv1_offset; StringName uv2_scale; StringName uv2_offset; - StringName particle_h_frames; - StringName particle_v_frames; + StringName particles_anim_h_frames; + StringName particles_anim_v_frames; StringName particles_anim_loop; StringName depth_min_layers; StringName depth_max_layers; @@ -328,6 +345,7 @@ private: float anisotropy; float depth_scale; float subsurface_scattering_strength; + Color transmission; float refraction; float line_width; float point_size; @@ -381,6 +399,7 @@ private: protected: static void _bind_methods(); void _validate_property(PropertyInfo &property) const; + virtual bool _can_do_next_pass() const { return true; } public: void set_albedo(const Color &p_albedo); @@ -434,6 +453,9 @@ public: void set_subsurface_scattering_strength(float p_subsurface_scattering_strength); float get_subsurface_scattering_strength() const; + void set_transmission(const Color &p_transmission); + Color get_transmission() const; + void set_refraction(float p_refraction); float get_refraction() const; @@ -511,6 +533,8 @@ public: void set_alpha_scissor_threshold(float p_treshold); float get_alpha_scissor_threshold() const; + void set_on_top_of_alpha(); + void set_metallic_texture_channel(TextureChannel p_channel); TextureChannel get_metallic_texture_channel() const; void set_roughness_texture_channel(TextureChannel p_channel); |