Merge branch 'main' into dev
This commit is contained in:
commit
73f589d479
69
flake.nix
69
flake.nix
@ -1,16 +1,69 @@
|
|||||||
{
|
{
|
||||||
|
description = "VoxelCore – voxel game engine in C++";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils }:
|
outputs =
|
||||||
flake-utils.lib.eachDefaultSystem (system: {
|
{
|
||||||
devShells.default = with nixpkgs.legacyPackages.${system}; mkShell {
|
self,
|
||||||
nativeBuildInputs = [ cmake pkg-config ];
|
nixpkgs,
|
||||||
buildInputs = [ glm glfw glew zlib libpng libvorbis openal luajit curl ]; # libglvnd
|
flake-utils,
|
||||||
packages = [ glfw mesa freeglut entt ];
|
}:
|
||||||
LD_LIBRARY_PATH = "${wayland}/lib:$LD_LIBRARY_PATH";
|
flake-utils.lib.eachDefaultSystem (
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
voxel-core = pkgs.stdenv.mkDerivation {
|
||||||
|
name = "voxel-core";
|
||||||
|
|
||||||
|
src = ./.;
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
cmake
|
||||||
|
pkg-config
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
glm
|
||||||
|
glfw
|
||||||
|
glew
|
||||||
|
zlib
|
||||||
|
libpng
|
||||||
|
libvorbis
|
||||||
|
openal
|
||||||
|
luajit
|
||||||
|
curl
|
||||||
|
entt
|
||||||
|
mesa
|
||||||
|
freeglut
|
||||||
|
]; # libglvnd
|
||||||
|
|
||||||
|
packages = with pkgs; [
|
||||||
|
glfw
|
||||||
|
mesa
|
||||||
|
freeglut
|
||||||
|
entt
|
||||||
|
];
|
||||||
|
cmakeFlags = [
|
||||||
|
"-DCMAKE_PREFIX_PATH=${pkgs.entt}"
|
||||||
|
"-DCMAKE_INCLUDE_PATH=${pkgs.entt}/include"
|
||||||
|
];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
cp VoxelEngine $out/bin/
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
});
|
in
|
||||||
|
{
|
||||||
|
packages.default = voxel-core;
|
||||||
|
apps.default = {
|
||||||
|
type = "app";
|
||||||
|
program = "${voxel-core}/bin/VoxelCore";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -538,6 +538,7 @@ void Hud::closeInventory() {
|
|||||||
exchangeSlotInv = nullptr;
|
exchangeSlotInv = nullptr;
|
||||||
inventoryOpen = false;
|
inventoryOpen = false;
|
||||||
inventoryView = nullptr;
|
inventoryView = nullptr;
|
||||||
|
secondInvView = nullptr;
|
||||||
secondUI = nullptr;
|
secondUI = nullptr;
|
||||||
|
|
||||||
for (auto& element : elements) {
|
for (auto& element : elements) {
|
||||||
@ -597,6 +598,9 @@ void Hud::remove(const std::shared_ptr<UINode>& node) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
cleanup();
|
cleanup();
|
||||||
|
if (node == secondUI) {
|
||||||
|
closeInventory();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hud::setDebug(bool flag) {
|
void Hud::setDebug(bool flag) {
|
||||||
|
|||||||
@ -126,7 +126,15 @@ void Batch3D::sprite(
|
|||||||
float scale = 1.0f / static_cast<float>(atlasRes);
|
float scale = 1.0f / static_cast<float>(atlasRes);
|
||||||
float u = (index % atlasRes) * scale;
|
float u = (index % atlasRes) * scale;
|
||||||
float v = 1.0f - ((index / atlasRes) * scale) - scale;
|
float v = 1.0f - ((index / atlasRes) * scale) - scale;
|
||||||
sprite(pos, up, right, w, h, UVRegion(u, v, u+scale, v+scale), tint);
|
sprite(
|
||||||
|
pos + right * w + up * h, // revert centering
|
||||||
|
up,
|
||||||
|
right,
|
||||||
|
w,
|
||||||
|
h,
|
||||||
|
UVRegion(u, v, u + scale, v + scale),
|
||||||
|
tint
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Batch3D::sprite(
|
void Batch3D::sprite(
|
||||||
|
|||||||
@ -51,6 +51,7 @@ void TextsRenderer::renderNote(
|
|||||||
glm::vec3 yvec = note.getAxisY();
|
glm::vec3 yvec = note.getAxisY();
|
||||||
|
|
||||||
int width = font.calcWidth(text, text.length());
|
int width = font.calcWidth(text, text.length());
|
||||||
|
int height = font.getLineHeight();
|
||||||
if (preset.displayMode == NoteDisplayMode::Y_FREE_BILLBOARD ||
|
if (preset.displayMode == NoteDisplayMode::Y_FREE_BILLBOARD ||
|
||||||
preset.displayMode == NoteDisplayMode::XY_FREE_BILLBOARD) {
|
preset.displayMode == NoteDisplayMode::XY_FREE_BILLBOARD) {
|
||||||
xvec = camera.position - pos;
|
xvec = camera.position - pos;
|
||||||
@ -96,8 +97,11 @@ void TextsRenderer::renderNote(
|
|||||||
|
|
||||||
pos = screenPos / screenPos.w;
|
pos = screenPos / screenPos.w;
|
||||||
}
|
}
|
||||||
} else if (!frustum.isBoxVisible(pos - xvec * (width * 0.5f * preset.scale),
|
} else if (!frustum.isBoxVisible(
|
||||||
pos + xvec * (width * 0.5f * preset.scale))) {
|
pos - xvec * (width * 0.5f) * preset.scale,
|
||||||
|
pos + xvec * (width * 0.5f) * preset.scale +
|
||||||
|
yvec * static_cast<float>(height) * preset.scale
|
||||||
|
)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto color = preset.color;
|
auto color = preset.color;
|
||||||
|
|||||||
@ -46,7 +46,7 @@ static int l_open(lua::State* L) {
|
|||||||
}
|
}
|
||||||
return lua::pushinteger(L, hud->openInventory(
|
return lua::pushinteger(L, hud->openInventory(
|
||||||
layout,
|
layout,
|
||||||
level->inventories->get(invid),
|
lua::isnoneornil(L, 3) ? nullptr : level->inventories->get(invid),
|
||||||
playerInventory
|
playerInventory
|
||||||
)->getId());
|
)->getId());
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user