summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/scene_main_loop.cpp5
-rw-r--r--scene/main/viewport.cpp48
-rw-r--r--scene/main/viewport.h22
3 files changed, 72 insertions, 3 deletions
diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp
index abc4bf3fe2..3145be1dbf 100644
--- a/scene/main/scene_main_loop.cpp
+++ b/scene/main/scene_main_loop.cpp
@@ -2322,6 +2322,11 @@ SceneTree::SceneTree() {
int ref_atlas_size = GLOBAL_DEF("rendering/reflections/atlas_size",2048);
int ref_atlas_subdiv = GLOBAL_DEF("rendering/reflections/atlas_subdiv",8);
+ int msaa_mode = GLOBAL_DEF("rendering/antialias/msaa",0);
+ Globals::get_singleton()->set_custom_property_info("rendering/antialias/msaa",PropertyInfo(Variant::INT,"rendering/antialias/msaa",PROPERTY_HINT_ENUM,"Disabled,2x,4x,8x,16x"));
+ root->set_msaa(Viewport::MSAA(msaa_mode));
+ bool hdr = GLOBAL_DEF("rendering/dynamic_range/hdr",true);
+ root->set_hdr(hdr);
VS::get_singleton()->scenario_set_reflection_atlas_size(root->get_world()->get_scenario(),ref_atlas_size,ref_atlas_subdiv);
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 8dec34a4cd..29b18c090b 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -2593,6 +2593,36 @@ int Viewport::gui_get_canvas_sort_index() {
return gui.canvas_sort_index++;
}
+void Viewport::set_msaa(MSAA p_msaa) {
+
+ ERR_FAIL_INDEX(p_msaa,5);
+ if (msaa==p_msaa)
+ return;
+ msaa=p_msaa;
+ VS::get_singleton()->viewport_set_msaa(viewport,VS::ViewportMSAA(p_msaa));
+}
+
+Viewport::MSAA Viewport::get_msaa() const {
+
+ return msaa;
+}
+
+void Viewport::set_hdr(bool p_hdr) {
+
+ if (hdr==p_hdr)
+ return;
+
+ hdr=p_hdr;
+ VS::get_singleton()->viewport_set_hdr(viewport,p_hdr);
+
+}
+
+bool Viewport::get_hdr() const{
+
+ return hdr;
+}
+
+
void Viewport::_bind_methods() {
@@ -2643,6 +2673,12 @@ void Viewport::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_update_mode","mode"), &Viewport::set_update_mode);
ObjectTypeDB::bind_method(_MD("get_update_mode"), &Viewport::get_update_mode);
+ ObjectTypeDB::bind_method(_MD("set_msaa","msaa"), &Viewport::set_msaa);
+ ObjectTypeDB::bind_method(_MD("get_msaa"), &Viewport::get_msaa);
+
+ ObjectTypeDB::bind_method(_MD("set_hdr","enable"), &Viewport::set_hdr);
+ ObjectTypeDB::bind_method(_MD("get_hdr"), &Viewport::get_hdr);
+
ObjectTypeDB::bind_method(_MD("get_texture:ViewportTexture"), &Viewport::get_texture);
ObjectTypeDB::bind_method(_MD("set_physics_object_picking","enable"), &Viewport::set_physics_object_picking);
@@ -2692,6 +2728,8 @@ void Viewport::_bind_methods() {
ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"world",PROPERTY_HINT_RESOURCE_TYPE,"World"), _SCS("set_world"), _SCS("get_world") );
// ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"world_2d",PROPERTY_HINT_RESOURCE_TYPE,"World2D"), _SCS("set_world_2d"), _SCS("get_world_2d") );
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"transparent_bg"), _SCS("set_transparent_background"), _SCS("has_transparent_background") );
+ ADD_PROPERTY( PropertyInfo(Variant::INT,"msaa",PROPERTY_HINT_ENUM,"Disabled,2x,4x,8x,16x"), _SCS("set_msaa"), _SCS("get_msaa") );
+ ADD_PROPERTY( PropertyInfo(Variant::BOOL,"hdr"), _SCS("set_hdr"), _SCS("get_hdr") );
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target/v_flip"), _SCS("set_vflip"), _SCS("get_vflip") );
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target/clear_on_new_frame"), _SCS("set_clear_on_new_frame"), _SCS("get_clear_on_new_frame") );
ADD_PROPERTY( PropertyInfo(Variant::INT,"render_target/update_mode",PROPERTY_HINT_ENUM,"Disabled,Once,When Visible,Always"), _SCS("set_update_mode"), _SCS("get_update_mode") );
@@ -2721,6 +2759,13 @@ void Viewport::_bind_methods() {
BIND_CONSTANT( SHADOW_ATLAS_QUADRANT_SUBDIV_256 );
BIND_CONSTANT( SHADOW_ATLAS_QUADRANT_SUBDIV_1024 );
BIND_CONSTANT( SHADOW_ATLAS_QUADRANT_SUBDIV_MAX );
+
+ BIND_CONSTANT( MSAA_DISABLED );
+ BIND_CONSTANT( MSAA_2X );
+ BIND_CONSTANT( MSAA_4X );
+ BIND_CONSTANT( MSAA_8X );
+ BIND_CONSTANT( MSAA_16X );
+
}
@@ -2790,7 +2835,8 @@ Viewport::Viewport() {
gui.canvas_sort_index=0;
-
+ msaa=MSAA_DISABLED;
+ hdr=false;
}
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 462ecff93e..46e88e068e 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -98,6 +98,14 @@ public:
};
+ enum MSAA {
+ MSAA_DISABLED,
+ MSAA_2X,
+ MSAA_4X,
+ MSAA_8X,
+ MSAA_16X,
+ };
+
private:
friend class ViewportTexture;
@@ -188,6 +196,9 @@ friend class ViewportTexture;
int shadow_atlas_size;
ShadowAtlasQuadrantSubdiv shadow_atlas_quadrant_subdiv[4];
+ MSAA msaa;
+ bool hdr;
+
struct GUI {
// info used when this is a window
@@ -366,6 +377,12 @@ public:
void set_shadow_atlas_quadrant_subdiv(int p_quadrant,ShadowAtlasQuadrantSubdiv p_subdiv);
ShadowAtlasQuadrantSubdiv get_shadow_atlas_quadrant_subdiv(int p_quadrant) const;
+ void set_msaa(MSAA p_msaa);
+ MSAA get_msaa() const;
+
+ void set_hdr(bool p_hdr);
+ bool get_hdr() const;
+
Vector2 get_camera_coords(const Vector2& p_viewport_coords) const;
Vector2 get_camera_rect_size() const;
@@ -410,7 +427,8 @@ public:
};
-VARIANT_ENUM_CAST(Viewport::UpdateMode);
-VARIANT_ENUM_CAST(Viewport::ShadowAtlasQuadrantSubdiv);
+VARIANT_ENUM_CAST( Viewport::UpdateMode );
+VARIANT_ENUM_CAST( Viewport::ShadowAtlasQuadrantSubdiv );
+VARIANT_ENUM_CAST( Viewport::MSAA );
#endif