Merge remote-tracking branch 'origin/master'
# Conflicts: # src/game/Client.cppmaster
commit
7cbbd6fed2
|
@ -1,5 +1,5 @@
|
|||
cmake_minimum_required (VERSION 3.12 FATAL_ERROR)
|
||||
set (CMAKE_CXX_STANDARD 14)
|
||||
set (CMAKE_CXX_STANDARD 17)
|
||||
|
||||
set (PROJECT_NAME "Zepha")
|
||||
set (MAIN_EXEC_NAME "Zepha")
|
||||
|
@ -7,32 +7,70 @@ set (TEST_EXEC_NAME "ZephaTest")
|
|||
|
||||
project (${PROJECT_NAME})
|
||||
|
||||
find_path(GLEW_HEADERS GL/glew.h)
|
||||
find_path(GLFW_HEADERS GLFW/glfw3.h)
|
||||
find_path(LUA_HEADERS lua.hpp
|
||||
/usr/include/lua5.1
|
||||
/usr/local/include/lua5.1)
|
||||
find_path(ASSIMP_HEADERS assimp/Importer.hpp)
|
||||
find_path(ENET_HEADERS enet/enet.h)
|
||||
find_path(NOISE_HEADERS noise/noise.h)
|
||||
find_path(GLM_HEADERS glm/glm.hpp)
|
||||
find_path(PTHREAD_HEADERS pthread.h)
|
||||
|
||||
find_library(LUA_LIB NAMES lua lua5.1 PATHS
|
||||
/usr/lib/x86_64-linux-gnu
|
||||
/usr/lib
|
||||
/usr/local/lib)
|
||||
|
||||
if (WIN32)
|
||||
find_library(ASSIMP_LIB assimp-vc142-mt)
|
||||
else()
|
||||
find_library(ASSIMP_LIB assimp)
|
||||
endif()
|
||||
|
||||
find_library(ENET_LIB enet)
|
||||
find_library(NOISE_LIB NAMES libnoise noise noise-static)
|
||||
|
||||
if (WIN32)
|
||||
find_library(PTHREAD_LIB pthreadVC3)
|
||||
else()
|
||||
find_library(PTHREAD_LIB pthread)
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
# Include Header Only Libraries
|
||||
lib/header/catch2/include # Catch2 unit testing library.
|
||||
lib/header/gzip/include # GZip Compression header library.
|
||||
lib/header/glm/include # OpenGL Mathematics Library.
|
||||
${GLM_HEADERS} # OpenGL Mathematics Library.
|
||||
lib/header/sol2/include # Sol2 Lua Parser library.
|
||||
lib/header/cute_files/include # Cute file traversal header library.
|
||||
lib/header/stb_image/include # STB Image processor header library.
|
||||
lib/header/json/include # JSON header library.
|
||||
|
||||
# Include Static Library Headers
|
||||
lib/static/glew/include # GLEW headers.
|
||||
lib/static/glfw/include # GLFW headers.
|
||||
lib/static/assimp/include # Assimp headers.
|
||||
lib/static/lua/install/include # Lua headers.
|
||||
lib/static/enet/include # ENet headers.
|
||||
lib/static/noise/include # Noise headers.
|
||||
${GLEW_HEADERS}
|
||||
${LUA_HEADERS}
|
||||
${ASSIMP_HEADERS}
|
||||
${ENET_HEADERS}
|
||||
${NOISE_HEADERS}
|
||||
${PTHREAD_HEADERS}
|
||||
)
|
||||
|
||||
|
||||
add_subdirectory (src)
|
||||
add_executable (${MAIN_EXEC_NAME} src/Main.cpp)
|
||||
target_link_libraries (${MAIN_EXEC_NAME} Zepha_Core)
|
||||
|
||||
target_include_directories(${MAIN_EXEC_NAME} PRIVATE ${GLFW_HEADERS})
|
||||
# Load Libraries
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/LoadLibs.cmake)
|
||||
|
||||
# Fix Win32 networking
|
||||
if(WIN32)
|
||||
target_link_libraries(${MAIN_EXEC_NAME} winmm ws2_32)
|
||||
endif()
|
||||
|
||||
# Enable Safeties
|
||||
target_compile_definitions(${MAIN_EXEC_NAME} PUBLIC SOL_ALL_SAFETIES_ON)
|
||||
|
||||
|
|
|
@ -1,18 +1,32 @@
|
|||
# Enet
|
||||
target_link_libraries(${MAIN_EXEC_NAME} ${ENET_LIB})
|
||||
|
||||
# Find and Link OpenGL
|
||||
find_package (OpenGL REQUIRED)
|
||||
target_link_libraries(${MAIN_EXEC_NAME} ${OPENGL_gl_LIBRARY})
|
||||
|
||||
# Build and Link GLFW
|
||||
set (GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
|
||||
set (GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set (GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
# Build GLFW
|
||||
if (WIN32)
|
||||
find_library(GLFW_LIB glfw3dll)
|
||||
else()
|
||||
set (GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
|
||||
set (GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set (GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
|
||||
add_subdirectory (lib/static/glfw)
|
||||
target_link_libraries (${MAIN_EXEC_NAME} glfw)
|
||||
include_directories(lib/static/glfw/src)
|
||||
add_subdirectory (lib/static/glfw)
|
||||
target_link_libraries (${MAIN_EXEC_NAME} glfw)
|
||||
include_directories(lib/static/glfw/src)
|
||||
endif()
|
||||
|
||||
# Link GLFW
|
||||
if (WIN32)
|
||||
find_library(GLEW_LIB glew32)
|
||||
else()
|
||||
set(GLEW_LIB ${CMAKE_SOURCE_DIR}/lib/static/glew/libGLEW.a)
|
||||
endif()
|
||||
|
||||
# Link Glew
|
||||
target_link_libraries(${MAIN_EXEC_NAME} ${CMAKE_SOURCE_DIR}/lib/static/glew/libGLEW.a)
|
||||
target_link_libraries(${MAIN_EXEC_NAME} ${GLEW_LIB})
|
||||
|
||||
# Build and Link Assimp
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
|
@ -24,21 +38,17 @@ set(ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT OFF)
|
|||
set(ASSIMP_BUILD_B3D_IMPORTER ON)
|
||||
set(ASSIMP_BUILD_X3D_IMPORTER ON) # Doesn't compile if not defined
|
||||
|
||||
add_subdirectory(lib/static/assimp)
|
||||
target_compile_options(assimp PRIVATE -w)
|
||||
# add_subdirectory(lib/static/assimp)
|
||||
target_link_libraries(${MAIN_EXEC_NAME} assimp)
|
||||
|
||||
# Link Lua 5.3.5
|
||||
target_link_libraries(${MAIN_EXEC_NAME} ${CMAKE_SOURCE_DIR}/lib/static/lua/install/lib/liblua.a)
|
||||
|
||||
# Enet
|
||||
target_link_libraries(${MAIN_EXEC_NAME} ${CMAKE_SOURCE_DIR}/lib/static/enet/.libs/libenet.a)
|
||||
target_link_libraries(${MAIN_EXEC_NAME} ${LUA_LIB})
|
||||
|
||||
# Link Noise
|
||||
target_link_libraries(${MAIN_EXEC_NAME} ${CMAKE_SOURCE_DIR}/lib/static/noise/build/src/libnoise.a)
|
||||
target_link_libraries(${MAIN_EXEC_NAME} ${NOISE_LIB})
|
||||
|
||||
# Link PThread Dynamically
|
||||
target_link_libraries (${MAIN_EXEC_NAME} pthread)
|
||||
target_link_libraries (${MAIN_EXEC_NAME} ${PTHREAD_LIB})
|
||||
|
||||
# Link Z Dynamically
|
||||
target_link_libraries (${MAIN_EXEC_NAME} z)
|
|
@ -0,0 +1,89 @@
|
|||
# Idiot's Guide to building Zepha on Windows:
|
||||
|
||||
## ~~Your Amazon Wish List~~ Prequesites:
|
||||
### Step 0:
|
||||
Download the GitHub .zip, or `git clone` [Zepha](https://github.com/Aurailus/Zepha/)
|
||||
### Step 1:
|
||||
Install [Visual Studio Community](https://visualstudio.microsoft.com/vs/community/) (Clang and GCC not supported!)
|
||||
### Step 2:
|
||||
Install [CMake](https://cmake.org/download/)
|
||||
### Step 3:
|
||||
Install [VCPKG](https://github.com/microsoft/vcpkg), (like to your desktop, as it's just a folder)
|
||||
|
||||
### Step 4:
|
||||
Install VCPKG dependancies:
|
||||
In powershell, in the `vcpkg` folder, execute:
|
||||
`.\vcpkg install gzip glm stb-image glew glfw assimp libnoise enet lua pthread --triplet x64-windows`
|
||||
|
||||
## ~~Hiring Cowboy Builders~~ The Pre-Building Process:
|
||||
Load up CMake, and find the downloaded `Zepha` repo, and create another folder called `Zepha_build`.
|
||||
With CMake, click `Browse Source`, select the `Zepha` folder as mentioned earlier as this contains the information to correctly build the game. With that step done, click `Browse Build`, and select the folder `Zepha_build`. With these folders correctly chosen, click configure, which should bring up a wizard like window.
|
||||
|
||||
Once in the window for configuring the build, set `optional platform for generator` to `x64` under the dropdown menu. After that, select the radio button `Specify toolchain for crosscompiling`, which will allow you to select the `vcpkg` libraries and header files required by `Zepha`. With that out of the way, click `next`.
|
||||
|
||||
Navigate to the toolchain file which is located in the `vcpkg` folder, which is found here: `\where you installed\vcpkg\scripts\buildsystems\vcpkg.cmake` with the toolchain file completed, click `Finish`
|
||||
|
||||
## ~~Triforce of Compiling???~~ Fixing The Linker:
|
||||
Here's the tricky part, as the linker for the `Zepha` project in Visual Studio Community has a few issues with how ~~the idiot who did the CMakeLists~~ CMake's `find_path()` and `find_library()` misbehave with VCPKG. Because of this, the linker will stop compiling even if Zepha's `.cpp` and `.h` files compile successfully. In otherwords, you need to right click the `Zepha` Project. Click the `Properties` option in the right click list. Under the `Linker` options, expand the options with the arrow, and go to the `Input` submenu.
|
||||
|
||||
These next instructions are build type specific, `Debug` builds work with the VS Community debugger, while the release build does not. Click the `Additional Dependancies` dropdown arrow, then hit `<Edit>` Delete all the included libraries, and use the following:
|
||||
|
||||
Keep in mind, `\vcpkg\` refers to where you installed it.
|
||||
|
||||
### Building For Debug (With Debug Symbols):
|
||||
|
||||
```
|
||||
src\Debug\Zepha_Core.lib
|
||||
\vcpkg\installed\x64-windows\debug\lib\enet.lib
|
||||
\vcpkg\installed\x64-windows\debug\lib\glfw3dll.lib
|
||||
\vcpkg\installed\x64-windows\debug\lib\glew32d.lib
|
||||
\vcpkg\installed\x64-windows\debug\lib\assimp-vc142-mtd.lib
|
||||
\vcpkg\installed\x64-windows\debug\lib\lua.lib
|
||||
\vcpkg\installed\x64-windows\debug\lib\pthreadVC3d.lib
|
||||
\vcpkg\installed\x64-windows\debug\lib\z.lib
|
||||
\vcpkg\installed\x64-windows\debug\bin\noise.lib
|
||||
opengl32.lib
|
||||
kernel32.lib
|
||||
user32.lib
|
||||
gdi32.lib
|
||||
winspool.lib
|
||||
shell32.lib
|
||||
ole32.lib
|
||||
oleaut32.lib
|
||||
uuid.lib
|
||||
comdlg32.lib
|
||||
advapi32.lib
|
||||
ws2_32.lib
|
||||
winmm.lib
|
||||
```
|
||||
|
||||
### Building For Release ~~(To Flex On People)~~:
|
||||
|
||||
```
|
||||
src\Release\Zepha_Core.lib
|
||||
\vcpkg\installed\x64-windows\lib\enet.lib
|
||||
\vcpkg\installed\x64-windows\lib\glfw3dll.lib
|
||||
\vcpkg\installed\x64-windows\lib\glew32.lib
|
||||
\vcpkg\installed\x64-windows\lib\assimp-vc142-mt.lib
|
||||
\vcpkg\installed\x64-windows\lib\lua.lib
|
||||
\vcpkg\installed\x64-windows\lib\pthreadVC3.lib
|
||||
\vcpkg\installed\x64-windows\lib\z.lib
|
||||
\vcpkg\installed\x64-windows\bin\noise.lib
|
||||
opengl32.lib
|
||||
kernel32.lib
|
||||
user32.lib
|
||||
gdi32.lib
|
||||
winspool.lib
|
||||
shell32.lib
|
||||
ole32.lib
|
||||
oleaut32.lib
|
||||
uuid.lib
|
||||
comdlg32.lib
|
||||
advapi32.lib
|
||||
ws2_32.lib
|
||||
winmm.lib
|
||||
```
|
||||
|
||||
## ~~Rocket Science~~ Launching Zepha:
|
||||
|
||||
With either build type completed, head into `Zepha_build\[Debug or Release]\` you should notice a freshly built copy of Zepha. For obvious reasons, head into the `Zepha` directory and copy both `assets` and `mods` to the same folder as the Release or Debug executable. By double clicking Zepha.exe, it'll try connecting to the localhost server, so to make the game *start* you'll need a PowerShell window. In Windows 10, this is accomplished by `shift + right clicking` inside the same folder as `Zepha.exe`. Inside the PowerShell window, type `.\Zepha --mode=server`. With the server running, start `Zepha.exe` as you would normally. The game should connect to the localhost server and begin playing the game.
|
|
@ -131,7 +131,12 @@ void cf_do_unit_tests();
|
|||
#if !defined _CRT_SECURE_NO_WARNINGS
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define NOMINMAX
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
struct cf_file_t
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,7 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <c++/5/string>
|
||||
#include <string>
|
||||
|
||||
class ItemDef {
|
||||
public:
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include <glm/vec3.hpp>
|
||||
#include "../../util/TransPos.h"
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
struct MapGenJob {
|
||||
|
||||
std::array<uint, 4096> blocks;
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include <vector>
|
||||
#include "MeshPart.h"
|
||||
#include "../../util/Dir.h"
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
|
||||
struct BlockModel {
|
||||
std::array<std::vector<MeshPart>, 7> parts;
|
||||
|
@ -32,7 +34,7 @@ struct BlockModel {
|
|||
{glm::vec3{0, 1, 1}, glm::vec3{}, glm::vec2{1, 0}, glm::vec2{}},
|
||||
{glm::vec3{0, 1, 0}, glm::vec3{}, glm::vec2{0, 0}, glm::vec2{}}};
|
||||
indices = {0, 1, 2, 2, 3, 0};
|
||||
MeshPart leftMeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[std::min(static_cast<int>(textureRefs.size() - 1), 2)]);
|
||||
MeshPart leftMeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[(std::min)(static_cast<int>(textureRefs.size() - 1), 2)]);
|
||||
blockModel.parts[static_cast<int>(Dir::LEFT)].push_back(leftMeshPart);
|
||||
|
||||
//Right Face
|
||||
|
@ -42,7 +44,7 @@ struct BlockModel {
|
|||
{glm::vec3{1, 0, 0}, glm::vec3{}, glm::vec2{0, 1}, glm::vec2{}},
|
||||
{glm::vec3{1, 1, 0}, glm::vec3{}, glm::vec2{0, 0}, glm::vec2{}}};
|
||||
indices = {0, 1, 2, 2, 3, 0};
|
||||
MeshPart rightMeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[std::min(static_cast<int>(textureRefs.size() - 1), 3)]);
|
||||
MeshPart rightMeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[(std::min)(static_cast<int>(textureRefs.size() - 1), 3)]);
|
||||
blockModel.parts[static_cast<int>(Dir::RIGHT)].push_back(rightMeshPart);
|
||||
|
||||
//Top Face
|
||||
|
@ -52,7 +54,7 @@ struct BlockModel {
|
|||
{glm::vec3{1, 1, 1}, glm::vec3{}, glm::vec2{1, 1}, glm::vec2{}},
|
||||
{glm::vec3{1, 1, 0}, glm::vec3{}, glm::vec2{1, 0}, glm::vec2{}}};
|
||||
indices = {0, 1, 2, 2, 3, 0};
|
||||
MeshPart topMeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[std::min(static_cast<int>(textureRefs.size() - 1), 0)]);
|
||||
MeshPart topMeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[(std::min)(static_cast<int>(textureRefs.size() - 1), 0)]);
|
||||
blockModel.parts[static_cast<int>(Dir::TOP)].push_back(topMeshPart);
|
||||
|
||||
//Bottom Face
|
||||
|
@ -62,7 +64,7 @@ struct BlockModel {
|
|||
{glm::vec3{1, 0, 1}, glm::vec3{}, glm::vec2{1, 1}, glm::vec2{}},
|
||||
{glm::vec3{0, 0, 1}, glm::vec3{}, glm::vec2{0, 1}, glm::vec2{}}};
|
||||
indices = {0, 1, 2, 2, 3, 0};
|
||||
MeshPart bottomMeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[std::min(static_cast<int>(textureRefs.size() - 1), 1)]);
|
||||
MeshPart bottomMeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[(std::min)(static_cast<int>(textureRefs.size() - 1), 1)]);
|
||||
blockModel.parts[static_cast<int>(Dir::BOTTOM)].push_back(bottomMeshPart);
|
||||
|
||||
//Front Face
|
||||
|
@ -72,7 +74,7 @@ struct BlockModel {
|
|||
{glm::vec3{1, 1, 1}, glm::vec3{}, glm::vec2{1, 0}, glm::vec2{}},
|
||||
{glm::vec3{0, 1, 1}, glm::vec3{}, glm::vec2{0, 0}, glm::vec2{}}};
|
||||
indices = {0, 1, 2, 2, 3, 0};
|
||||
MeshPart frontMeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[std::min(static_cast<int>(textureRefs.size() - 1), 4)]);
|
||||
MeshPart frontMeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[(std::min)(static_cast<int>(textureRefs.size() - 1), 4)]);
|
||||
blockModel.parts[static_cast<int>(Dir::FRONT)].push_back(frontMeshPart);
|
||||
|
||||
//Back Face
|
||||
|
@ -82,7 +84,7 @@ struct BlockModel {
|
|||
{glm::vec3{1, 1, 0}, glm::vec3{}, glm::vec2{1, 0}, glm::vec2{}},
|
||||
{glm::vec3{1, 0, 0}, glm::vec3{}, glm::vec2{1, 1}, glm::vec2{}}};
|
||||
indices = {0, 1, 2, 2, 3, 0};
|
||||
MeshPart backMeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[std::min(static_cast<int>(textureRefs.size() - 1), 5)]);
|
||||
MeshPart backMeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[(std::min)(static_cast<int>(textureRefs.size() - 1), 5)]);
|
||||
blockModel.parts[static_cast<int>(Dir::BACK)].push_back(backMeshPart);
|
||||
|
||||
return blockModel;
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include <stb_image/stb_image.h>
|
||||
#include <stb_image/stb_image_write.h>
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
//Height is optional and defaults to 0
|
||||
TextureAtlas::TextureAtlas(unsigned int width, unsigned int height) :
|
||||
pageWidth(width),
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
//
|
||||
|
||||
#include "AnimationState.h"
|
||||
typedef unsigned int uint;
|
||||
|
||||
AnimationState::AnimationState(Model &source) {
|
||||
const ModelAnimation& animation = source.getAnimation();
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
//
|
||||
|
||||
#include "Model.h"
|
||||
typedef unsigned int uint;
|
||||
|
||||
void Model::fromMesh(uptr<EntityMesh> mesh) {
|
||||
meshes.clear();
|
||||
|
@ -235,7 +236,7 @@ void Model::calcBoneTransformation(double animTime, ModelBone& bone, glm::mat4 p
|
|||
|
||||
aiQuaternion rotation;
|
||||
calcInterpolatedRotation(rotation, animTime, bone, *channel, bounds);
|
||||
glm::mat4 rotationMat = glm::transpose(MatConv::AiToGLMMat3(rotation.GetMatrix()));
|
||||
glm::mat4 rotationMat = glm::transpose(glm::mat4(MatConv::AiToGLMMat3(rotation.GetMatrix())));
|
||||
|
||||
glm::vec3 position;
|
||||
calcInterpolatedPosition(position, animTime, bone, *channel, bounds);
|
||||
|
@ -287,7 +288,7 @@ void Model::calcInterpolatedRotation(aiQuaternion &rotation, double animTime, Mo
|
|||
const aiQuaternion& startRotation = channel.rotationKeys[index].second;
|
||||
const aiQuaternion& endRotation = channel.rotationKeys[nextIndex].second;
|
||||
|
||||
aiQuaternion::Interpolate(rotation, startRotation, endRotation, static_cast<ai_real>(factor));
|
||||
aiQuaternion::Interpolate(rotation, startRotation, endRotation, factor);
|
||||
rotation = rotation.Normalize();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/ext.hpp>
|
||||
#include "ModelBone.h"
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
#include "AnimChannel.h"
|
||||
typedef unsigned int uint;
|
||||
|
||||
class ModelAnimation {
|
||||
public:
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include <cmath>
|
||||
|
||||
//
|
||||
// Created by aurailus on 15/05/19.
|
||||
//
|
||||
|
||||
#include <cmath>
|
||||
#include <random>
|
||||
#include "ParticleEntity.h"
|
||||
|
||||
ParticleEntity::ParticleEntity(glm::vec3 pos, BlockDef &block) {
|
||||
|
@ -41,7 +41,7 @@ ParticleEntity::ParticleEntity(glm::vec3 pos, BlockDef &block) {
|
|||
0, 2, 1, 2, 0, 3,
|
||||
};
|
||||
|
||||
auto dir = glm::radians(static_cast<float>(random() % 360));
|
||||
auto dir = glm::radians(static_cast<float>(rand() % 360));
|
||||
float xDir = sinf(dir);
|
||||
float zDir = cosf(dir);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include "../Entity.h"
|
||||
#include "../../../def/item/BlockDef.h"
|
||||
|
||||
|
|
|
@ -53,20 +53,20 @@ void WireframeEntity::buildMesh(const std::vector<SelectionBox>& boxes) {
|
|||
}
|
||||
|
||||
void WireframeEntity::createBox(glm::vec3 a, glm::vec3 b, float x, float y, float z, float xSize, float ySize, float zSize) {
|
||||
float hw = (width/2.0f);
|
||||
float w = width;
|
||||
auto c = color;
|
||||
float hw = (width/2.0f);
|
||||
float w = width;
|
||||
glm::vec3 c = color;
|
||||
|
||||
std::vector<EntityVertex> myVerts {
|
||||
/*0*/ {{x - hw + a.x, y - hw + a.y, z - hw + a.z }, {c, 1}, {1, 1, 1}, false, {0, 1, 0}},
|
||||
/*1*/ {{x - hw + a.x + xSize + w, y - hw + a.y, z - hw + a.z }, {c, 1}, {1, 1, 1}, false, {0, 1, 0}},
|
||||
/*2*/ {{x - hw + a.x + xSize + w, y - hw + a.y, z - hw + a.z + zSize + w}, {c, 1}, {1, 1, 1}, false, {0, 1, 0}},
|
||||
/*3*/ {{x - hw + a.x, y - hw + a.y, z - hw + a.z + zSize + w}, {c, 1}, {1, 1, 1}, false, {0, 1, 0}},
|
||||
/*0*/ {{x - hw + a.x, y - hw + a.y, z - hw + a.z }, {c.x, c.y, c.z, 1}, {1, 1, 1}, false, {0, 1, 0}},
|
||||
/*1*/ {{x - hw + a.x + xSize + w, y - hw + a.y, z - hw + a.z }, {c.x, c.y, c.z, 1}, {1, 1, 1}, false, {0, 1, 0}},
|
||||
/*2*/ {{x - hw + a.x + xSize + w, y - hw + a.y, z - hw + a.z + zSize + w}, {c.x, c.y, c.z, 1}, {1, 1, 1}, false, {0, 1, 0}},
|
||||
/*3*/ {{x - hw + a.x, y - hw + a.y, z - hw + a.z + zSize + w}, {c.x, c.y, c.z, 1}, {1, 1, 1}, false, {0, 1, 0}},
|
||||
|
||||
/*4*/ {{x - hw + a.x, y - hw + a.y + ySize + w, z - hw + a.z }, {c, 1}, {1, 1, 1}, false, {0, 1, 0}},
|
||||
/*5*/ {{x - hw + a.x + xSize + w, y - hw + a.y + ySize + w, z - hw + a.z }, {c, 1}, {1, 1, 1}, false, {0, 1, 0}},
|
||||
/*6*/ {{x - hw + a.x + xSize + w, y - hw + a.y + ySize + w, z - hw + a.z + zSize + w}, {c, 1}, {1, 1, 1}, false, {0, 1, 0}},
|
||||
/*7*/ {{x - hw + a.x, y - hw + a.y + ySize + w, z - hw + a.z + zSize + w}, {c, 1}, {1, 1, 1}, false, {0, 1, 0}},
|
||||
/*4*/ {{x - hw + a.x, y - hw + a.y + ySize + w, z - hw + a.z }, {c.x, c.y, c.z, 1}, {1, 1, 1}, false, {0, 1, 0}},
|
||||
/*5*/ {{x - hw + a.x + xSize + w, y - hw + a.y + ySize + w, z - hw + a.z }, {c.x, c.y, c.z, 1}, {1, 1, 1}, false, {0, 1, 0}},
|
||||
/*6*/ {{x - hw + a.x + xSize + w, y - hw + a.y + ySize + w, z - hw + a.z + zSize + w}, {c.x, c.y, c.z, 1}, {1, 1, 1}, false, {0, 1, 0}},
|
||||
/*7*/ {{x - hw + a.x, y - hw + a.y + ySize + w, z - hw + a.z + zSize + w}, {c.x, c.y, c.z, 1}, {1, 1, 1}, false, {0, 1, 0}},
|
||||
};
|
||||
|
||||
std::vector<unsigned int> myInds {
|
||||
|
|
|
@ -34,8 +34,8 @@ void Frustum::update(glm::vec3 &pos, glm::vec3 &look, glm::vec3 &up, glm::vec3 &
|
|||
planes[BOTTOM].setPoints(nbl,nbr,fbr);
|
||||
planes[LEFT].setPoints(ntl,nbl,fbl);
|
||||
planes[RIGHT].setPoints(nbr,ntr,fbr);
|
||||
planes[NEAR].setPoints(ntl,ntr,nbr);
|
||||
planes[FAR].setPoints(ftr,ftl,fbl);
|
||||
planes[FNEAR].setPoints(ntl,ntr,nbr);
|
||||
planes[FFAR].setPoints(ftr,ftl,fbl);
|
||||
}
|
||||
|
||||
int Frustum::pointInFrustum(glm::vec3 &p) {
|
||||
|
|
|
@ -16,8 +16,8 @@ private:
|
|||
BOTTOM,
|
||||
LEFT,
|
||||
RIGHT,
|
||||
NEAR,
|
||||
FAR
|
||||
FNEAR,
|
||||
FFAR
|
||||
};
|
||||
|
||||
public:
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#pragma once
|
||||
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glew.h>
|
||||
#include <glm/mat4x4.hpp>
|
||||
|
||||
struct GuiUniforms {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "Shader.h"
|
||||
typedef unsigned int uint;
|
||||
|
||||
class LightingShader : public Shader {
|
||||
public:
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
//
|
||||
|
||||
#include "SSAOShader.h"
|
||||
typedef unsigned int uint;
|
||||
|
||||
SSAOShader::SSAOShader(glm::vec2 windowSize, float bufferScale, uint kernelCount) : Shader(),
|
||||
windowSize(windowSize),
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "Shader.h"
|
||||
#include <random>
|
||||
typedef unsigned int uint;
|
||||
|
||||
class SSAOShader : public Shader {
|
||||
public:
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include <glm/gtc/type_ptr.hpp>
|
||||
#include "../../../util/Log.h"
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
class Shader {
|
||||
public:
|
||||
Shader();
|
||||
|
|
|
@ -59,7 +59,7 @@ void DebugGui::positionElements(glm::vec2 bufferSize) {
|
|||
auto bufferHeight = (int)bufferSize.y;
|
||||
|
||||
get<GUIText>("crosshairText")->setPos({bufferWidth / 2 + 22, bufferHeight / 2 - 7});
|
||||
get<GUIText>("dataText")->setPos(glm::vec3(10, 10, 0));
|
||||
get<GUIText>("dataText")->setPos({10, 10});
|
||||
|
||||
get<GUILabelledGraph>("genGraph")->setPos({bufferWidth - 254, bufferHeight - 70 - 160});
|
||||
get<GUILabelledGraph>("packetGraph")->setPos({bufferWidth - 254, bufferHeight - 70 - 240});
|
||||
|
|
|
@ -8,7 +8,12 @@ GUILabelledGraph::GUILabelledGraph(const std::string &key) : GUIContainer(key) {
|
|||
|
||||
void GUILabelledGraph::create(glm::vec2 scale, glm::vec4 padding, const std::string &title,
|
||||
unsigned int graphLength, unsigned int graphScale,
|
||||
std::shared_ptr <AtlasRef> graphTextureRef, Font font) {
|
||||
std::shared_ptr<AtlasRef> graphTextureRef, Font font) {
|
||||
|
||||
const static int GRAPH_PAD_X = 2;
|
||||
const static int GRAPH_PAD_Y = 62;
|
||||
const static int TEXT_PAD_X = 4;
|
||||
const static int TEXT_PAD_Y = 8;
|
||||
|
||||
this->scale = scale;
|
||||
this->padding = padding;
|
||||
|
|
|
@ -22,8 +22,6 @@ public:
|
|||
|
||||
void pushValue(float value);
|
||||
private:
|
||||
const static int GRAPH_PAD_X = 2, GRAPH_PAD_Y = 62, TEXT_PAD_X = 4, TEXT_PAD_Y = 8;
|
||||
|
||||
std::string title;
|
||||
|
||||
std::shared_ptr<AtlasRef> graphTextureRef;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
//
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include "InventoryList.h"
|
||||
|
||||
InventoryList::InventoryList(unsigned short size, unsigned short width) :
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <iostream>
|
||||
#include <unordered_set>
|
||||
#include <bits/unordered_map.h>
|
||||
#include <unordered_map>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <glm/vec3.hpp>
|
||||
|
|
|
@ -15,6 +15,7 @@ WorldInterpolationStream::WorldInterpolationStream(unsigned int seed, LocalDefs&
|
|||
|
||||
bool WorldInterpolationStream::pushBack(Packet p) {
|
||||
queuedTasks.push_back(std::move(p));
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<BlockChunk>> WorldInterpolationStream::update() {
|
||||
|
|
|
@ -102,7 +102,7 @@ void MeshGenerator::addFaces(const glm::vec3 &offset, const vector<MeshPart> &me
|
|||
case ShaderMod::ROTATE_Z:
|
||||
case ShaderMod::SWAY_ATTACHED:
|
||||
case ShaderMod::SWAY_FULL_BLOCK: {
|
||||
modData = {Util::packFloat((offset - 8.f) / 8), mp.modValue, 0};
|
||||
modData = {Util::packFloat((offset - 8.f) / 8.f), mp.modValue, 0};
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <vector>
|
||||
#include <cstdio>
|
||||
|
||||
#include "../../../../def/item/MeshPart.h"
|
||||
#include "../MeshDetails.h"
|
||||
#include "../../../../def/item/BlockModelVertex.h"
|
||||
#include "../../../../world/chunk/BlockChunk.h"
|
||||
|
@ -29,7 +30,7 @@ public:
|
|||
std::array<NoiseSample, 3>& blockOffsets);
|
||||
private:
|
||||
BlockDef& getBlockAt(const glm::vec3 &pos);
|
||||
void addFaces(const glm::vec3 &offset, const vector<MeshPart> &meshParts);
|
||||
void addFaces(const glm::vec3 &offset, const std::vector<MeshPart> &meshParts);
|
||||
|
||||
unsigned int indOffset = 0;
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include <GLFW/glfw3.h>
|
||||
#include <iostream>
|
||||
|
||||
typedef unsigned short ushort;
|
||||
|
||||
LuaInputManager::LuaInputManager() {
|
||||
for (bool& key : keysDown) key = false;
|
||||
for (bool& key : keysPressed) key = false;
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
#include <sol2/sol.hpp>
|
||||
|
||||
typedef unsigned short ushort;
|
||||
|
||||
class LuaInputManager {
|
||||
public:
|
||||
LuaInputManager();
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "ServerDimension.h"
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
void ServerDimension::setChunk(sptr<BlockChunk> chunk) {
|
||||
blockChunks.insert({chunk->pos, chunk});
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include <glm/vec3.hpp>
|
||||
#include "../../world/chunk/BlockChunk.h"
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
class ServerDimension {
|
||||
public:
|
||||
ServerDimension() = default;
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace MatConv {
|
|||
}
|
||||
|
||||
static inline glm::mat3 AiToGLMMat3(const aiMatrix3x3 &in_mat) {
|
||||
glm::mat4 tmp;
|
||||
glm::mat3 tmp;
|
||||
|
||||
tmp[0][0] = in_mat.a1;
|
||||
tmp[1][0] = in_mat.b1;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#include <iostream>
|
||||
#include "Log.h"
|
||||
|
||||
typedef unsigned short ushort;
|
||||
|
||||
namespace Util {
|
||||
struct EnumClassHash {
|
||||
template <typename T>
|
||||
|
|
|
@ -21,7 +21,7 @@ void NetHandler::initServer(unsigned short port, short max_clients) {
|
|||
|
||||
if (enet_initialize() != 0) {
|
||||
fprintf(stderr, "[FATAL] Failed to Initialize ENet.\n");
|
||||
state = NetState::ERROR;
|
||||
state = NetState::ENET_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ void NetHandler::initServer(unsigned short port, short max_clients) {
|
|||
|
||||
if (host == nullptr) {
|
||||
fprintf(stderr, "[FATAL] Failed to create ENet host.\n");
|
||||
state = NetState::ERROR;
|
||||
state = NetState::ENET_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ void NetHandler::initClient(Address hostAddress, int attempts, int timeout) {
|
|||
|
||||
if (enet_initialize() != 0) {
|
||||
fprintf(stderr, "[FATAL] Failed to Initialize ENet.\n");
|
||||
state = NetState::ERROR;
|
||||
state = NetState::ENET_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ void NetHandler::initClient(Address hostAddress, int attempts, int timeout) {
|
|||
|
||||
if (host == nullptr) {
|
||||
fprintf(stderr, "[FATAL] Failed to create ENet client.\n");
|
||||
state = NetState::ERROR;
|
||||
state = NetState::ENET_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ void NetHandler::initClient(Address hostAddress, int attempts, int timeout) {
|
|||
|
||||
if (peer == nullptr) {
|
||||
fprintf(stderr, "[FATAL] Failed to find ENet peer.\n");
|
||||
state = NetState::ERROR;
|
||||
state = NetState::ENET_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
enum class NetState {
|
||||
UNINITIALIZED,
|
||||
FAILED_CONNECT,
|
||||
ERROR,
|
||||
ENET_ERROR,
|
||||
CLIENT,
|
||||
HOST,
|
||||
CLOSED
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include "../../game/scene/world/graph/MeshChunk.h"
|
||||
#include "../../util/Log.h"
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
class BlockChunk {
|
||||
public:
|
||||
BlockChunk() = default;
|
||||
|
|
Loading…
Reference in New Issue