summaryrefslogtreecommitdiff
path: root/scene/main/viewport.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main/viewport.cpp')
-rw-r--r--scene/main/viewport.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 95fad83a28..763cac2af4 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -2530,6 +2530,22 @@ Viewport::Usage Viewport::get_usage() const {
return usage;
}
+void Viewport::set_debug_draw(DebugDraw p_debug_draw) {
+
+ debug_draw = p_debug_draw;
+ VS::get_singleton()->viewport_set_debug_draw(viewport, VS::ViewportDebugDraw(p_debug_draw));
+}
+
+Viewport::DebugDraw Viewport::get_debug_draw() const {
+
+ return debug_draw;
+}
+
+int Viewport::get_render_info(RenderInfo p_info) {
+
+ return VS::get_singleton()->viewport_get_render_info(viewport, VS::ViewportRenderInfo(p_info));
+}
+
void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_size", "size"), &Viewport::set_size);
@@ -2586,6 +2602,11 @@ void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_usage", "usage"), &Viewport::set_usage);
ClassDB::bind_method(D_METHOD("get_usage"), &Viewport::get_usage);
+ ClassDB::bind_method(D_METHOD("set_debug_draw", "debug_draw"), &Viewport::set_debug_draw);
+ ClassDB::bind_method(D_METHOD("get_debug_draw"), &Viewport::get_debug_draw);
+
+ ClassDB::bind_method(D_METHOD("get_render_info", "info"), &Viewport::get_render_info);
+
ClassDB::bind_method(D_METHOD("get_texture:ViewportTexture"), &Viewport::get_texture);
ClassDB::bind_method(D_METHOD("set_physics_object_picking", "enable"), &Viewport::set_physics_object_picking);
@@ -2640,6 +2661,7 @@ void Viewport::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "hdr"), "set_hdr", "get_hdr");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disable_3d"), "set_disable_3d", "is_3d_disabled");
ADD_PROPERTY(PropertyInfo(Variant::INT, "usage", PROPERTY_HINT_ENUM, "2D,2D No-Sampling,3D,3D No-Effects"), "set_usage", "get_usage");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "debug_draw", PROPERTY_HINT_ENUM, "Disabled,Unshaded,Overdraw,Wireframe"), "set_debug_draw", "get_debug_draw");
ADD_GROUP("Render Target", "render_target_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_target_v_flip"), "set_vflip", "get_vflip");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_target_clear_on_new_frame"), "set_clear_on_new_frame", "get_clear_on_new_frame");
@@ -2674,6 +2696,19 @@ void Viewport::_bind_methods() {
BIND_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_1024);
BIND_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_MAX);
+ BIND_CONSTANT(RENDER_INFO_OBJECTS_IN_FRAME);
+ BIND_CONSTANT(RENDER_INFO_VERTICES_IN_FRAME);
+ BIND_CONSTANT(RENDER_INFO_MATERIAL_CHANGES_IN_FRAME);
+ BIND_CONSTANT(RENDER_INFO_SHADER_CHANGES_IN_FRAME);
+ BIND_CONSTANT(RENDER_INFO_SURFACE_CHANGES_IN_FRAME);
+ BIND_CONSTANT(RENDER_INFO_DRAW_CALLS_IN_FRAME);
+ BIND_CONSTANT(RENDER_INFO_MAX);
+
+ BIND_CONSTANT(DEBUG_DRAW_DISABLED);
+ BIND_CONSTANT(DEBUG_DRAW_UNSHADED);
+ BIND_CONSTANT(DEBUG_DRAW_OVERDRAW);
+ BIND_CONSTANT(DEBUG_DRAW_WIREFRAME);
+
BIND_CONSTANT(MSAA_DISABLED);
BIND_CONSTANT(MSAA_2X);
BIND_CONSTANT(MSAA_4X);
@@ -2750,6 +2785,7 @@ Viewport::Viewport() {
hdr = false;
usage = USAGE_3D;
+ debug_draw = DEBUG_DRAW_DISABLED;
}
Viewport::~Viewport() {