mirror of
https://github.com/Relintai/pandemonium_engine_minimal.git
synced 2024-11-10 20:12:10 +01:00
Viewport cleanup.
This commit is contained in:
parent
bbb446c509
commit
9634de59ec
@ -2484,24 +2484,6 @@ bool Viewport::is_input_disabled() const {
|
||||
return disable_input;
|
||||
}
|
||||
|
||||
void Viewport::set_disable_3d(bool p_disable) {
|
||||
disable_3d = p_disable;
|
||||
RS::get_singleton()->viewport_set_disable_3d(viewport, p_disable);
|
||||
}
|
||||
|
||||
bool Viewport::is_3d_disabled() const {
|
||||
return disable_3d;
|
||||
}
|
||||
|
||||
void Viewport::set_keep_3d_linear(bool p_keep_3d_linear) {
|
||||
keep_3d_linear = p_keep_3d_linear;
|
||||
RS::get_singleton()->viewport_set_keep_3d_linear(viewport, keep_3d_linear);
|
||||
}
|
||||
|
||||
bool Viewport::get_keep_3d_linear() const {
|
||||
return keep_3d_linear;
|
||||
}
|
||||
|
||||
Variant Viewport::gui_get_drag_data() const {
|
||||
return gui.drag_data;
|
||||
}
|
||||
@ -2779,12 +2761,6 @@ void Viewport::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_disable_input", "disable"), &Viewport::set_disable_input);
|
||||
ClassDB::bind_method(D_METHOD("is_input_disabled"), &Viewport::is_input_disabled);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_disable_3d", "disable"), &Viewport::set_disable_3d);
|
||||
ClassDB::bind_method(D_METHOD("is_3d_disabled"), &Viewport::is_3d_disabled);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_keep_3d_linear", "keep_3d_linear"), &Viewport::set_keep_3d_linear);
|
||||
ClassDB::bind_method(D_METHOD("get_keep_3d_linear"), &Viewport::get_keep_3d_linear);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_gui_show_tooltip"), &Viewport::_gui_show_tooltip);
|
||||
ClassDB::bind_method(D_METHOD("_gui_remove_focus"), &Viewport::_gui_remove_focus);
|
||||
ClassDB::bind_method(D_METHOD("_post_gui_grab_click_focus"), &Viewport::_post_gui_grab_click_focus);
|
||||
@ -2819,9 +2795,7 @@ void Viewport::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "sharpen_intensity"), "set_sharpen_intensity", "get_sharpen_intensity");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "hdr"), "set_hdr", "get_hdr");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_32_bpc_depth"), "set_use_32_bpc_depth", "get_use_32_bpc_depth");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disable_3d"), "set_disable_3d", "is_3d_disabled");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keep_3d_linear"), "set_keep_3d_linear", "get_keep_3d_linear");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "usage", PROPERTY_HINT_ENUM, "2D,2D Without Sampling,3D,3D Without Effects"), "set_usage", "get_usage");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "usage", PROPERTY_HINT_ENUM, "2D,2D Without Sampling"), "set_usage", "get_usage");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_direct_to_screen"), "set_use_render_direct_to_screen", "is_using_render_direct_to_screen");
|
||||
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_");
|
||||
@ -2868,8 +2842,6 @@ void Viewport::_bind_methods() {
|
||||
|
||||
BIND_ENUM_CONSTANT(USAGE_2D);
|
||||
BIND_ENUM_CONSTANT(USAGE_2D_NO_SAMPLING);
|
||||
BIND_ENUM_CONSTANT(USAGE_3D);
|
||||
BIND_ENUM_CONSTANT(USAGE_3D_NO_EFFECTS);
|
||||
|
||||
BIND_ENUM_CONSTANT(CLEAR_MODE_ALWAYS);
|
||||
BIND_ENUM_CONSTANT(CLEAR_MODE_NEVER);
|
||||
@ -2979,7 +2951,7 @@ Viewport::Viewport() {
|
||||
hdr = true;
|
||||
use_32_bpc_depth = false;
|
||||
|
||||
usage = USAGE_3D;
|
||||
usage = USAGE_2D;
|
||||
debug_draw = DEBUG_DRAW_DISABLED;
|
||||
clear_mode = CLEAR_MODE_ALWAYS;
|
||||
|
||||
|
@ -108,8 +108,6 @@ public:
|
||||
enum Usage {
|
||||
USAGE_2D,
|
||||
USAGE_2D_NO_SAMPLING,
|
||||
USAGE_3D,
|
||||
USAGE_3D_NO_EFFECTS,
|
||||
};
|
||||
|
||||
enum RenderInfo {
|
||||
@ -214,12 +212,6 @@ public:
|
||||
void set_disable_input(bool p_disable);
|
||||
bool is_input_disabled() const;
|
||||
|
||||
void set_disable_3d(bool p_disable);
|
||||
bool is_3d_disabled() const;
|
||||
|
||||
void set_keep_3d_linear(bool p_keep_3d_linear);
|
||||
bool get_keep_3d_linear() const;
|
||||
|
||||
void set_attach_to_screen_rect(const Rect2 &p_rect);
|
||||
Rect2 get_attach_to_screen_rect() const;
|
||||
|
||||
|
@ -306,9 +306,6 @@ public:
|
||||
BIND1RC(RID, viewport_get_texture, RID)
|
||||
|
||||
BIND2(viewport_set_hide_canvas, RID, bool)
|
||||
BIND2(viewport_set_disable_environment, RID, bool)
|
||||
BIND2(viewport_set_disable_3d, RID, bool)
|
||||
BIND2(viewport_set_keep_3d_linear, RID, bool)
|
||||
|
||||
BIND2(viewport_attach_canvas, RID, RID)
|
||||
|
||||
|
@ -281,41 +281,12 @@ RID RenderingServerViewport::viewport_get_texture(RID p_viewport) const {
|
||||
return RSG::storage->render_target_get_texture(viewport->render_target);
|
||||
}
|
||||
|
||||
void RenderingServerViewport::viewport_set_hide_scenario(RID p_viewport, bool p_hide) {
|
||||
Viewport *viewport = viewport_owner.getornull(p_viewport);
|
||||
ERR_FAIL_COND(!viewport);
|
||||
|
||||
viewport->hide_scenario = p_hide;
|
||||
}
|
||||
void RenderingServerViewport::viewport_set_hide_canvas(RID p_viewport, bool p_hide) {
|
||||
Viewport *viewport = viewport_owner.getornull(p_viewport);
|
||||
ERR_FAIL_COND(!viewport);
|
||||
|
||||
viewport->hide_canvas = p_hide;
|
||||
}
|
||||
void RenderingServerViewport::viewport_set_disable_environment(RID p_viewport, bool p_disable) {
|
||||
Viewport *viewport = viewport_owner.getornull(p_viewport);
|
||||
ERR_FAIL_COND(!viewport);
|
||||
|
||||
viewport->disable_environment = p_disable;
|
||||
}
|
||||
|
||||
void RenderingServerViewport::viewport_set_disable_3d(RID p_viewport, bool p_disable) {
|
||||
Viewport *viewport = viewport_owner.getornull(p_viewport);
|
||||
ERR_FAIL_COND(!viewport);
|
||||
|
||||
viewport->disable_3d = p_disable;
|
||||
//RSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_NO_3D, p_disable);
|
||||
//this should be just for disabling rendering of 3D, to actually disable it, set usage
|
||||
}
|
||||
|
||||
void RenderingServerViewport::viewport_set_keep_3d_linear(RID p_viewport, bool p_keep_3d_linear) {
|
||||
Viewport *viewport = viewport_owner.getornull(p_viewport);
|
||||
ERR_FAIL_COND(!viewport);
|
||||
|
||||
viewport->keep_3d_linear = p_keep_3d_linear;
|
||||
RSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_KEEP_3D_LINEAR, p_keep_3d_linear);
|
||||
}
|
||||
|
||||
void RenderingServerViewport::viewport_attach_canvas(RID p_viewport, RID p_canvas) {
|
||||
Viewport *viewport = viewport_owner.getornull(p_viewport);
|
||||
@ -423,26 +394,11 @@ void RenderingServerViewport::viewport_set_usage(RID p_viewport, RS::ViewportUsa
|
||||
RSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_NO_3D, true);
|
||||
RSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_NO_3D_EFFECTS, true);
|
||||
RSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_NO_SAMPLING, false);
|
||||
|
||||
viewport->disable_3d_by_usage = true;
|
||||
} break;
|
||||
case RS::VIEWPORT_USAGE_2D_NO_SAMPLING: {
|
||||
RSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_NO_3D, true);
|
||||
RSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_NO_3D_EFFECTS, true);
|
||||
RSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_NO_SAMPLING, true);
|
||||
viewport->disable_3d_by_usage = true;
|
||||
} break;
|
||||
case RS::VIEWPORT_USAGE_3D: {
|
||||
RSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_NO_3D, false);
|
||||
RSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_NO_3D_EFFECTS, false);
|
||||
RSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_NO_SAMPLING, false);
|
||||
viewport->disable_3d_by_usage = false;
|
||||
} break;
|
||||
case RS::VIEWPORT_USAGE_3D_NO_EFFECTS: {
|
||||
RSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_NO_3D, false);
|
||||
RSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_NO_3D_EFFECTS, true);
|
||||
RSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_NO_SAMPLING, false);
|
||||
viewport->disable_3d_by_usage = false;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
@ -470,7 +426,6 @@ bool RenderingServerViewport::free(RID p_rid) {
|
||||
Viewport *viewport = viewport_owner.getornull(p_rid);
|
||||
|
||||
RSG::storage->free(viewport->render_target);
|
||||
RSG::scene_render->free(viewport->shadow_atlas);
|
||||
|
||||
while (viewport->canvas_map.front()) {
|
||||
viewport_remove_canvas(p_rid, viewport->canvas_map.front()->key());
|
||||
|
@ -44,8 +44,6 @@ public:
|
||||
RID parent;
|
||||
|
||||
Size2i size;
|
||||
RID camera;
|
||||
RID scenario;
|
||||
|
||||
RS::ViewportUpdateMode update_mode;
|
||||
RID render_target;
|
||||
@ -57,13 +55,6 @@ public:
|
||||
|
||||
bool hide_scenario;
|
||||
bool hide_canvas;
|
||||
bool disable_environment;
|
||||
bool disable_3d;
|
||||
bool disable_3d_by_usage;
|
||||
bool keep_3d_linear;
|
||||
|
||||
RID shadow_atlas;
|
||||
int shadow_atlas_size;
|
||||
|
||||
int render_info[RS::VIEWPORT_RENDER_INFO_MAX];
|
||||
RS::ViewportDebugDraw debug_draw;
|
||||
@ -107,12 +98,7 @@ public:
|
||||
update_mode = RS::VIEWPORT_UPDATE_WHEN_VISIBLE;
|
||||
clear_mode = RS::VIEWPORT_CLEAR_ALWAYS;
|
||||
transparent_bg = false;
|
||||
disable_environment = false;
|
||||
viewport_to_screen = 0;
|
||||
shadow_atlas_size = 0;
|
||||
disable_3d = false;
|
||||
disable_3d_by_usage = false;
|
||||
keep_3d_linear = false;
|
||||
debug_draw = RS::VIEWPORT_DEBUG_DRAW_DISABLED;
|
||||
for (int i = 0; i < RS::VIEWPORT_RENDER_INFO_MAX; i++) {
|
||||
render_info[i] = 0;
|
||||
@ -158,11 +144,7 @@ public:
|
||||
|
||||
RID viewport_get_texture(RID p_viewport) const;
|
||||
|
||||
void viewport_set_hide_scenario(RID p_viewport, bool p_hide);
|
||||
void viewport_set_hide_canvas(RID p_viewport, bool p_hide);
|
||||
void viewport_set_disable_environment(RID p_viewport, bool p_disable);
|
||||
void viewport_set_disable_3d(RID p_viewport, bool p_disable);
|
||||
void viewport_set_keep_3d_linear(RID p_viewport, bool p_keep_3d_linear);
|
||||
|
||||
void viewport_attach_canvas(RID p_viewport, RID p_canvas);
|
||||
void viewport_remove_canvas(RID p_viewport, RID p_canvas);
|
||||
|
@ -230,9 +230,6 @@ public:
|
||||
FUNC1RC(RID, viewport_get_texture, RID)
|
||||
|
||||
FUNC2(viewport_set_hide_canvas, RID, bool)
|
||||
FUNC2(viewport_set_disable_environment, RID, bool)
|
||||
FUNC2(viewport_set_disable_3d, RID, bool)
|
||||
FUNC2(viewport_set_keep_3d_linear, RID, bool)
|
||||
|
||||
FUNC2(viewport_attach_canvas, RID, RID)
|
||||
|
||||
|
@ -2094,8 +2094,6 @@ void RenderingServer::_bind_methods() {
|
||||
|
||||
BIND_ENUM_CONSTANT(VIEWPORT_USAGE_2D);
|
||||
BIND_ENUM_CONSTANT(VIEWPORT_USAGE_2D_NO_SAMPLING);
|
||||
BIND_ENUM_CONSTANT(VIEWPORT_USAGE_3D);
|
||||
BIND_ENUM_CONSTANT(VIEWPORT_USAGE_3D_NO_EFFECTS);
|
||||
|
||||
BIND_ENUM_CONSTANT(VIEWPORT_RENDER_INFO_OBJECTS_IN_FRAME);
|
||||
BIND_ENUM_CONSTANT(VIEWPORT_RENDER_INFO_VERTICES_IN_FRAME);
|
||||
|
@ -420,10 +420,7 @@ public:
|
||||
virtual RID viewport_get_texture(RID p_viewport) const = 0;
|
||||
|
||||
virtual void viewport_set_hide_canvas(RID p_viewport, bool p_hide) = 0;
|
||||
virtual void viewport_set_disable_environment(RID p_viewport, bool p_disable) = 0;
|
||||
virtual void viewport_set_disable_3d(RID p_viewport, bool p_disable) = 0;
|
||||
virtual void viewport_set_keep_3d_linear(RID p_viewport, bool p_disable) = 0;
|
||||
|
||||
|
||||
virtual void viewport_attach_canvas(RID p_viewport, RID p_canvas) = 0;
|
||||
virtual void viewport_remove_canvas(RID p_viewport, RID p_canvas) = 0;
|
||||
virtual void viewport_set_canvas_transform(RID p_viewport, RID p_canvas, const Transform2D &p_offset) = 0;
|
||||
@ -450,8 +447,6 @@ public:
|
||||
enum ViewportUsage {
|
||||
VIEWPORT_USAGE_2D,
|
||||
VIEWPORT_USAGE_2D_NO_SAMPLING,
|
||||
VIEWPORT_USAGE_3D,
|
||||
VIEWPORT_USAGE_3D_NO_EFFECTS,
|
||||
};
|
||||
|
||||
virtual void viewport_set_hdr(RID p_viewport, bool p_enabled) = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user