update compiler flags, fix tracy allocation profiling, fix compiler warnings
This commit is contained in:
@ -26,7 +26,8 @@ private:
|
||||
|
||||
public:
|
||||
OrbitCamera3D()
|
||||
: camera({0}), position(Vector3Zero()), target(Vector3Zero()),
|
||||
: camera(Camera(Vector3Zero(), Vector3Zero(), Vector3Zero(), 0.0, 0)),
|
||||
position(Vector3Zero()), target(Vector3Zero()),
|
||||
distance(CAMERA_DISTANCE), angle_x(0.0), angle_y(0.0),
|
||||
last_mouse(Vector2Zero()), rotating(false), panning(false),
|
||||
target_lock(true) {
|
||||
|
||||
@ -19,8 +19,8 @@ public:
|
||||
int block_add_y;
|
||||
|
||||
public:
|
||||
InputHandler(StateManager &state, Renderer &renderer)
|
||||
: state(state), renderer(renderer), hov_x(-1), hov_y(-1), sel_x(0),
|
||||
InputHandler(StateManager &_state, Renderer &_renderer)
|
||||
: state(_state), renderer(_renderer), hov_x(-1), hov_y(-1), sel_x(0),
|
||||
sel_y(0), has_block_add_xy(false), block_add_x(-1), block_add_y(-1) {}
|
||||
|
||||
InputHandler(const InputHandler ©) = delete;
|
||||
|
||||
@ -27,9 +27,9 @@ public:
|
||||
const bool fixed;
|
||||
|
||||
public:
|
||||
Mass(float mass, Vector3 position, bool fixed)
|
||||
: mass(mass), position(position), previous_position(position),
|
||||
velocity(Vector3Zero()), force(Vector3Zero()), fixed(fixed) {}
|
||||
Mass(float _mass, Vector3 _position, bool _fixed)
|
||||
: mass(_mass), position(_position), previous_position(_position),
|
||||
velocity(Vector3Zero()), force(Vector3Zero()), fixed(_fixed) {}
|
||||
|
||||
public:
|
||||
auto ClearForce() -> void;
|
||||
@ -50,10 +50,10 @@ public:
|
||||
const float rest_length;
|
||||
|
||||
public:
|
||||
Spring(Mass &massA, Mass &massB, float spring_constant,
|
||||
float dampening_constant, float rest_length)
|
||||
: massA(massA), massB(massB), spring_constant(spring_constant),
|
||||
dampening_constant(dampening_constant), rest_length(rest_length) {}
|
||||
Spring(Mass &_massA, Mass &_massB, float _spring_constant,
|
||||
float _dampening_constant, float _rest_length)
|
||||
: massA(_massA), massB(_massB), spring_constant(_spring_constant),
|
||||
dampening_constant(_dampening_constant), rest_length(_rest_length) {}
|
||||
|
||||
public:
|
||||
auto CalculateSpringForce() const -> void;
|
||||
|
||||
@ -31,15 +31,15 @@ public:
|
||||
bool target;
|
||||
|
||||
public:
|
||||
Block(int x, int y, int width, int height, bool target)
|
||||
: x(x), y(y), width(width), height(height), target(target) {
|
||||
if (x < 0 || x + width >= 10 || y < 0 || y + height >= 10) {
|
||||
Block(int _x, int _y, int _width, int _height, bool _target)
|
||||
: x(_x), y(_y), width(_width), height(_height), target(_target) {
|
||||
if (_x < 0 || _x + _width >= 10 || _y < 0 || _y + _height >= 10) {
|
||||
std::cerr << "Block must fit on a 9x9 board!" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Block(int x, int y, std::string block) : x(x), y(y) {
|
||||
Block(int _x, int _y, std::string block) : x(_x), y(_y) {
|
||||
if (block == "..") {
|
||||
this->x = 0;
|
||||
this->y = 0;
|
||||
@ -68,7 +68,7 @@ public:
|
||||
height = std::stoi(block.substr(1, 1));
|
||||
}
|
||||
|
||||
if (x < 0 || x + width >= 10 || y < 0 || y + height >= 10) {
|
||||
if (_x < 0 || _x + width >= 10 || _y < 0 || _y + height >= 10) {
|
||||
std::cerr << "Block must fit on a 9x9 board!" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
@ -125,10 +125,10 @@ public:
|
||||
int current_pos;
|
||||
|
||||
public:
|
||||
BlockIterator(const State &state) : state(state), current_pos(0) {}
|
||||
BlockIterator(const State &_state) : state(_state), current_pos(0) {}
|
||||
|
||||
BlockIterator(const State &state, int current_pos)
|
||||
: state(state), current_pos(current_pos) {}
|
||||
BlockIterator(const State &_state, int _current_pos)
|
||||
: state(_state), current_pos(_current_pos) {}
|
||||
|
||||
Block operator*() const {
|
||||
return Block(current_pos % state.width, current_pos / state.width,
|
||||
@ -150,25 +150,25 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
State(int width, int height, bool restricted)
|
||||
: width(width), height(height), restricted(restricted),
|
||||
state(std::format("{}{}x{}:{}", restricted ? "R" : "F", width, height,
|
||||
std::string(width * height * 2, '.'))) {
|
||||
if (width <= 0 || width >= 10 || height <= 0 || height >= 10) {
|
||||
State(int _width, int _height, bool _restricted)
|
||||
: width(_width), height(_height), restricted(_restricted),
|
||||
state(std::format("{}{}x{}:{}", _restricted ? "R" : "F", _width,
|
||||
_height, std::string(_width * _height * 2, '.'))) {
|
||||
if (_width <= 0 || _width >= 10 || _height <= 0 || _height >= 10) {
|
||||
std::cerr << "State width/height must be in [1, 9]!" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
explicit State(std::string state)
|
||||
: width(std::stoi(state.substr(1, 1))),
|
||||
height(std::stoi(state.substr(3, 1))),
|
||||
restricted(state.substr(0, 1) == "R"), state(state) {
|
||||
explicit State(std::string _state)
|
||||
: width(std::stoi(_state.substr(1, 1))),
|
||||
height(std::stoi(_state.substr(3, 1))),
|
||||
restricted(_state.substr(0, 1) == "R"), state(_state) {
|
||||
if (width <= 0 || width >= 10 || height <= 0 || height >= 10) {
|
||||
std::cerr << "State width/height must be in [1, 9]!" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
if (state.length() != width * height * 2 + 5) {
|
||||
if (static_cast<int>(_state.length()) != width * height * 2 + 5) {
|
||||
std::cerr
|
||||
<< "State representation must have length [width * height * 2 + 5]!"
|
||||
<< std::endl;
|
||||
|
||||
@ -19,7 +19,7 @@ private:
|
||||
|
||||
// Instancing
|
||||
Material vertex_mat;
|
||||
int transforms_size;
|
||||
std::size_t transforms_size;
|
||||
Matrix *transforms;
|
||||
Mesh cube_instance;
|
||||
Shader instancing_shader;
|
||||
@ -29,9 +29,9 @@ public:
|
||||
bool connect_solutions;
|
||||
|
||||
public:
|
||||
Renderer(const OrbitCamera3D &camera)
|
||||
: camera(camera), mark_solutions(false), connect_solutions(false),
|
||||
transforms_size(0), transforms(nullptr) {
|
||||
Renderer(const OrbitCamera3D &_camera)
|
||||
: camera(_camera), transforms_size(0), transforms(nullptr),
|
||||
mark_solutions(false), connect_solutions(false) {
|
||||
render_target = LoadRenderTexture(GetScreenWidth() / 2.0,
|
||||
GetScreenHeight() - MENU_HEIGHT);
|
||||
klotski_target = LoadRenderTexture(GetScreenWidth() / 2.0,
|
||||
|
||||
@ -13,6 +13,7 @@ public:
|
||||
MassSpringSystem &mass_springs;
|
||||
|
||||
int current_preset;
|
||||
State starting_state;
|
||||
State current_state;
|
||||
State previous_state;
|
||||
|
||||
@ -22,10 +23,11 @@ public:
|
||||
std::unordered_set<State> visited_states;
|
||||
|
||||
public:
|
||||
StateManager(MassSpringSystem &mass_springs)
|
||||
: mass_springs(mass_springs), current_preset(0),
|
||||
current_state(generators[current_preset]()),
|
||||
previous_state(current_state), edited(false) {
|
||||
StateManager(MassSpringSystem &_mass_springs)
|
||||
: mass_springs(_mass_springs), current_preset(0),
|
||||
starting_state(generators[current_preset]()),
|
||||
current_state(starting_state), previous_state(starting_state),
|
||||
edited(false) {
|
||||
mass_springs.AddMass(MASS, false, current_state);
|
||||
}
|
||||
|
||||
|
||||
10
include/tracy.hpp
Normal file
10
include/tracy.hpp
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef __TRACY_HPP_
|
||||
#define __TRACY_HPP_
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
void *operator new(std::size_t count);
|
||||
void operator delete(void *ptr) noexcept;
|
||||
void operator delete(void *ptr, std::size_t count) noexcept;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user