Merge branch 'ground_effects_editor' into 'ground_effects_editor'

Add missing coordinates files

See merge request T1ti/noggit-red!6
This commit is contained in:
T1ti
2024-09-09 19:26:16 +00:00
2 changed files with 52 additions and 0 deletions

39
src/math/coordinates.cpp Normal file
View File

@@ -0,0 +1,39 @@
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
#include "coordinates.hpp"
#include <noggit/MapHeaders.h>
namespace math
{
void to_client(glm::vec3& vector)
{
float x = vector.x;
vector.x = -vector.y + ZEROPOINT;
vector.y = vector.z;
vector.z = -x + ZEROPOINT;
}
void to_client(float vector[3])
{
float x = vector[0];
vector[0] = -vector[1] + ZEROPOINT;
vector[1] = vector[2];
vector[2] = -x + ZEROPOINT;
}
void to_server(glm::vec3& vector)
{
float x = vector.x;
vector.x = ZEROPOINT - vector.z;
vector.z = vector.y;
vector.y = ZEROPOINT - x;
}
void to_server(float vector[3])
{
float x = vector[0];
vector[0] = ZEROPOINT - vector[2];
vector[2] = vector[1];
vector[1] = ZEROPOINT - x;
}
}

13
src/math/coordinates.hpp Normal file
View File

@@ -0,0 +1,13 @@
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
#pragma once
#include <glm/vec3.hpp>
namespace math
{
void to_client(glm::vec3& vector);
void to_client(float vector[3]);
void to_server(glm::vec3& vector);
void to_server(float vector[3]);
}