Exposed new ClearMode function to Viewport clases, closes #9995
This commit is contained in:
parent
d57ba499cb
commit
5653477a30
@ -1202,15 +1202,15 @@ bool Viewport::get_vflip() const {
|
||||
return vflip;
|
||||
}
|
||||
|
||||
void Viewport::set_clear_on_new_frame(bool p_enable) {
|
||||
void Viewport::set_clear_mode(ClearMode p_mode) {
|
||||
|
||||
clear_on_new_frame = p_enable;
|
||||
//VisualServer::get_singleton()->viewport_set_clear_on_new_frame(viewport,p_enable);
|
||||
clear_mode = p_mode;
|
||||
VS::get_singleton()->viewport_set_clear_mode(viewport, VS::ViewportClearMode(p_mode));
|
||||
}
|
||||
|
||||
bool Viewport::get_clear_on_new_frame() const {
|
||||
Viewport::ClearMode Viewport::get_clear_mode() const {
|
||||
|
||||
return clear_on_new_frame;
|
||||
return clear_mode;
|
||||
}
|
||||
|
||||
void Viewport::set_shadow_atlas_size(int p_size) {
|
||||
@ -1246,12 +1246,6 @@ Viewport::ShadowAtlasQuadrantSubdiv Viewport::get_shadow_atlas_quadrant_subdiv(i
|
||||
return shadow_atlas_quadrant_subdiv[p_quadrant];
|
||||
}
|
||||
|
||||
void Viewport::clear() {
|
||||
|
||||
//clear=true;
|
||||
//VisualServer::get_singleton()->viewport_clear(viewport);
|
||||
}
|
||||
|
||||
Transform2D Viewport::_get_input_pre_xform() const {
|
||||
|
||||
Transform2D pre_xf;
|
||||
@ -2625,10 +2619,9 @@ void Viewport::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_vflip", "enable"), &Viewport::set_vflip);
|
||||
ClassDB::bind_method(D_METHOD("get_vflip"), &Viewport::get_vflip);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_clear_on_new_frame", "enable"), &Viewport::set_clear_on_new_frame);
|
||||
ClassDB::bind_method(D_METHOD("get_clear_on_new_frame"), &Viewport::get_clear_on_new_frame);
|
||||
ClassDB::bind_method(D_METHOD("set_clear_mode", "mode"), &Viewport::set_clear_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_clear_mode"), &Viewport::get_clear_mode);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("clear"), &Viewport::clear);
|
||||
ClassDB::bind_method(D_METHOD("set_update_mode", "mode"), &Viewport::set_update_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_update_mode"), &Viewport::get_update_mode);
|
||||
|
||||
@ -2705,7 +2698,7 @@ void Viewport::_bind_methods() {
|
||||
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");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_target_clear_mode", PROPERTY_HINT_ENUM, "Always,Never,NextFrame"), "set_clear_mode", "get_clear_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "render_target_update_mode", PROPERTY_HINT_ENUM, "Disabled,Once,When Visible,Always"), "set_update_mode", "get_update_mode");
|
||||
ADD_GROUP("Audio Listener", "audio_listener_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "audio_listener_enable_2d"), "set_as_audio_listener_2d", "is_audio_listener_2d");
|
||||
@ -2784,7 +2777,7 @@ Viewport::Viewport() {
|
||||
gen_mipmaps = false;
|
||||
|
||||
vflip = false;
|
||||
clear_on_new_frame = true;
|
||||
|
||||
//clear=true;
|
||||
update_mode = UPDATE_WHEN_VISIBLE;
|
||||
|
||||
@ -2828,6 +2821,7 @@ Viewport::Viewport() {
|
||||
|
||||
usage = USAGE_3D;
|
||||
debug_draw = DEBUG_DRAW_DISABLED;
|
||||
clear_mode = CLEAR_MODE_ALWAYS;
|
||||
}
|
||||
|
||||
Viewport::~Viewport() {
|
||||
|
@ -140,6 +140,13 @@ public:
|
||||
DEBUG_DRAW_WIREFRAME,
|
||||
};
|
||||
|
||||
enum ClearMode {
|
||||
|
||||
CLEAR_MODE_ALWAYS,
|
||||
CLEAR_MODE_NEVER,
|
||||
CLEAR_MODE_ONLY_NEXT_FRAME
|
||||
};
|
||||
|
||||
private:
|
||||
friend class ViewportTexture;
|
||||
|
||||
@ -182,7 +189,7 @@ private:
|
||||
|
||||
bool transparent_bg;
|
||||
bool vflip;
|
||||
bool clear_on_new_frame;
|
||||
ClearMode clear_mode;
|
||||
bool filter;
|
||||
bool gen_mipmaps;
|
||||
|
||||
@ -395,9 +402,8 @@ public:
|
||||
void set_vflip(bool p_enable);
|
||||
bool get_vflip() const;
|
||||
|
||||
void set_clear_on_new_frame(bool p_enable);
|
||||
bool get_clear_on_new_frame() const;
|
||||
void clear();
|
||||
void set_clear_mode(ClearMode p_mode);
|
||||
ClearMode get_clear_mode() const;
|
||||
|
||||
void set_update_mode(UpdateMode p_mode);
|
||||
UpdateMode get_update_mode() const;
|
||||
@ -466,6 +472,7 @@ VARIANT_ENUM_CAST(Viewport::ShadowAtlasQuadrantSubdiv);
|
||||
VARIANT_ENUM_CAST(Viewport::MSAA);
|
||||
VARIANT_ENUM_CAST(Viewport::Usage);
|
||||
VARIANT_ENUM_CAST(Viewport::DebugDraw);
|
||||
VARIANT_ENUM_CAST(Viewport::ClearMode);
|
||||
VARIANT_ENUM_CAST(Viewport::RenderInfo);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user