summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/collision_polygon_3d_editor_plugin.cpp92
-rw-r--r--editor/plugins/collision_polygon_3d_editor_plugin.h5
-rw-r--r--editor/plugins/node_3d_editor_plugin.h1
3 files changed, 49 insertions, 49 deletions
diff --git a/editor/plugins/collision_polygon_3d_editor_plugin.cpp b/editor/plugins/collision_polygon_3d_editor_plugin.cpp
index 7873c1b136..6f90d278bd 100644
--- a/editor/plugins/collision_polygon_3d_editor_plugin.cpp
+++ b/editor/plugins/collision_polygon_3d_editor_plugin.cpp
@@ -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));
-
- 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));
-
- 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));
-
- 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));
-
- imgeom->end();
-
- m->clear_surfaces();
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
diff --git a/editor/plugins/collision_polygon_3d_editor_plugin.h b/editor/plugins/collision_polygon_3d_editor_plugin.h
index c66518e3e5..5db0f7308a 100644
--- a/editor/plugins/collision_polygon_3d_editor_plugin.h
+++ b/editor/plugins/collision_polygon_3d_editor_plugin.h
@@ -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;
diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h
index fa432a5868..02f89a12de 100644
--- a/editor/plugins/node_3d_editor_plugin.h
+++ b/editor/plugins/node_3d_editor_plugin.h
@@ -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"