summaryrefslogtreecommitdiffstats
path: root/scene/resources
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/navigation_mesh_source_geometry_data_2d.cpp8
-rw-r--r--scene/resources/navigation_mesh_source_geometry_data_2d.h2
-rw-r--r--scene/resources/navigation_mesh_source_geometry_data_3d.cpp12
-rw-r--r--scene/resources/navigation_mesh_source_geometry_data_3d.h2
-rw-r--r--scene/resources/visual_shader_nodes.h24
-rw-r--r--scene/resources/visual_shader_particle_nodes.h8
-rw-r--r--scene/resources/visual_shader_sdf_nodes.h10
7 files changed, 56 insertions, 10 deletions
diff --git a/scene/resources/navigation_mesh_source_geometry_data_2d.cpp b/scene/resources/navigation_mesh_source_geometry_data_2d.cpp
index fabe1659c6..7c33aa9e38 100644
--- a/scene/resources/navigation_mesh_source_geometry_data_2d.cpp
+++ b/scene/resources/navigation_mesh_source_geometry_data_2d.cpp
@@ -113,6 +113,12 @@ void NavigationMeshSourceGeometryData2D::add_obstruction_outline(const PackedVec
}
}
+void NavigationMeshSourceGeometryData2D::merge(const Ref<NavigationMeshSourceGeometryData2D> &p_other_geometry) {
+ // No need to worry about `root_node_transform` here as the data is already xformed.
+ traversable_outlines.append_array(p_other_geometry->traversable_outlines);
+ obstruction_outlines.append_array(p_other_geometry->obstruction_outlines);
+}
+
void NavigationMeshSourceGeometryData2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("clear"), &NavigationMeshSourceGeometryData2D::clear);
ClassDB::bind_method(D_METHOD("has_data"), &NavigationMeshSourceGeometryData2D::has_data);
@@ -126,6 +132,8 @@ void NavigationMeshSourceGeometryData2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_traversable_outline", "shape_outline"), &NavigationMeshSourceGeometryData2D::add_traversable_outline);
ClassDB::bind_method(D_METHOD("add_obstruction_outline", "shape_outline"), &NavigationMeshSourceGeometryData2D::add_obstruction_outline);
+ ClassDB::bind_method(D_METHOD("merge", "other_geometry"), &NavigationMeshSourceGeometryData2D::merge);
+
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "traversable_outlines", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL), "set_traversable_outlines", "get_traversable_outlines");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "obstruction_outlines", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL), "set_obstruction_outlines", "get_obstruction_outlines");
}
diff --git a/scene/resources/navigation_mesh_source_geometry_data_2d.h b/scene/resources/navigation_mesh_source_geometry_data_2d.h
index 985f90fb9e..4accdbc1f4 100644
--- a/scene/resources/navigation_mesh_source_geometry_data_2d.h
+++ b/scene/resources/navigation_mesh_source_geometry_data_2d.h
@@ -71,6 +71,8 @@ public:
bool has_data() { return traversable_outlines.size(); };
void clear();
+ void merge(const Ref<NavigationMeshSourceGeometryData2D> &p_other_geometry);
+
NavigationMeshSourceGeometryData2D() {}
~NavigationMeshSourceGeometryData2D() { clear(); }
};
diff --git a/scene/resources/navigation_mesh_source_geometry_data_3d.cpp b/scene/resources/navigation_mesh_source_geometry_data_3d.cpp
index e39ffab47a..43fb592bba 100644
--- a/scene/resources/navigation_mesh_source_geometry_data_3d.cpp
+++ b/scene/resources/navigation_mesh_source_geometry_data_3d.cpp
@@ -165,6 +165,17 @@ void NavigationMeshSourceGeometryData3D::add_faces(const PackedVector3Array &p_f
_add_faces(p_faces, root_node_transform * p_xform);
}
+void NavigationMeshSourceGeometryData3D::merge(const Ref<NavigationMeshSourceGeometryData3D> &p_other_geometry) {
+ // No need to worry about `root_node_transform` here as the vertices are already xformed.
+ const int64_t number_of_vertices_before_merge = vertices.size();
+ const int64_t number_of_indices_before_merge = indices.size();
+ vertices.append_array(p_other_geometry->vertices);
+ indices.append_array(p_other_geometry->indices);
+ for (int64_t i = number_of_indices_before_merge; i < indices.size(); i++) {
+ indices.set(i, indices[i] + number_of_vertices_before_merge / 3);
+ }
+}
+
void NavigationMeshSourceGeometryData3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_vertices", "vertices"), &NavigationMeshSourceGeometryData3D::set_vertices);
ClassDB::bind_method(D_METHOD("get_vertices"), &NavigationMeshSourceGeometryData3D::get_vertices);
@@ -178,6 +189,7 @@ void NavigationMeshSourceGeometryData3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_mesh", "mesh", "xform"), &NavigationMeshSourceGeometryData3D::add_mesh);
ClassDB::bind_method(D_METHOD("add_mesh_array", "mesh_array", "xform"), &NavigationMeshSourceGeometryData3D::add_mesh_array);
ClassDB::bind_method(D_METHOD("add_faces", "faces", "xform"), &NavigationMeshSourceGeometryData3D::add_faces);
+ ClassDB::bind_method(D_METHOD("merge", "other_geometry"), &NavigationMeshSourceGeometryData3D::merge);
ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR3_ARRAY, "vertices", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL), "set_vertices", "get_vertices");
ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT32_ARRAY, "indices", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL), "set_indices", "get_indices");
diff --git a/scene/resources/navigation_mesh_source_geometry_data_3d.h b/scene/resources/navigation_mesh_source_geometry_data_3d.h
index 10048773fe..5f68692971 100644
--- a/scene/resources/navigation_mesh_source_geometry_data_3d.h
+++ b/scene/resources/navigation_mesh_source_geometry_data_3d.h
@@ -68,6 +68,8 @@ public:
void add_mesh_array(const Array &p_mesh_array, const Transform3D &p_xform);
void add_faces(const PackedVector3Array &p_faces, const Transform3D &p_xform);
+ void merge(const Ref<NavigationMeshSourceGeometryData3D> &p_other_geometry);
+
NavigationMeshSourceGeometryData3D() {}
~NavigationMeshSourceGeometryData3D() { clear(); }
};
diff --git a/scene/resources/visual_shader_nodes.h b/scene/resources/visual_shader_nodes.h
index 05c8fbd16c..0bd0c631b8 100644
--- a/scene/resources/visual_shader_nodes.h
+++ b/scene/resources/visual_shader_nodes.h
@@ -514,6 +514,8 @@ public:
virtual Vector<StringName> get_editable_properties() const override;
virtual bool is_use_prop_slots() const override;
+ virtual Category get_category() const override { return CATEGORY_TEXTURES; }
+
VisualShaderNodeCurveXYZTexture();
};
@@ -657,6 +659,8 @@ public:
virtual Vector<StringName> get_editable_properties() const override;
virtual String get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const override;
+ virtual Category get_category() const override { return CATEGORY_TEXTURES; }
+
VisualShaderNodeCubemap();
};
@@ -832,6 +836,8 @@ public:
virtual Vector<StringName> get_editable_properties() const override;
+ virtual Category get_category() const override { return CATEGORY_SCALAR; }
+
VisualShaderNodeIntOp();
};
@@ -880,6 +886,8 @@ public:
virtual Vector<StringName> get_editable_properties() const override;
+ virtual Category get_category() const override { return CATEGORY_SCALAR; }
+
VisualShaderNodeUIntOp();
};
@@ -1502,6 +1510,8 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
+ virtual Category get_category() const override { return CATEGORY_VECTOR; }
+
VisualShaderNodeDotProduct();
};
@@ -1548,6 +1558,8 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
+ virtual Category get_category() const override { return CATEGORY_VECTOR; }
+
VisualShaderNodeDeterminant();
};
@@ -1591,6 +1603,14 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
+ virtual Category get_category() const override {
+ if (op_type == OP_TYPE_FLOAT || op_type == OP_TYPE_INT || op_type == OP_TYPE_UINT) {
+ return CATEGORY_SCALAR;
+ } else {
+ return CATEGORY_VECTOR;
+ }
+ }
+
VisualShaderNodeClamp();
};
@@ -1990,8 +2010,6 @@ public:
virtual void set_op_type(OpType p_op_type) override;
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
- virtual Category get_category() const override { return CATEGORY_VECTOR; }
-
VisualShaderNodeVectorDecompose();
};
@@ -2734,6 +2752,8 @@ public:
virtual bool is_generate_input_var(int p_port) const override;
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
+ virtual Category get_category() const override { return CATEGORY_UTILITY; }
+
VisualShaderNodeFresnel();
};
diff --git a/scene/resources/visual_shader_particle_nodes.h b/scene/resources/visual_shader_particle_nodes.h
index 23d06d4b7c..31ba310c3c 100644
--- a/scene/resources/visual_shader_particle_nodes.h
+++ b/scene/resources/visual_shader_particle_nodes.h
@@ -75,8 +75,6 @@ public:
virtual String generate_global_per_node(Shader::Mode p_mode, int p_id) const override;
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
- virtual Category get_category() const override { return CATEGORY_PARTICLE; }
-
VisualShaderNodeParticleSphereEmitter();
};
@@ -94,8 +92,6 @@ public:
virtual String generate_global_per_node(Shader::Mode p_mode, int p_id) const override;
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
- virtual Category get_category() const override { return CATEGORY_PARTICLE; }
-
VisualShaderNodeParticleBoxEmitter();
};
@@ -112,8 +108,6 @@ public:
virtual String generate_global_per_node(Shader::Mode p_mode, int p_id) const override;
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
- virtual Category get_category() const override { return CATEGORY_PARTICLE; }
-
VisualShaderNodeParticleRingEmitter();
};
@@ -166,8 +160,6 @@ public:
HashMap<StringName, String> get_editable_properties_names() const override;
Vector<VisualShader::DefaultTextureParam> get_default_texture_parameters(VisualShader::Type p_type, int p_id) const override;
- virtual Category get_category() const override { return CATEGORY_PARTICLE; }
-
VisualShaderNodeParticleMeshEmitter();
};
diff --git a/scene/resources/visual_shader_sdf_nodes.h b/scene/resources/visual_shader_sdf_nodes.h
index 525098e5fc..d84cdb431b 100644
--- a/scene/resources/visual_shader_sdf_nodes.h
+++ b/scene/resources/visual_shader_sdf_nodes.h
@@ -49,6 +49,8 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
+ virtual Category get_category() const override { return CATEGORY_TEXTURES; }
+
VisualShaderNodeSDFToScreenUV();
};
@@ -69,6 +71,8 @@ public:
virtual bool is_input_port_default(int p_port, Shader::Mode p_mode) const override;
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
+ virtual Category get_category() const override { return CATEGORY_TEXTURES; }
+
VisualShaderNodeScreenUVToSDF();
};
@@ -88,6 +92,8 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
+ virtual Category get_category() const override { return CATEGORY_TEXTURES; }
+
VisualShaderNodeTextureSDF();
};
@@ -107,6 +113,8 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
+ virtual Category get_category() const override { return CATEGORY_TEXTURES; }
+
VisualShaderNodeTextureSDFNormal();
};
@@ -126,6 +134,8 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
+ virtual Category get_category() const override { return CATEGORY_TEXTURES; }
+
VisualShaderNodeSDFRaymarch();
};