From 39714d68a841dcf7a8dda79f3e877f1deae07c2f Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 10 Nov 2024 23:14:15 +0100 Subject: [PATCH] impl. normal vector rendering. working --- log/Debug.cpp | 13 +++++++++++++ log/TimingStat.h | 5 +++++ object/Vertex.h | 9 +++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/log/Debug.cpp b/log/Debug.cpp index 8623fd8..6cdf096 100644 --- a/log/Debug.cpp +++ b/log/Debug.cpp @@ -51,6 +51,19 @@ void update_timing_stat_end(uint32 stat, const char* function) debug_container->perf_stats[stat].old_tick_count = new_tick_count; } +inline +void update_timing_stat_end_continued(uint32 stat, const char* function) +{ + uint64 new_tick_count = __rdtsc(); + + debug_container->perf_stats[stat].function = function; + debug_container->perf_stats[stat].delta_tick = debug_container->perf_stats[stat].delta_tick + + new_tick_count - debug_container->perf_stats[stat].old_tick_count; + debug_container->perf_stats[stat].delta_time = debug_container->perf_stats[stat].delta_time + + (double) debug_container->perf_stats[stat].delta_tick / (double) debug_container->performance_count_frequency; + debug_container->perf_stats[stat].old_tick_count = new_tick_count; +} + inline void reset_counter(int32 id) { diff --git a/log/TimingStat.h b/log/TimingStat.h index 3026f3c..19f0a39 100644 --- a/log/TimingStat.h +++ b/log/TimingStat.h @@ -36,12 +36,17 @@ struct TimingStat { // These are only needed if we need to delay the overwrite by 1 frame (e.g. ui update) void update_timing_stat_start(uint32, const char*); void update_timing_stat_end(uint32, const char*); + void update_timing_stat_end_continued(uint32, const char*); #define UPDATE_TIMING_STAT_START(stat) update_timing_stat_start(stat, __func__) #define UPDATE_TIMING_STAT_END(stat) update_timing_stat_end(stat, __func__) + #define UPDATE_TIMING_STAT_CONTINUE(stat) update_timing_stat_start(stat, __func__) + #define UPDATE_TIMING_STAT_END_CONTINUED(stat) update_timing_stat_end(stat, __func__) #else #define UPDATE_TIMING_STAT(stat) ((void) 0) #define UPDATE_TIMING_STAT_START(stat) ((void) 0) #define UPDATE_TIMING_STAT_END(stat) ((void) 0) + #define UPDATE_TIMING_STAT_CONTINUE(stat) ((void) 0) + #define UPDATE_TIMING_STAT_END_CONTINUED(stat) ((void) 0) #endif #endif \ No newline at end of file diff --git a/object/Vertex.h b/object/Vertex.h index 4b4653a..5cf7cef 100644 --- a/object/Vertex.h +++ b/object/Vertex.h @@ -18,6 +18,11 @@ struct Vertex3D { v4_f32 color; }; +struct Vertex3DNormal { + v3_f32 position; + v3_f32 normal; +}; + struct Vertex3DTextureColor { v3_f32 position; v2_f32 tex_coord; @@ -27,12 +32,12 @@ struct Vertex3DTextureColor { struct Vertex3DTextureColorIndex { v3_f32 position; v2_f32 tex_coord; - uint32 color; + f32 color; }; struct Vertex3DColorIndex { v3_f32 position; - uint32 color; + f32 color; }; struct Vertex2D {