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:
parent
bcd1fc832f
commit
85cf99f28e
32 changed files with 1082 additions and 834 deletions
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@
|
|||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_plugin.h"
|
||||
#include "scene/3d/collision_polygon_3d.h"
|
||||
#include "scene/3d/immediate_geometry_3d.h"
|
||||
#include "scene/3d/mesh_instance_3d.h"
|
||||
#include "scene/resources/immediate_mesh.h"
|
||||
|
||||
class CanvasItemEditor;
|
||||
|
||||
|
|
@ -60,7 +60,8 @@ class CollisionPolygon3DEditor : public HBoxContainer {
|
|||
EditorNode *editor;
|
||||
Panel *panel;
|
||||
Node3D *node;
|
||||
ImmediateGeometry3D *imgeom;
|
||||
Ref<ImmediateMesh> imesh;
|
||||
MeshInstance3D *imgeom;
|
||||
MeshInstance3D *pointsm;
|
||||
Ref<ArrayMesh> m;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@
|
|||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_plugin.h"
|
||||
#include "editor/editor_scale.h"
|
||||
#include "scene/3d/immediate_geometry_3d.h"
|
||||
#include "scene/3d/light_3d.h"
|
||||
#include "scene/3d/visual_instance_3d.h"
|
||||
#include "scene/3d/world_environment.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue