From 22d83bc9f655d5ae7a1b49709c4c1b663725daf5 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 3 Oct 2016 16:33:42 -0300 Subject: Begining of GLES3 renderer: -Most 2D drawing is implemented -Missing shaders -Missing all 3D -Editor needs to be set on update always to be used, otherwise it does not refresh -Large parts of editor not working --- scene/main/scene_main_loop.cpp | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'scene/main/scene_main_loop.cpp') diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index e3472c074a..c1552a4167 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -746,11 +746,11 @@ Ref SceneTree::get_debug_navigation_material() { return navigation_material; Ref line_material = Ref( memnew( FixedMaterial )); - line_material->set_flag(Material::FLAG_UNSHADED, true); +/* line_material->set_flag(Material::FLAG_UNSHADED, true); line_material->set_line_width(3.0); line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_navigation_color()); + line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_navigation_color());*/ navigation_material=line_material; @@ -764,11 +764,11 @@ Ref SceneTree::get_debug_navigation_disabled_material(){ return navigation_disabled_material; Ref line_material = Ref( memnew( FixedMaterial )); - line_material->set_flag(Material::FLAG_UNSHADED, true); +/* line_material->set_flag(Material::FLAG_UNSHADED, true); line_material->set_line_width(3.0); line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_navigation_disabled_color()); + line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_navigation_disabled_color());*/ navigation_disabled_material=line_material; @@ -782,11 +782,11 @@ Ref SceneTree::get_debug_collision_material() { Ref line_material = Ref( memnew( FixedMaterial )); - line_material->set_flag(Material::FLAG_UNSHADED, true); + /*line_material->set_flag(Material::FLAG_UNSHADED, true); line_material->set_line_width(3.0); line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_collisions_color()); + line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_collisions_color());*/ collision_material=line_material; @@ -801,10 +801,10 @@ Ref SceneTree::get_debug_contact_mesh() { debug_contact_mesh = Ref( memnew( Mesh ) ); Ref mat = memnew( FixedMaterial ); - mat->set_flag(Material::FLAG_UNSHADED,true); + /*mat->set_flag(Material::FLAG_UNSHADED,true); mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); - mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_collision_contact_color()); + mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_collision_contact_color());*/ Vector3 diamond[6]={ Vector3(-1, 0, 0), @@ -1098,7 +1098,11 @@ void SceneTree::_update_root_rect() { if (stretch_mode==STRETCH_MODE_DISABLED) { - root->set_rect(Rect2(Point2(),last_screen_size)); + + root->set_size(last_screen_size); + root->set_attach_to_screen_rect(Rect2(Point2(),last_screen_size)); + root->set_size_override_stretch(false); + root->set_size_override(false,Size2()); return; //user will take care } @@ -1174,21 +1178,18 @@ void SceneTree::_update_root_rect() { switch (stretch_mode) { case STRETCH_MODE_2D: { -// root->set_rect(Rect2(Point2(),video_mode)); - root->set_as_render_target(false); - root->set_rect(Rect2(margin,screen_size)); + root->set_size(screen_size); + root->set_attach_to_screen_rect(Rect2(margin,screen_size)); root->set_size_override_stretch(true); root->set_size_override(true,viewport_size); } break; case STRETCH_MODE_VIEWPORT: { - root->set_rect(Rect2(Point2(),viewport_size)); + root->set_size(viewport_size); + root->set_attach_to_screen_rect(Rect2(margin,screen_size)); root->set_size_override_stretch(false); root->set_size_override(false,Size2()); - root->set_as_render_target(true); - root->set_render_target_update_mode(Viewport::RENDER_TARGET_UPDATE_ALWAYS); - root->set_render_target_to_screen_rect(Rect2(margin,screen_size)); } break; @@ -2300,7 +2301,7 @@ SceneTree::SceneTree() { stretch_aspect=STRETCH_ASPECT_IGNORE; last_screen_size=Size2( OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height ); - root->set_rect(Rect2(Point2(),last_screen_size)); + root->set_size(last_screen_size); if (ScriptDebugger::get_singleton()) { ScriptDebugger::get_singleton()->set_request_scene_tree_message_func(_debugger_request_tree,this); -- cgit v1.2.3 From 53d8f2b1ec1d86b189800b7fe156c464fdf9e380 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 27 Oct 2016 11:50:26 -0300 Subject: PBR more or less working, still working on bringing gizmos back --- scene/main/scene_main_loop.cpp | 52 ++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 15 deletions(-) (limited to 'scene/main/scene_main_loop.cpp') diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index c1552a4167..cfc6753378 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -490,6 +490,8 @@ void SceneTree::input_event( const InputEvent& p_event ) { } + _call_idle_callbacks(); + } void SceneTree::init() { @@ -528,6 +530,7 @@ bool SceneTree::iteration(float p_time) { root_lock--; _flush_delete_queue(); + _call_idle_callbacks(); return _quit; } @@ -590,6 +593,8 @@ bool SceneTree::idle(float p_time){ E=N; } + _call_idle_callbacks(); + return _quit; } @@ -745,12 +750,12 @@ Ref SceneTree::get_debug_navigation_material() { if (navigation_material.is_valid()) return navigation_material; - Ref line_material = Ref( memnew( FixedMaterial )); + Ref line_material = Ref( memnew( FixedSpatialMaterial )); /* line_material->set_flag(Material::FLAG_UNSHADED, true); line_material->set_line_width(3.0); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_navigation_color());*/ + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true); + line_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,get_debug_navigation_color());*/ navigation_material=line_material; @@ -763,12 +768,12 @@ Ref SceneTree::get_debug_navigation_disabled_material(){ if (navigation_disabled_material.is_valid()) return navigation_disabled_material; - Ref line_material = Ref( memnew( FixedMaterial )); + Ref line_material = Ref( memnew( FixedSpatialMaterial )); /* line_material->set_flag(Material::FLAG_UNSHADED, true); line_material->set_line_width(3.0); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_navigation_disabled_color());*/ + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true); + line_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,get_debug_navigation_disabled_color());*/ navigation_disabled_material=line_material; @@ -781,12 +786,12 @@ Ref SceneTree::get_debug_collision_material() { return collision_material; - Ref line_material = Ref( memnew( FixedMaterial )); + Ref line_material = Ref( memnew( FixedSpatialMaterial )); /*line_material->set_flag(Material::FLAG_UNSHADED, true); line_material->set_line_width(3.0); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_collisions_color());*/ + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true); + line_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,get_debug_collisions_color());*/ collision_material=line_material; @@ -800,11 +805,11 @@ Ref SceneTree::get_debug_contact_mesh() { debug_contact_mesh = Ref( memnew( Mesh ) ); - Ref mat = memnew( FixedMaterial ); + Ref mat = memnew( FixedSpatialMaterial ); /*mat->set_flag(Material::FLAG_UNSHADED,true); mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); - mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); - mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_collision_contact_color());*/ + mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); + mat->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,get_debug_collision_contact_color());*/ Vector3 diamond[6]={ Vector3(-1, 0, 0), @@ -2259,6 +2264,23 @@ void SceneTree::_bind_methods() { SceneTree *SceneTree::singleton=NULL; + +SceneTree::IdleCallback SceneTree::idle_callbacks[SceneTree::MAX_IDLE_CALLBACKS]; +int SceneTree::idle_callback_count=0; + +void SceneTree::_call_idle_callbacks() { + + for(int i=0;i=MAX_IDLE_CALLBACKS); + idle_callbacks[idle_callback_count++]=p_callback; +} + + SceneTree::SceneTree() { singleton=this; -- cgit v1.2.3 From cacf9ebb7fd8df8845daca9da2fe55456cc179aa Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Wed, 9 Nov 2016 23:55:06 -0300 Subject: all light types and shadows are working, pending a lot of clean-up --- scene/main/scene_main_loop.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scene/main/scene_main_loop.cpp') diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index cfc6753378..ef619244d0 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -845,7 +845,7 @@ Ref SceneTree::get_debug_contact_mesh() { arr[Mesh::ARRAY_INDEX]=indices; - debug_contact_mesh->add_surface(Mesh::PRIMITIVE_TRIANGLES,arr); + debug_contact_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES,arr); debug_contact_mesh->surface_set_material(0,mat); return debug_contact_mesh; -- cgit v1.2.3 From c39d2b3f429639803f4f4fe80eda6935659e9c51 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 19 Nov 2016 13:23:37 -0300 Subject: working reflection probes!! --- scene/main/scene_main_loop.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'scene/main/scene_main_loop.cpp') diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index ef619244d0..abc4bf3fe2 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -2296,6 +2296,7 @@ SceneTree::SceneTree() { collision_debug_contacts=GLOBAL_DEF("debug/collision_max_contacts_displayed",10000); + tree_version=1; fixed_process_time=1; idle_process_time=1; @@ -2319,6 +2320,12 @@ SceneTree::SceneTree() { root->set_as_audio_listener_2d(true); current_scene=NULL; + int ref_atlas_size = GLOBAL_DEF("rendering/reflections/atlas_size",2048); + int ref_atlas_subdiv = GLOBAL_DEF("rendering/reflections/atlas_subdiv",8); + + VS::get_singleton()->scenario_set_reflection_atlas_size(root->get_world()->get_scenario(),ref_atlas_size,ref_atlas_subdiv); + + stretch_mode=STRETCH_MODE_DISABLED; stretch_aspect=STRETCH_ASPECT_IGNORE; -- cgit v1.2.3 From c7bc44d5ad9aae4902280012f7654e2318cd910e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 1 Jan 2017 22:01:57 +0100 Subject: Welcome in 2017, dear changelog reader! That year should bring the long-awaited OpenGL ES 3.0 compatible renderer with state-of-the-art rendering techniques tuned to work as low as middle end handheld devices - without compromising with the possibilities given for higher end desktop games of course. Great times ahead for the Godot community and the gamers that will play our games! --- scene/main/scene_main_loop.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scene/main/scene_main_loop.cpp') diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index e3472c074a..f0c1251e43 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ -- cgit v1.2.3 From c2a217c3501b8006a3d2cdf2c678e33def15f275 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 1 Jan 2017 22:16:52 -0300 Subject: WIP particle system Ability to enable and change MSAA settings Ability to change VCT quality Ability to enable/disable HDR rendering --- scene/main/scene_main_loop.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'scene/main/scene_main_loop.cpp') 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); -- cgit v1.2.3