mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Deprecate ImmediateGeometry
* Removed entirely from RenderingServer. * Replaced by ImmediateMesh resource. * ImmediateMesh replaces ImmediateGeometry, but could use more optimization in the future. * Sprite3D and AnimatedSprite3D work again, ported from Godot 3.x (though a lot of work was needed to adapt them to Godot 4). * RootMotionView works again. * Polygon3D editor works again.
This commit is contained in:
@@ -77,7 +77,7 @@ bool RootMotionView::get_zero_y() const {
|
||||
|
||||
void RootMotionView::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
RS::get_singleton()->immediate_set_material(immediate, StandardMaterial3D::get_material_rid_for_2d(false, true, false, false, false));
|
||||
immediate_material = StandardMaterial3D::get_material_for_2d(false, true, false, false, false);
|
||||
first = true;
|
||||
}
|
||||
|
||||
@@ -119,11 +119,12 @@ void RootMotionView::_notification(int p_what) {
|
||||
}
|
||||
accumulated.origin.z = Math::fposmod(accumulated.origin.z, cell_size);
|
||||
|
||||
RS::get_singleton()->immediate_clear(immediate);
|
||||
immediate->clear_surfaces();
|
||||
|
||||
int cells_in_radius = int((radius / cell_size) + 1.0);
|
||||
|
||||
RS::get_singleton()->immediate_begin(immediate, RS::PRIMITIVE_LINES);
|
||||
immediate->surface_begin(Mesh::PRIMITIVE_LINES, immediate_material);
|
||||
|
||||
for (int i = -cells_in_radius; i < cells_in_radius; i++) {
|
||||
for (int j = -cells_in_radius; j < cells_in_radius; j++) {
|
||||
Vector3 from(i * cell_size, 0, j * cell_size);
|
||||
@@ -138,21 +139,21 @@ void RootMotionView::_notification(int p_what) {
|
||||
c_i.a *= MAX(0, 1.0 - from_i.length() / radius);
|
||||
c_j.a *= MAX(0, 1.0 - from_j.length() / radius);
|
||||
|
||||
RS::get_singleton()->immediate_color(immediate, c);
|
||||
RS::get_singleton()->immediate_vertex(immediate, from);
|
||||
immediate->surface_set_color(c);
|
||||
immediate->surface_add_vertex(from);
|
||||
|
||||
RS::get_singleton()->immediate_color(immediate, c_i);
|
||||
RS::get_singleton()->immediate_vertex(immediate, from_i);
|
||||
immediate->surface_set_color(c_i);
|
||||
immediate->surface_add_vertex(from_i);
|
||||
|
||||
RS::get_singleton()->immediate_color(immediate, c);
|
||||
RS::get_singleton()->immediate_vertex(immediate, from);
|
||||
immediate->surface_set_color(c);
|
||||
immediate->surface_add_vertex(from);
|
||||
|
||||
RS::get_singleton()->immediate_color(immediate, c_j);
|
||||
RS::get_singleton()->immediate_vertex(immediate, from_j);
|
||||
immediate->surface_set_color(c_j);
|
||||
immediate->surface_add_vertex(from_j);
|
||||
}
|
||||
}
|
||||
|
||||
RS::get_singleton()->immediate_end(immediate);
|
||||
immediate->surface_end();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,12 +189,13 @@ void RootMotionView::_bind_methods() {
|
||||
}
|
||||
|
||||
RootMotionView::RootMotionView() {
|
||||
set_process_internal(true);
|
||||
immediate = RenderingServer::get_singleton()->immediate_create();
|
||||
set_base(immediate);
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
set_process_internal(true);
|
||||
}
|
||||
immediate.instantiate();
|
||||
set_base(immediate->get_rid());
|
||||
}
|
||||
|
||||
RootMotionView::~RootMotionView() {
|
||||
set_base(RID());
|
||||
RenderingServer::get_singleton()->free(immediate);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user