You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00: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:
@@ -358,9 +358,9 @@ void CollisionPolygon3DEditor::_polygon_draw() {
|
||||
|
||||
float depth = _get_depth() * 0.5;
|
||||
|
||||
imgeom->clear();
|
||||
imesh->clear_surfaces();
|
||||
imgeom->set_material_override(line_material);
|
||||
imgeom->begin(Mesh::PRIMITIVE_LINES, Ref<Texture2D>());
|
||||
imesh->surface_begin(Mesh::PRIMITIVE_LINES);
|
||||
|
||||
Rect2 rect;
|
||||
|
||||
@@ -382,10 +382,10 @@ void CollisionPolygon3DEditor::_polygon_draw() {
|
||||
Vector3 point = Vector3(p.x, p.y, depth);
|
||||
Vector3 next_point = Vector3(p2.x, p2.y, depth);
|
||||
|
||||
imgeom->set_color(Color(1, 0.3, 0.1, 0.8));
|
||||
imgeom->add_vertex(point);
|
||||
imgeom->set_color(Color(1, 0.3, 0.1, 0.8));
|
||||
imgeom->add_vertex(next_point);
|
||||
imesh->surface_set_color(Color(1, 0.3, 0.1, 0.8));
|
||||
imesh->surface_add_vertex(point);
|
||||
imesh->surface_set_color(Color(1, 0.3, 0.1, 0.8));
|
||||
imesh->surface_add_vertex(next_point);
|
||||
|
||||
//Color col=Color(1,0.3,0.1,0.8);
|
||||
//vpc->draw_line(point,next_point,col,2);
|
||||
@@ -402,45 +402,43 @@ void CollisionPolygon3DEditor::_polygon_draw() {
|
||||
r.size.y = rect.size.y;
|
||||
r.size.z = 0;
|
||||
|
||||
imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imgeom->add_vertex(r.position);
|
||||
imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imgeom->add_vertex(r.position + Vector3(0.3, 0, 0));
|
||||
imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imgeom->add_vertex(r.position);
|
||||
imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imgeom->add_vertex(r.position + Vector3(0.0, 0.3, 0));
|
||||
imesh->surface_set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imesh->surface_add_vertex(r.position);
|
||||
imesh->surface_set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imesh->surface_add_vertex(r.position + Vector3(0.3, 0, 0));
|
||||
imesh->surface_set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imesh->surface_add_vertex(r.position);
|
||||
imesh->surface_set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imesh->surface_add_vertex(r.position + Vector3(0.0, 0.3, 0));
|
||||
|
||||
imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imgeom->add_vertex(r.position + Vector3(r.size.x, 0, 0));
|
||||
imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imgeom->add_vertex(r.position + Vector3(r.size.x, 0, 0) - Vector3(0.3, 0, 0));
|
||||
imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imgeom->add_vertex(r.position + Vector3(r.size.x, 0, 0));
|
||||
imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imgeom->add_vertex(r.position + Vector3(r.size.x, 0, 0) + Vector3(0, 0.3, 0));
|
||||
imesh->surface_set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imesh->surface_add_vertex(r.position + Vector3(r.size.x, 0, 0));
|
||||
imesh->surface_set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imesh->surface_add_vertex(r.position + Vector3(r.size.x, 0, 0) - Vector3(0.3, 0, 0));
|
||||
imesh->surface_set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imesh->surface_add_vertex(r.position + Vector3(r.size.x, 0, 0));
|
||||
imesh->surface_set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imesh->surface_add_vertex(r.position + Vector3(r.size.x, 0, 0) + Vector3(0, 0.3, 0));
|
||||
|
||||
imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imgeom->add_vertex(r.position + Vector3(0, r.size.y, 0));
|
||||
imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imgeom->add_vertex(r.position + Vector3(0, r.size.y, 0) - Vector3(0, 0.3, 0));
|
||||
imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imgeom->add_vertex(r.position + Vector3(0, r.size.y, 0));
|
||||
imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imgeom->add_vertex(r.position + Vector3(0, r.size.y, 0) + Vector3(0.3, 0, 0));
|
||||
imesh->surface_set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imesh->surface_add_vertex(r.position + Vector3(0, r.size.y, 0));
|
||||
imesh->surface_set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imesh->surface_add_vertex(r.position + Vector3(0, r.size.y, 0) - Vector3(0, 0.3, 0));
|
||||
imesh->surface_set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imesh->surface_add_vertex(r.position + Vector3(0, r.size.y, 0));
|
||||
imesh->surface_set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imesh->surface_add_vertex(r.position + Vector3(0, r.size.y, 0) + Vector3(0.3, 0, 0));
|
||||
|
||||
imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imgeom->add_vertex(r.position + r.size);
|
||||
imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imgeom->add_vertex(r.position + r.size - Vector3(0.3, 0, 0));
|
||||
imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imgeom->add_vertex(r.position + r.size);
|
||||
imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imgeom->add_vertex(r.position + r.size - Vector3(0.0, 0.3, 0));
|
||||
imesh->surface_set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imesh->surface_add_vertex(r.position + r.size);
|
||||
imesh->surface_set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imesh->surface_add_vertex(r.position + r.size - Vector3(0.3, 0, 0));
|
||||
imesh->surface_set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imesh->surface_add_vertex(r.position + r.size);
|
||||
imesh->surface_set_color(Color(0.8, 0.8, 0.8, 0.2));
|
||||
imesh->surface_add_vertex(r.position + r.size - Vector3(0.0, 0.3, 0));
|
||||
|
||||
imgeom->end();
|
||||
|
||||
m->clear_surfaces();
|
||||
imesh->surface_end();
|
||||
|
||||
if (poly.size() == 0) {
|
||||
return;
|
||||
@@ -515,7 +513,9 @@ CollisionPolygon3DEditor::CollisionPolygon3DEditor(EditorNode *p_editor) {
|
||||
|
||||
mode = MODE_EDIT;
|
||||
wip_active = false;
|
||||
imgeom = memnew(ImmediateGeometry3D);
|
||||
imgeom = memnew(MeshInstance3D);
|
||||
imesh.instantiate();
|
||||
imgeom->set_mesh(imesh);
|
||||
imgeom->set_transform(Transform3D(Basis(), Vector3(0, 0, 0.00001)));
|
||||
|
||||
line_material = Ref<StandardMaterial3D>(memnew(StandardMaterial3D));
|
||||
|
||||
Reference in New Issue
Block a user