add flag to toggle tracy (disabled for now)

This commit is contained in:
2026-02-24 20:39:48 +01:00
parent d88b66c058
commit 349d614611
20 changed files with 153 additions and 24 deletions

View File

@ -1,11 +1,11 @@
#ifndef __CAMERA_HPP_
#define __CAMERA_HPP_
#include "config.hpp"
#include <raylib.h>
#include <raymath.h>
#include "config.hpp"
class OrbitCamera3D {
friend class Renderer;

View File

@ -4,6 +4,7 @@
#include <raylib.h>
// #define WEB // Disables multithreading
// #define TRACY // Enable tracy profiling support
// Window
constexpr int INITIAL_WIDTH = 800;

View File

@ -1,6 +1,7 @@
#ifndef __INPUT_HPP_
#define __INPUT_HPP_
#include "config.hpp"
#include "state.hpp"
class InputHandler {

View File

@ -1,6 +1,8 @@
#ifndef __OCTREE_HPP_
#define __OCTREE_HPP_
#include "config.hpp"
#include <raylib.h>
#include <raymath.h>
#include <vector>

View File

@ -1,6 +1,9 @@
#ifndef __PHYSICS_HPP_
#define __PHYSICS_HPP_
#include "config.hpp"
#include "octree.hpp"
#include <atomic>
#include <condition_variable>
#include <cstddef>
@ -9,17 +12,18 @@
#include <raylib.h>
#include <raymath.h>
#include <thread>
#include <tracy/Tracy.hpp>
#include <variant>
#include <vector>
#include "octree.hpp"
#ifndef WEB
#define BS_THREAD_POOL_NATIVE_EXTENSIONS
#include <BS_thread_pool.hpp>
#endif
#ifdef TRACY
#include <tracy/Tracy.hpp>
#endif
class Mass {
public:
Vector3 position;
@ -116,10 +120,18 @@ class ThreadedPhysics {
using Command = std::variant<AddMass, AddSpring, ClearGraph>;
struct PhysicsState {
#ifdef TRACY
TracyLockable(std::mutex, command_mtx);
#else
std::mutex command_mtx;
#endif
std::queue<Command> pending_commands;
#ifdef TRACY
TracyLockable(std::mutex, data_mtx);
#else
std::mutex data_mtx;
#endif
std::condition_variable_any data_ready_cnd;
std::condition_variable_any data_consumed_cnd;
unsigned int ups = 0;

View File

@ -1,11 +1,12 @@
#ifndef __PRESETS_HPP_
#define __PRESETS_HPP_
#include "config.hpp"
#include "puzzle.hpp"
#include <functional>
#include <vector>
#include "puzzle.hpp"
using StateGenerator = std::function<State(void)>;
inline auto state_simple_1r() -> State {

View File

@ -1,6 +1,8 @@
#ifndef __PUZZLE_HPP_
#define __PUZZLE_HPP_
#include "config.hpp"
#include <array>
#include <cstddef>
#include <format>

View File

@ -1,14 +1,14 @@
#ifndef __RENDERER_HPP_
#define __RENDERER_HPP_
#include <raylib.h>
#include <raymath.h>
#include "camera.hpp"
#include "config.hpp"
#include "input.hpp"
#include "state.hpp"
#include <raylib.h>
#include <raymath.h>
class Renderer {
private:
const StateManager &state;

View File

@ -1,6 +1,7 @@
#ifndef __STATE_HPP_
#define __STATE_HPP_
#include "config.hpp"
#include "physics.hpp"
#include "presets.hpp"
#include "puzzle.hpp"

View File

@ -1,6 +1,10 @@
#ifndef __TRACY_HPP_
#define __TRACY_HPP_
#include "config.hpp"
#ifdef TRACY
#include <cstddef>
void *operator new(std::size_t count);
@ -8,3 +12,5 @@ void operator delete(void *ptr) noexcept;
void operator delete(void *ptr, std::size_t count) noexcept;
#endif
#endif

View File

@ -1,6 +1,8 @@
#ifndef __UTIL_HPP_
#define __UTIL_HPP_
#include "config.hpp"
#include <iostream>
#include <raylib.h>
#include <raymath.h>