feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
|
|
@ -195,6 +195,15 @@ Vector<Color> MultiMesh::_get_custom_data_array() const {
|
|||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
void MultiMesh::set_buffer(const Vector<float> &p_buffer) {
|
||||
if (instance_count == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t stride = transform_format == TRANSFORM_2D ? 8 : 12;
|
||||
stride += use_colors ? 4 : 0;
|
||||
stride += use_custom_data ? 4 : 0;
|
||||
ERR_FAIL_COND_MSG(stride * instance_count != p_buffer.size(), "Cannot set a buffer on a Multimesh that is a different size from the Multimesh's existing buffer.");
|
||||
|
||||
RS::get_singleton()->multimesh_set_buffer(multimesh, p_buffer);
|
||||
}
|
||||
|
||||
|
|
@ -202,9 +211,13 @@ Vector<float> MultiMesh::get_buffer() const {
|
|||
return RS::get_singleton()->multimesh_get_buffer(multimesh);
|
||||
}
|
||||
|
||||
void MultiMesh::set_buffer_interpolated(const Vector<float> &p_buffer_curr, const Vector<float> &p_buffer_prev) {
|
||||
RS::get_singleton()->multimesh_set_buffer_interpolated(multimesh, p_buffer_curr, p_buffer_prev);
|
||||
}
|
||||
|
||||
void MultiMesh::set_mesh(const Ref<Mesh> &p_mesh) {
|
||||
mesh = p_mesh;
|
||||
if (!mesh.is_null()) {
|
||||
if (mesh.is_valid()) {
|
||||
RenderingServer::get_singleton()->multimesh_set_mesh(multimesh, mesh->get_rid());
|
||||
} else {
|
||||
RenderingServer::get_singleton()->multimesh_set_mesh(multimesh, RID());
|
||||
|
|
@ -236,39 +249,69 @@ int MultiMesh::get_visible_instance_count() const {
|
|||
return visible_instance_count;
|
||||
}
|
||||
|
||||
void MultiMesh::set_physics_interpolation_quality(PhysicsInterpolationQuality p_quality) {
|
||||
_physics_interpolation_quality = p_quality;
|
||||
RenderingServer::get_singleton()->multimesh_set_physics_interpolation_quality(multimesh, (RS::MultimeshPhysicsInterpolationQuality)p_quality);
|
||||
}
|
||||
|
||||
void MultiMesh::set_instance_transform(int p_instance, const Transform3D &p_transform) {
|
||||
ERR_FAIL_INDEX_MSG(p_instance, instance_count, "Instance index out of bounds. Instance index must be less than `instance_count` and greater than or equal to zero.");
|
||||
ERR_FAIL_COND_MSG(transform_format == TRANSFORM_2D, "Can't set Transform3D on a Multimesh configured to use Transform2D. Ensure that you have set the `transform_format` to `TRANSFORM_3D`.");
|
||||
RenderingServer::get_singleton()->multimesh_instance_set_transform(multimesh, p_instance, p_transform);
|
||||
}
|
||||
|
||||
void MultiMesh::set_instance_transform_2d(int p_instance, const Transform2D &p_transform) {
|
||||
ERR_FAIL_INDEX_MSG(p_instance, instance_count, "Instance index out of bounds. Instance index must be less than `instance_count` and greater than or equal to zero.");
|
||||
ERR_FAIL_COND_MSG(transform_format == TRANSFORM_3D, "Can't set Transform2D on a Multimesh configured to use Transform3D. Ensure that you have set the `transform_format` to `TRANSFORM_2D`.");
|
||||
RenderingServer::get_singleton()->multimesh_instance_set_transform_2d(multimesh, p_instance, p_transform);
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
Transform3D MultiMesh::get_instance_transform(int p_instance) const {
|
||||
ERR_FAIL_INDEX_V_MSG(p_instance, instance_count, Transform3D(), "Instance index out of bounds. Instance index must be less than `instance_count` and greater than or equal to zero.");
|
||||
ERR_FAIL_COND_V_MSG(transform_format == TRANSFORM_2D, Transform3D(), "Can't get Transform3D on a Multimesh configured to use Transform2D. Ensure that you have set the `transform_format` to `TRANSFORM_3D`.");
|
||||
return RenderingServer::get_singleton()->multimesh_instance_get_transform(multimesh, p_instance);
|
||||
}
|
||||
|
||||
Transform2D MultiMesh::get_instance_transform_2d(int p_instance) const {
|
||||
ERR_FAIL_INDEX_V_MSG(p_instance, instance_count, Transform2D(), "Instance index out of bounds. Instance index must be less than `instance_count` and greater than or equal to zero.");
|
||||
ERR_FAIL_COND_V_MSG(transform_format == TRANSFORM_3D, Transform2D(), "Can't get Transform2D on a Multimesh configured to use Transform3D. Ensure that you have set the `transform_format` to `TRANSFORM_2D`.");
|
||||
return RenderingServer::get_singleton()->multimesh_instance_get_transform_2d(multimesh, p_instance);
|
||||
}
|
||||
|
||||
void MultiMesh::set_instance_color(int p_instance, const Color &p_color) {
|
||||
ERR_FAIL_INDEX_MSG(p_instance, instance_count, "Instance index out of bounds. Instance index must be less than `instance_count` and greater than or equal to zero.");
|
||||
ERR_FAIL_COND_MSG(!use_colors, "Can't set instance color on a Multimesh that isn't using colors. Ensure that you have `use_colors` property of this Multimesh set to `true`.");
|
||||
RenderingServer::get_singleton()->multimesh_instance_set_color(multimesh, p_instance, p_color);
|
||||
}
|
||||
|
||||
Color MultiMesh::get_instance_color(int p_instance) const {
|
||||
ERR_FAIL_INDEX_V_MSG(p_instance, instance_count, Color(), "Instance index out of bounds. Instance index must be less than `instance_count` and greater than or equal to zero.");
|
||||
ERR_FAIL_COND_V_MSG(!use_colors, Color(), "Can't get instance color on a Multimesh that isn't using colors. Ensure that you have `use_colors` property of this Multimesh set to `true`.");
|
||||
return RenderingServer::get_singleton()->multimesh_instance_get_color(multimesh, p_instance);
|
||||
}
|
||||
|
||||
void MultiMesh::set_instance_custom_data(int p_instance, const Color &p_custom_data) {
|
||||
ERR_FAIL_INDEX_MSG(p_instance, instance_count, "Instance index out of bounds. Instance index must be less than `instance_count` and greater than or equal to zero.");
|
||||
ERR_FAIL_COND_MSG(!use_custom_data, "Can't get instance custom data on a Multimesh that isn't using custom data. Ensure that you have `use_custom_data` property of this Multimesh set to `true`.");
|
||||
RenderingServer::get_singleton()->multimesh_instance_set_custom_data(multimesh, p_instance, p_custom_data);
|
||||
}
|
||||
|
||||
Color MultiMesh::get_instance_custom_data(int p_instance) const {
|
||||
ERR_FAIL_INDEX_V_MSG(p_instance, instance_count, Color(), "Instance index out of bounds. Instance index must be less than `instance_count` and greater than or equal to zero.");
|
||||
ERR_FAIL_COND_V_MSG(!use_custom_data, Color(), "Can't get instance custom data on a Multimesh that isn't using custom data. Ensure that you have `use_custom_data` property of this Multimesh set to `true`.");
|
||||
return RenderingServer::get_singleton()->multimesh_instance_get_custom_data(multimesh, p_instance);
|
||||
}
|
||||
|
||||
void MultiMesh::reset_instance_physics_interpolation(int p_instance) {
|
||||
ERR_FAIL_INDEX_MSG(p_instance, instance_count, "Instance index out of bounds. Instance index must be less than `instance_count` and greater than or equal to zero.");
|
||||
RenderingServer::get_singleton()->multimesh_instance_reset_physics_interpolation(multimesh, p_instance);
|
||||
}
|
||||
|
||||
void MultiMesh::set_physics_interpolated(bool p_interpolated) {
|
||||
RenderingServer::get_singleton()->multimesh_set_physics_interpolated(multimesh, p_interpolated);
|
||||
}
|
||||
|
||||
void MultiMesh::set_custom_aabb(const AABB &p_custom) {
|
||||
custom_aabb = p_custom;
|
||||
RS::get_singleton()->multimesh_set_custom_aabb(multimesh, custom_aabb);
|
||||
|
|
@ -288,7 +331,7 @@ RID MultiMesh::get_rid() const {
|
|||
}
|
||||
|
||||
void MultiMesh::set_use_colors(bool p_enable) {
|
||||
ERR_FAIL_COND(instance_count > 0);
|
||||
ERR_FAIL_COND_MSG(instance_count > 0, "Instance count must be 0 to toggle whether colors are used.");
|
||||
use_colors = p_enable;
|
||||
}
|
||||
|
||||
|
|
@ -297,7 +340,7 @@ bool MultiMesh::is_using_colors() const {
|
|||
}
|
||||
|
||||
void MultiMesh::set_use_custom_data(bool p_enable) {
|
||||
ERR_FAIL_COND(instance_count > 0);
|
||||
ERR_FAIL_COND_MSG(instance_count > 0, "Instance count must be 0 to toggle whether custom data is used.");
|
||||
use_custom_data = p_enable;
|
||||
}
|
||||
|
||||
|
|
@ -306,7 +349,7 @@ bool MultiMesh::is_using_custom_data() const {
|
|||
}
|
||||
|
||||
void MultiMesh::set_transform_format(TransformFormat p_transform_format) {
|
||||
ERR_FAIL_COND(instance_count > 0);
|
||||
ERR_FAIL_COND_MSG(instance_count > 0, "Instance count must be 0 to change the transform format.");
|
||||
transform_format = p_transform_format;
|
||||
}
|
||||
|
||||
|
|
@ -328,6 +371,8 @@ void MultiMesh::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_instance_count"), &MultiMesh::get_instance_count);
|
||||
ClassDB::bind_method(D_METHOD("set_visible_instance_count", "count"), &MultiMesh::set_visible_instance_count);
|
||||
ClassDB::bind_method(D_METHOD("get_visible_instance_count"), &MultiMesh::get_visible_instance_count);
|
||||
ClassDB::bind_method(D_METHOD("set_physics_interpolation_quality", "quality"), &MultiMesh::set_physics_interpolation_quality);
|
||||
ClassDB::bind_method(D_METHOD("get_physics_interpolation_quality"), &MultiMesh::get_physics_interpolation_quality);
|
||||
ClassDB::bind_method(D_METHOD("set_instance_transform", "instance", "transform"), &MultiMesh::set_instance_transform);
|
||||
ClassDB::bind_method(D_METHOD("set_instance_transform_2d", "instance", "transform"), &MultiMesh::set_instance_transform_2d);
|
||||
ClassDB::bind_method(D_METHOD("get_instance_transform", "instance"), &MultiMesh::get_instance_transform);
|
||||
|
|
@ -336,6 +381,7 @@ void MultiMesh::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_instance_color", "instance"), &MultiMesh::get_instance_color);
|
||||
ClassDB::bind_method(D_METHOD("set_instance_custom_data", "instance", "custom_data"), &MultiMesh::set_instance_custom_data);
|
||||
ClassDB::bind_method(D_METHOD("get_instance_custom_data", "instance"), &MultiMesh::get_instance_custom_data);
|
||||
ClassDB::bind_method(D_METHOD("reset_instance_physics_interpolation", "instance"), &MultiMesh::reset_instance_physics_interpolation);
|
||||
ClassDB::bind_method(D_METHOD("set_custom_aabb", "aabb"), &MultiMesh::set_custom_aabb);
|
||||
ClassDB::bind_method(D_METHOD("get_custom_aabb"), &MultiMesh::get_custom_aabb);
|
||||
ClassDB::bind_method(D_METHOD("get_aabb"), &MultiMesh::get_aabb);
|
||||
|
|
@ -343,6 +389,8 @@ void MultiMesh::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_buffer"), &MultiMesh::get_buffer);
|
||||
ClassDB::bind_method(D_METHOD("set_buffer", "buffer"), &MultiMesh::set_buffer);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_buffer_interpolated", "buffer_curr", "buffer_prev"), &MultiMesh::set_buffer_interpolated);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "transform_format", PROPERTY_HINT_ENUM, "2D,3D"), "set_transform_format", "get_transform_format");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_colors"), "set_use_colors", "is_using_colors");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_custom_data"), "set_use_custom_data", "is_using_custom_data");
|
||||
|
|
@ -369,8 +417,14 @@ void MultiMesh::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::PACKED_COLOR_ARRAY, "custom_data_array", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "_set_custom_data_array", "_get_custom_data_array");
|
||||
#endif
|
||||
|
||||
ADD_GROUP("Physics Interpolation", "physics_interpolation");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "physics_interpolation_quality", PROPERTY_HINT_ENUM, "Fast,High"), "set_physics_interpolation_quality", "get_physics_interpolation_quality");
|
||||
|
||||
BIND_ENUM_CONSTANT(TRANSFORM_2D);
|
||||
BIND_ENUM_CONSTANT(TRANSFORM_3D);
|
||||
|
||||
BIND_ENUM_CONSTANT(INTERP_QUALITY_FAST);
|
||||
BIND_ENUM_CONSTANT(INTERP_QUALITY_HIGH);
|
||||
}
|
||||
|
||||
MultiMesh::MultiMesh() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue