mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-23 20:09:46 +03:00
CMake: Refactor build system
This commit is contained in:
28
source/common/CMakeLists.txt
Normal file
28
source/common/CMakeLists.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
# Common (low-level?) stuff
|
||||
|
||||
add_library(reminecraftpe-common STATIC
|
||||
Random.cpp Random.hpp
|
||||
Utils.cpp Utils.hpp
|
||||
Mth.cpp Mth.hpp
|
||||
Timer.cpp Timer.hpp
|
||||
CThread.cpp CThread.hpp
|
||||
Util.cpp Util.hpp
|
||||
Logger.cpp Logger.hpp
|
||||
SmoothFloat.cpp SmoothFloat.hpp
|
||||
)
|
||||
|
||||
target_link_libraries(reminecraftpe-common PUBLIC
|
||||
reminecraftpe-network
|
||||
)
|
||||
#target_link_libraries(reminecraftpe-common PRIVATE
|
||||
# reminecraftpe-renderer
|
||||
#)
|
||||
|
||||
# zlib - Android builds with its own version
|
||||
# Hack - If we're not building for Android, surely we're building with SDL
|
||||
if (USE_SDL)
|
||||
add_subdirectory(../../thirdparty/zlib zlib)
|
||||
target_link_libraries(reminecraftpe-common PUBLIC zlib)
|
||||
elseif (NOT ANDROID)
|
||||
target_include_directories(reminecraftpe-common PRIVATE ../../thirdparty/zlib)
|
||||
endif()
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include "CThread.hpp"
|
||||
#include "common/Utils.hpp"
|
||||
#include "Utils.hpp"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/********************************************************************
|
||||
Minecraft: Pocket Edition - Decompilation Project
|
||||
Copyright (C) 2023 iProgramInCpp
|
||||
|
||||
The following code is licensed under the BSD 1 clause license.
|
||||
SPDX-License-Identifier: BSD-1-Clause
|
||||
********************************************************************/
|
||||
|
||||
#include "Matrix.hpp"
|
||||
|
||||
Matrix::Matrix()
|
||||
{
|
||||
c[0] = 0.0f;
|
||||
|
||||
memset(c, 0, sizeof c);
|
||||
}
|
||||
|
||||
Matrix::Matrix(float x)
|
||||
{
|
||||
memset(c, 0, sizeof c);
|
||||
c[0] = c[4 * 1 + 1] = c[4 * 2 + 2] = c[4 * 3 + 3] = x;
|
||||
}
|
||||
|
||||
Matrix::Matrix(float* p)
|
||||
{
|
||||
memcpy(c, p, sizeof c);
|
||||
}
|
||||
|
||||
Matrix::Matrix(float a, float b, float q, float d, float e, float f, float g, float h, float i, float j, float k, float l, float m, float n, float o, float p)
|
||||
{
|
||||
c[0] = a, c[1] = b, c[2] = q, c[3] = d, c[4] = e, c[5] = f, c[6] = g, c[7] = h, c[8] = i, c[9] = j, c[10] = k, c[11] = l, c[12] = m, c[13] = n, c[14] = o, c[15] = p;
|
||||
}
|
||||
|
||||
void Matrix::fetchGL(GLenum pname)
|
||||
{
|
||||
glGetFloatv(pname, c);
|
||||
}
|
||||
|
||||
Matrix operator*(const Matrix& a, const Matrix& b)
|
||||
{
|
||||
Matrix result;
|
||||
|
||||
//this is ugly
|
||||
result.c[0] = a.c[0] * b.c[0] + a.c[1] * b.c[4] + a.c[2] * b.c[8] + a.c[3] * b.c[12];
|
||||
result.c[1] = a.c[0] * b.c[1] + a.c[1] * b.c[5] + a.c[2] * b.c[9] + a.c[3] * b.c[13];
|
||||
result.c[2] = a.c[0] * b.c[2] + a.c[1] * b.c[6] + a.c[2] * b.c[10] + a.c[3] * b.c[14];
|
||||
result.c[3] = a.c[0] * b.c[3] + a.c[1] * b.c[7] + a.c[2] * b.c[11] + a.c[3] * b.c[15];
|
||||
result.c[4] = a.c[4] * b.c[0] + a.c[5] * b.c[4] + a.c[6] * b.c[8] + a.c[7] * b.c[12];
|
||||
result.c[5] = a.c[4] * b.c[1] + a.c[5] * b.c[5] + a.c[6] * b.c[9] + a.c[7] * b.c[13];
|
||||
result.c[6] = a.c[4] * b.c[2] + a.c[5] * b.c[6] + a.c[6] * b.c[10] + a.c[7] * b.c[14];
|
||||
result.c[7] = a.c[4] * b.c[3] + a.c[5] * b.c[7] + a.c[6] * b.c[11] + a.c[7] * b.c[15];
|
||||
result.c[8] = a.c[8] * b.c[0] + a.c[9] * b.c[4] + a.c[10] * b.c[8] + a.c[11] * b.c[12];
|
||||
result.c[9] = a.c[8] * b.c[1] + a.c[9] * b.c[5] + a.c[10] * b.c[9] + a.c[11] * b.c[13];
|
||||
result.c[10] = a.c[8] * b.c[2] + a.c[9] * b.c[6] + a.c[10] * b.c[10] + a.c[11] * b.c[14];
|
||||
result.c[11] = a.c[8] * b.c[3] + a.c[9] * b.c[7] + a.c[10] * b.c[11] + a.c[11] * b.c[15];
|
||||
result.c[12] = a.c[12] * b.c[0] + a.c[13] * b.c[4] + a.c[14] * b.c[8] + a.c[15] * b.c[12];
|
||||
result.c[13] = a.c[12] * b.c[1] + a.c[13] * b.c[5] + a.c[14] * b.c[9] + a.c[15] * b.c[13];
|
||||
result.c[14] = a.c[12] * b.c[2] + a.c[13] * b.c[6] + a.c[14] * b.c[10] + a.c[15] * b.c[14];
|
||||
result.c[15] = a.c[12] * b.c[3] + a.c[13] * b.c[7] + a.c[14] * b.c[11] + a.c[15] * b.c[15];
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/********************************************************************
|
||||
Minecraft: Pocket Edition - Decompilation Project
|
||||
Copyright (C) 2023 iProgramInCpp
|
||||
|
||||
The following code is licensed under the BSD 1 clause license.
|
||||
SPDX-License-Identifier: BSD-1-Clause
|
||||
********************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstring>
|
||||
#include "Mth.hpp"
|
||||
#include "thirdparty/GL/GL.hpp"
|
||||
|
||||
class Matrix
|
||||
{
|
||||
public:
|
||||
Matrix(); // create an empty matrix
|
||||
Matrix(float a); // create an identity matrix
|
||||
Matrix(float* p); // load matrix from memory
|
||||
Matrix(float a, float b, float c, float d, float e, float f, float g, float h, float i, float j, float k, float l, float m, float n, float o, float p);
|
||||
void fetchGL(GLenum pname);
|
||||
|
||||
friend Matrix operator*(const Matrix& a, const Matrix& b);
|
||||
|
||||
public:
|
||||
float c[16];
|
||||
};
|
||||
|
||||
Matrix operator*(const Matrix& a, const Matrix& b);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include "LongHack.hpp"
|
||||
#include "common/Utils.hpp"
|
||||
#include "Utils.hpp"
|
||||
|
||||
// This appears to be VERY similar to https://github.com/SethRobinson/proton/blob/master/shared/util/CRandom.h#L10
|
||||
// It turns out, RTsoft, Mojang, and the author of Game Coding Complete used the same reference implementation of
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
********************************************************************/
|
||||
|
||||
#include "Timer.hpp"
|
||||
#include "common/Utils.hpp"
|
||||
#include "Utils.hpp"
|
||||
|
||||
#if !defined(_WIN32) && defined(USE_ACCURATE_TIMER)
|
||||
#error "Implement getAccurateTimeMs() for your platform!"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
// note: not an official file name
|
||||
|
||||
#include "common/Utils.hpp"
|
||||
#include "Utils.hpp"
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
|
||||
|
||||
@@ -110,7 +110,6 @@ void closedir(DIR* dir);
|
||||
|
||||
#endif
|
||||
|
||||
#include "../../compat/KeyCodes.hpp"
|
||||
#include "Logger.hpp"
|
||||
|
||||
// options:
|
||||
|
||||
Reference in New Issue
Block a user