diff options
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/label_3d.h | 6 | ||||
-rw-r--r-- | scene/3d/navigation_region_3d.cpp | 11 | ||||
-rw-r--r-- | scene/3d/physics_body_3d.cpp | 5 | ||||
-rw-r--r-- | scene/3d/physics_body_3d.h | 1 | ||||
-rw-r--r-- | scene/3d/voxelizer.cpp | 10 |
5 files changed, 24 insertions, 9 deletions
diff --git a/scene/3d/label_3d.h b/scene/3d/label_3d.h index 4498e89517..d4bfe743a6 100644 --- a/scene/3d/label_3d.h +++ b/scene/3d/label_3d.h @@ -55,7 +55,7 @@ public: }; private: - real_t pixel_size = 0.01; + real_t pixel_size = 0.005; bool flags[FLAG_MAX] = {}; AlphaCutMode alpha_cut = ALPHA_CUT_DISABLED; float alpha_scissor_threshold = 0.5; @@ -109,7 +109,7 @@ private: TextServer::AutowrapMode autowrap_mode = TextServer::AUTOWRAP_OFF; float width = 500.0; - int font_size = 16; + int font_size = 32; Ref<Font> font_override; mutable Ref<Font> theme_font; Color modulate = Color(1, 1, 1, 1); @@ -117,7 +117,7 @@ private: int outline_render_priority = -1; int render_priority = 0; - int outline_size = 0; + int outline_size = 12; Color outline_modulate = Color(0, 0, 0, 1); float line_spacing = 0.f; diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp index 4150b01651..29ad1ba93d 100644 --- a/scene/3d/navigation_region_3d.cpp +++ b/scene/3d/navigation_region_3d.cpp @@ -363,6 +363,12 @@ NavigationRegion3D::~NavigationRegion3D() { #ifdef DEBUG_ENABLED void NavigationRegion3D::_update_debug_mesh() { + if (Engine::get_singleton()->is_editor_hint()) { + // don't update inside Editor as node 3d gizmo takes care of this + // as collisions and selections for Editor Viewport need to be updated + return; + } + if (!NavigationServer3D::get_singleton()->get_debug_enabled()) { if (debug_instance.is_valid()) { RS::get_singleton()->instance_set_visible(debug_instance, false); @@ -418,11 +424,14 @@ void NavigationRegion3D::_update_debug_mesh() { Ref<StandardMaterial3D> face_material = NavigationServer3D::get_singleton_mut()->get_debug_navigation_geometry_face_material(); Ref<StandardMaterial3D> line_material = NavigationServer3D::get_singleton_mut()->get_debug_navigation_geometry_edge_material(); + RandomPCG rand; Color polygon_color = debug_navigation_geometry_face_color; for (int i = 0; i < polygon_count; i++) { if (enabled_geometry_face_random_color) { - polygon_color = debug_navigation_geometry_face_color * (Color(Math::randf(), Math::randf(), Math::randf())); + // Generate the polygon color, slightly randomly modified from the settings one. + polygon_color.set_hsv(debug_navigation_geometry_face_color.get_h() + rand.random(-1.0, 1.0) * 0.1, debug_navigation_geometry_face_color.get_s(), debug_navigation_geometry_face_color.get_v() + rand.random(-1.0, 1.0) * 0.2); + polygon_color.a = debug_navigation_geometry_face_color.a; } Vector<int> polygon = navmesh->get_polygon(i); diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index 993608c306..cbdef02826 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -2057,6 +2057,10 @@ int KinematicCollision3D::get_collision_count() const { return result.collision_count; } +real_t KinematicCollision3D::get_depth() const { + return result.collision_depth; +} + Vector3 KinematicCollision3D::get_position(int p_collision_index) const { ERR_FAIL_INDEX_V(p_collision_index, result.collision_count, Vector3()); return result.collisions[p_collision_index].position; @@ -2127,6 +2131,7 @@ Vector3 KinematicCollision3D::get_collider_velocity(int p_collision_index) const void KinematicCollision3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_travel"), &KinematicCollision3D::get_travel); ClassDB::bind_method(D_METHOD("get_remainder"), &KinematicCollision3D::get_remainder); + ClassDB::bind_method(D_METHOD("get_depth"), &KinematicCollision3D::get_depth); ClassDB::bind_method(D_METHOD("get_collision_count"), &KinematicCollision3D::get_collision_count); ClassDB::bind_method(D_METHOD("get_position", "collision_index"), &KinematicCollision3D::get_position, DEFVAL(0)); ClassDB::bind_method(D_METHOD("get_normal", "collision_index"), &KinematicCollision3D::get_normal, DEFVAL(0)); diff --git a/scene/3d/physics_body_3d.h b/scene/3d/physics_body_3d.h index e4a41be6c0..b9baba4d96 100644 --- a/scene/3d/physics_body_3d.h +++ b/scene/3d/physics_body_3d.h @@ -504,6 +504,7 @@ public: Vector3 get_travel() const; Vector3 get_remainder() const; int get_collision_count() const; + real_t get_depth() const; Vector3 get_position(int p_collision_index = 0) const; Vector3 get_normal(int p_collision_index = 0) const; real_t get_angle(int p_collision_index = 0, const Vector3 &p_up_direction = Vector3(0.0, 1.0, 0.0)) const; diff --git a/scene/3d/voxelizer.cpp b/scene/3d/voxelizer.cpp index 42a2a68e2d..9380d1cf32 100644 --- a/scene/3d/voxelizer.cpp +++ b/scene/3d/voxelizer.cpp @@ -323,8 +323,8 @@ Vector<Color> Voxelizer::_get_bake_texture(Ref<Image> p_image, const Color &p_co } Voxelizer::MaterialCache Voxelizer::_get_material_cache(Ref<Material> p_material) { - //this way of obtaining materials is inaccurate and also does not support some compressed formats very well - Ref<StandardMaterial3D> mat = p_material; + // This way of obtaining materials is inaccurate and also does not support some compressed formats very well. + Ref<BaseMaterial3D> mat = p_material; Ref<Material> material = mat; //hack for now @@ -335,7 +335,7 @@ Voxelizer::MaterialCache Voxelizer::_get_material_cache(Ref<Material> p_material MaterialCache mc; if (mat.is_valid()) { - Ref<Texture2D> albedo_tex = mat->get_texture(StandardMaterial3D::TEXTURE_ALBEDO); + Ref<Texture2D> albedo_tex = mat->get_texture(BaseMaterial3D::TEXTURE_ALBEDO); Ref<Image> img_albedo; if (albedo_tex.is_valid()) { @@ -345,7 +345,7 @@ Voxelizer::MaterialCache Voxelizer::_get_material_cache(Ref<Material> p_material mc.albedo = _get_bake_texture(img_albedo, Color(1, 1, 1), mat->get_albedo()); // no albedo texture, color is additive } - Ref<Texture2D> emission_tex = mat->get_texture(StandardMaterial3D::TEXTURE_EMISSION); + Ref<Texture2D> emission_tex = mat->get_texture(BaseMaterial3D::TEXTURE_EMISSION); Color emission_col = mat->get_emission(); float emission_energy = mat->get_emission_energy(); @@ -356,7 +356,7 @@ Voxelizer::MaterialCache Voxelizer::_get_material_cache(Ref<Material> p_material img_emission = emission_tex->get_image(); } - if (mat->get_emission_operator() == StandardMaterial3D::EMISSION_OP_ADD) { + if (mat->get_emission_operator() == BaseMaterial3D::EMISSION_OP_ADD) { mc.emission = _get_bake_texture(img_emission, Color(1, 1, 1) * emission_energy, emission_col * emission_energy); } else { mc.emission = _get_bake_texture(img_emission, emission_col * emission_energy, Color(0, 0, 0)); |