diff --git a/src/3d/debug_draw_3d.cpp b/src/3d/debug_draw_3d.cpp index 7affeaa1..4bfbeadd 100644 --- a/src/3d/debug_draw_3d.cpp +++ b/src/3d/debug_draw_3d.cpp @@ -1169,8 +1169,6 @@ void DebugDraw3D::draw_square(const Vector3 &position, const real_t &size, const ZoneScoped; CHECK_BEFORE_CALL(); - Transform3D t(Basis().scaled(VEC3_ONE(size)), position); - LOCK_GUARD(datalock); GET_SCOPED_CFG_AND_DGC(); @@ -1179,7 +1177,7 @@ void DebugDraw3D::draw_square(const Vector3 &position, const real_t &size, const InstanceType::BILLBOARD_SQUARE, duration, GET_PROC_TYPE(), - FIX_PRECISION_TRANSFORM(t), + Transform3D(Basis().scaled(VEC3_ONE(size)), FIX_PRECISION_POSITION(position)), IS_DEFAULT_COLOR(color) ? Colors::red : color, SphereBounds(position, MathUtils::CubeRadiusForSphere * size), &Colors::empty_color); diff --git a/src/resources/billboard_unshaded.gdshader b/src/resources/billboard_unshaded.gdshader index 63852999..0063b583 100644 --- a/src/resources/billboard_unshaded.gdshader +++ b/src/resources/billboard_unshaded.gdshader @@ -12,8 +12,6 @@ render_mode cull_back, shadows_disabled, unshaded ; #endif -uniform sampler2D depth_value : hint_depth_texture; - void vertex() { MODELVIEW_MATRIX = VIEW_MATRIX * mat4(INV_VIEW_MATRIX[0], INV_VIEW_MATRIX[1], INV_VIEW_MATRIX[2], MODEL_MATRIX[3]); diff --git a/src/utils/utils.h b/src/utils/utils.h index 6b21eb5f..5c740e3b 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -323,6 +323,7 @@ class Utils { }; #ifndef DISABLE_DEBUG_RENDERING +#ifndef WEB_ENABLED #include class GodotScopedStopwatch { @@ -338,13 +339,40 @@ class GodotScopedStopwatch { } ~GodotScopedStopwatch() { - using namespace std::chrono; if (m_add) - *m_time_val += static_cast(duration_cast(high_resolution_clock::now() - start_time).count()); + *m_time_val += static_cast(std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - start_time).count()); else - *m_time_val = static_cast(duration_cast(high_resolution_clock::now() - start_time).count()); + *m_time_val = static_cast(std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - start_time).count()); } }; +#else +// TODO delete when the minimum version is upgraded. +// cannot be deleted due to a mismatch in the Emscripten version. +// 4.2.3 or 4.3 +GODOT_WARNING_DISABLE() +#include +GODOT_WARNING_RESTORE() + +class GodotScopedStopwatch { + uint64_t start_time; + int64_t *m_time_val; + bool m_add; + +public: + GodotScopedStopwatch(int64_t *p_time_val, bool p_add) { + m_time_val = p_time_val; + m_add = p_add; + start_time = godot::Time::get_singleton()->get_ticks_usec(); + } + + ~GodotScopedStopwatch() { + if (m_add) + *m_time_val += godot::Time::get_singleton()->get_ticks_usec() - start_time; + else + *m_time_val = godot::Time::get_singleton()->get_ticks_usec() - start_time; + } +}; +#endif #define _GODOT_STOPWATCH_CONCAT_IMPL(name1, name2) name1##name2 #define _GODOT_STOPWATCH_CONCAT(name1, name2) _GODOT_STOPWATCH_CONCAT_IMPL(name1, name2) @@ -353,4 +381,4 @@ class GodotScopedStopwatch { #else #define GODOT_STOPWATCH(time_val) #define GODOT_STOPWATCH_ADD(time_val) -#endif \ No newline at end of file +#endif