diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/skeleton_2d.cpp | 13 | ||||
-rw-r--r-- | scene/2d/skeleton_2d.h | 3 | ||||
-rw-r--r-- | scene/resources/material.cpp | 15 | ||||
-rw-r--r-- | scene/resources/visual_shader_nodes.cpp | 7 |
4 files changed, 18 insertions, 20 deletions
diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp index 96711bbe72..4fdc7b3584 100644 --- a/scene/2d/skeleton_2d.cpp +++ b/scene/2d/skeleton_2d.cpp @@ -378,9 +378,6 @@ void Bone2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_skeleton_rest"), &Bone2D::get_skeleton_rest); ClassDB::bind_method(D_METHOD("get_index_in_skeleton"), &Bone2D::get_index_in_skeleton); - ClassDB::bind_method(D_METHOD("set_default_length", "default_length"), &Bone2D::set_default_length); - ClassDB::bind_method(D_METHOD("get_default_length"), &Bone2D::get_default_length); - ClassDB::bind_method(D_METHOD("set_autocalculate_length_and_angle", "auto_calculate"), &Bone2D::set_autocalculate_length_and_angle); ClassDB::bind_method(D_METHOD("get_autocalculate_length_and_angle"), &Bone2D::get_autocalculate_length_and_angle); ClassDB::bind_method(D_METHOD("set_length", "length"), &Bone2D::set_length); @@ -416,16 +413,6 @@ void Bone2D::apply_rest() { set_transform(rest); } -void Bone2D::set_default_length(real_t p_length) { - WARN_DEPRECATED_MSG("set_default_length is deprecated. Please use set_length instead!"); - set_length(p_length); -} - -real_t Bone2D::get_default_length() const { - WARN_DEPRECATED_MSG("get_default_length is deprecated. Please use get_length instead!"); - return get_length(); -} - int Bone2D::get_index_in_skeleton() const { ERR_FAIL_COND_V(!skeleton, -1); skeleton->_update_bone_setup(); diff --git a/scene/2d/skeleton_2d.h b/scene/2d/skeleton_2d.h index 149ab64306..6a36a31552 100644 --- a/scene/2d/skeleton_2d.h +++ b/scene/2d/skeleton_2d.h @@ -80,9 +80,6 @@ public: PackedStringArray get_configuration_warnings() const override; - void set_default_length(real_t p_length); - real_t get_default_length() const; - void set_autocalculate_length_and_angle(bool p_autocalculate); bool get_autocalculate_length_and_angle() const; void set_length(real_t p_length); diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 7e84814ab3..2627898f5f 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -369,7 +369,15 @@ void ShaderMaterial::set_shader_parameter(const StringName &p_param, const Varia param_cache.erase(p_param); RS::get_singleton()->material_set_param(_get_material(), p_param, Variant()); } else { - param_cache[p_param] = p_value; + Variant *v = param_cache.getptr(p_param); + if (!v) { + // Never assigned, also update the remap cache. + remap_cache["shader_parameter/" + p_param.operator String()] = p_param; + param_cache.insert(p_param, p_value); + } else { + *v = p_value; + } + if (p_value.get_type() == Variant::OBJECT) { RID tex_rid = p_value; if (tex_rid == RID()) { @@ -955,11 +963,14 @@ void BaseMaterial3D::_update_shader() { } break; case BILLBOARD_PARTICLES: { //make billboard - code += " mat4 mat_world = mat4(normalize(INV_VIEW_MATRIX[0]) * length(MODEL_MATRIX[0]), normalize(INV_VIEW_MATRIX[1]) * length(MODEL_MATRIX[0]),normalize(INV_VIEW_MATRIX[2]) * length(MODEL_MATRIX[2]), MODEL_MATRIX[3]);\n"; + code += " mat4 mat_world = mat4(normalize(INV_VIEW_MATRIX[0]), normalize(INV_VIEW_MATRIX[1]) ,normalize(INV_VIEW_MATRIX[2]), MODEL_MATRIX[3]);\n"; //rotate by rotation code += " mat_world = mat_world * mat4(vec4(cos(INSTANCE_CUSTOM.x), -sin(INSTANCE_CUSTOM.x), 0.0, 0.0), vec4(sin(INSTANCE_CUSTOM.x), cos(INSTANCE_CUSTOM.x), 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; //set modelview code += " MODELVIEW_MATRIX = VIEW_MATRIX * mat_world;\n"; + if (flags[FLAG_BILLBOARD_KEEP_SCALE]) { + code += " MODELVIEW_MATRIX = MODELVIEW_MATRIX * mat4(vec4(length(MODEL_MATRIX[0].xyz), 0.0, 0.0, 0.0),vec4(0.0, length(MODEL_MATRIX[1].xyz), 0.0, 0.0), vec4(0.0, 0.0, length(MODEL_MATRIX[2].xyz), 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; + } //set modelview normal code += " MODELVIEW_NORMAL_MATRIX = mat3(MODELVIEW_MATRIX);\n"; diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp index 7550f598f8..9f5a64597a 100644 --- a/scene/resources/visual_shader_nodes.cpp +++ b/scene/resources/visual_shader_nodes.cpp @@ -7606,8 +7606,11 @@ String VisualShaderNodeBillboard::generate_code(Shader::Mode p_mode, VisualShade break; case BILLBOARD_TYPE_PARTICLES: code += " {\n"; - code += " mat4 __wm = mat4(normalize(INV_VIEW_MATRIX[0]) * length(MODEL_MATRIX[0]), normalize(INV_VIEW_MATRIX[1]) * length(MODEL_MATRIX[0]), normalize(INV_VIEW_MATRIX[2]) * length(MODEL_MATRIX[2]), MODEL_MATRIX[3]);\n"; + code += " mat4 __wm = mat4(normalize(INV_VIEW_MATRIX[0]), normalize(INV_VIEW_MATRIX[1]), normalize(INV_VIEW_MATRIX[2]), MODEL_MATRIX[3]);\n"; code += " __wm = __wm * mat4(vec4(cos(INSTANCE_CUSTOM.x), -sin(INSTANCE_CUSTOM.x), 0.0, 0.0), vec4(sin(INSTANCE_CUSTOM.x), cos(INSTANCE_CUSTOM.x), 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; + if (keep_scale) { + code += " __wm = __wm * mat4(vec4(length(MODEL_MATRIX[0].xyz), 0.0, 0.0, 0.0), vec4(0.0, length(MODEL_MATRIX[1].xyz), 0.0, 0.0), vec4(0.0, 0.0, length(MODEL_MATRIX[2].xyz), 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; + } code += " " + p_output_vars[0] + " = VIEW_MATRIX * __wm;\n"; code += " }\n"; break; @@ -7650,7 +7653,7 @@ bool VisualShaderNodeBillboard::is_keep_scale_enabled() const { Vector<StringName> VisualShaderNodeBillboard::get_editable_properties() const { Vector<StringName> props; props.push_back("billboard_type"); - if (billboard_type == BILLBOARD_TYPE_ENABLED || billboard_type == BILLBOARD_TYPE_FIXED_Y) { + if (billboard_type == BILLBOARD_TYPE_ENABLED || billboard_type == BILLBOARD_TYPE_FIXED_Y || billboard_type == BILLBOARD_TYPE_PARTICLES) { props.push_back("keep_scale"); } return props; |