mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 22:41:49 +00:00
Merge branch 'main' into animation
This commit is contained in:
commit
8c1d8bd794
24 changed files with 56 additions and 50 deletions
|
|
@ -4,7 +4,7 @@ network.get("https://api.github.com/repos/MihailRis/VoxelEngine-Cpp/releases/lat
|
||||||
print(json.parse(s).name)
|
print(json.parse(s).name)
|
||||||
response_received = true
|
response_received = true
|
||||||
end, function (code)
|
end, function (code)
|
||||||
print("repond with code", code)
|
print("respond with code", code)
|
||||||
response_received = true
|
response_received = true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Block Models (depricated)
|
# Block Models (deprecated)
|
||||||
|
|
||||||
> ![WARNING]
|
> ![WARNING]
|
||||||
> The `model-primitives` property is deprecated. Use the [VCM format](vcm.md) for a textual description of the model's primitives.
|
> The `model-primitives` property is deprecated. Use the [VCM format](vcm.md) for a textual description of the model's primitives.
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ block.raycast(start: vec3, dir: vec3, max_distance: number, [optional] dest: tab
|
||||||
Casts a ray from the start point in the direction of *dir*. Max_distance specifies the maximum ray length.
|
Casts a ray from the start point in the direction of *dir*. Max_distance specifies the maximum ray length.
|
||||||
|
|
||||||
Argument `filter` can be used to tell ray what blocks can be skipped(passed through) during ray-casting.
|
Argument `filter` can be used to tell ray what blocks can be skipped(passed through) during ray-casting.
|
||||||
To use filter `dest` argument must be filled with some value(can be nil), it's done for backwards compatability
|
To use filter `dest` argument must be filled with some value(can be nil), it's done for backwards compatibility
|
||||||
|
|
||||||
The `include_non_selectable` argument determines whether blocks that cannot be selected by the cursor will be included.
|
The `include_non_selectable` argument determines whether blocks that cannot be selected by the cursor will be included.
|
||||||
Example - `base:water`
|
Example - `base:water`
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ inventory.clone(invid: int) -> int
|
||||||
|
|
||||||
-- Move an item from slotA of invA to slotB of invB.
|
-- Move an item from slotA of invA to slotB of invB.
|
||||||
-- invA may be the same as invB.
|
-- invA may be the same as invB.
|
||||||
-- If slotB will be chosen automaticly if argument is not specified.
|
-- If slotB will be chosen automatically if argument is not specified.
|
||||||
-- The move may be incomplete if the available slot has no enough stack space.
|
-- The move may be incomplete if the available slot has no enough stack space.
|
||||||
inventory.move(invA: int, slotA: int, invB: int, slotB: int)
|
inventory.move(invA: int, slotA: int, invB: int, slotB: int)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ Returns position of the selected block or nil
|
||||||
player.get_selected_entity(playerid: int) -> int
|
player.get_selected_entity(playerid: int) -> int
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns unique indentifier of the entity selected by player
|
Returns unique identifier of the entity selected by player
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
player.get_entity(playerid: int) -> int
|
player.get_entity(playerid: int) -> int
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ The entity object is available in components as a global variable **entity**.
|
||||||
-- Deletes an entity (the entity may continue to exist until the frame ends, but will not be displayed in that frame)
|
-- Deletes an entity (the entity may continue to exist until the frame ends, but will not be displayed in that frame)
|
||||||
entity:despawn()
|
entity:despawn()
|
||||||
|
|
||||||
-- Returns entity defintion index (integer ID)
|
-- Returns entity definition index (integer ID)
|
||||||
entity:def_index() -> int
|
entity:def_index() -> int
|
||||||
|
|
||||||
-- Returns entity definition name (string ID)
|
-- Returns entity definition name (string ID)
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ Configuring connection. Disconnect-action is action that debugged instance must
|
||||||
|
|
||||||
- `frame` - Call stack frame index (indexing from most recent call)
|
- `frame` - Call stack frame index (indexing from most recent call)
|
||||||
- `local` - Local variable index (based on `paused` event stack trace)
|
- `local` - Local variable index (based on `paused` event stack trace)
|
||||||
- `path` - Requsted value path segments. Example: `['a', 'b', 5]` is `local_variable.a.b[5]`
|
- `path` - Requested value path segments. Example: `['a', 'b', 5]` is `local_variable.a.b[5]`
|
||||||
|
|
||||||
Responds with:
|
Responds with:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ enum AttributeType:uint8 {
|
||||||
sizeof(AttributeType) == 1;
|
sizeof(AttributeType) == 1;
|
||||||
|
|
||||||
struct VertexAttribute {
|
struct VertexAttribute {
|
||||||
AttributeType type; // data type is infered from attribute type
|
AttributeType type; // data type is inferred from attribute type
|
||||||
uint8 flags;
|
uint8 flags;
|
||||||
uint32 size;
|
uint32 size;
|
||||||
float data[]; // if compressed, first 4 bytes of compressed data is decompressed size
|
float data[]; // if compressed, first 4 bytes of compressed data is decompressed size
|
||||||
|
|
|
||||||
|
|
@ -67,16 +67,16 @@ function refresh_search()
|
||||||
local new_included = table.copy(packs_included)
|
local new_included = table.copy(packs_included)
|
||||||
local new_excluded = table.copy(packs_excluded)
|
local new_excluded = table.copy(packs_excluded)
|
||||||
|
|
||||||
local function score(pack_name)
|
local function score(pack_id, pack_name)
|
||||||
if pack_name:lower():find(search_text) then
|
if pack_name:lower():find(search_text) or pack_id:lower():find(search_text) then
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
local function sorting(a, b)
|
local function sorting(a, b)
|
||||||
local score_a = score(packs_info[a][2])
|
local score_a = score(a, packs_info[a][2])
|
||||||
local score_b = score(packs_info[b][2])
|
local score_b = score(b, packs_info[b][2])
|
||||||
|
|
||||||
if score_a ~= score_b then
|
if score_a ~= score_b then
|
||||||
return score_a > score_b
|
return score_a > score_b
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ local CONFIG_NAMES = {
|
||||||
|
|
||||||
function on_open()
|
function on_open()
|
||||||
refresh()
|
refresh()
|
||||||
|
document.search_textbox.focused = true
|
||||||
end
|
end
|
||||||
|
|
||||||
function place_pack(panel, packinfo, callback)
|
function place_pack(panel, packinfo, callback)
|
||||||
|
|
@ -39,7 +40,7 @@ function refresh_search()
|
||||||
local pos = content.pos
|
local pos = content.pos
|
||||||
local size = content.size
|
local size = content.size
|
||||||
|
|
||||||
if title:lower():find(search_text) or search_text == '' then
|
if title:lower():find(search_text) or id:lower():find(search_text) or search_text == '' then
|
||||||
content.enabled = true
|
content.enabled = true
|
||||||
content.pos = {pos[1], visible * (size[2] + interval) - step}
|
content.pos = {pos[1], visible * (size[2] + interval) - step}
|
||||||
visible = visible + 1
|
visible = visible + 1
|
||||||
|
|
|
||||||
|
|
@ -413,7 +413,7 @@ namespace audio {
|
||||||
/// @brief Load audio file info and PCM data
|
/// @brief Load audio file info and PCM data
|
||||||
/// @param file audio file
|
/// @param file audio file
|
||||||
/// @param headerOnly read header only
|
/// @param headerOnly read header only
|
||||||
/// @throws std::runtime_error if I/O error ocurred or format is unknown
|
/// @throws std::runtime_error if I/O error occurred or format is unknown
|
||||||
/// @return PCM audio data
|
/// @return PCM audio data
|
||||||
std::unique_ptr<PCM> load_PCM(const io::path& file, bool headerOnly);
|
std::unique_ptr<PCM> load_PCM(const io::path& file, bool headerOnly);
|
||||||
|
|
||||||
|
|
@ -421,7 +421,7 @@ namespace audio {
|
||||||
/// @param file audio file path
|
/// @param file audio file path
|
||||||
/// @param keepPCM store PCM data in sound to make it accessible with
|
/// @param keepPCM store PCM data in sound to make it accessible with
|
||||||
/// Sound::getPCM
|
/// Sound::getPCM
|
||||||
/// @throws std::runtime_error if I/O error ocurred or format is unknown
|
/// @throws std::runtime_error if I/O error occurred or format is unknown
|
||||||
/// @return new Sound instance
|
/// @return new Sound instance
|
||||||
std::unique_ptr<Sound> load_sound(const io::path& file, bool keepPCM);
|
std::unique_ptr<Sound> load_sound(const io::path& file, bool keepPCM);
|
||||||
|
|
||||||
|
|
@ -434,7 +434,7 @@ namespace audio {
|
||||||
|
|
||||||
/// @brief Open new PCM stream from file
|
/// @brief Open new PCM stream from file
|
||||||
/// @param file audio file path
|
/// @param file audio file path
|
||||||
/// @throws std::runtime_error if I/O error ocurred or format is unknown
|
/// @throws std::runtime_error if I/O error occurred or format is unknown
|
||||||
/// @return new PCMStream instance
|
/// @return new PCMStream instance
|
||||||
std::unique_ptr<PCMStream> open_PCM_stream(const io::path& file);
|
std::unique_ptr<PCMStream> open_PCM_stream(const io::path& file);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ public:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (in.fail()) {
|
if (in.fail()) {
|
||||||
logger.error() << "Wav::load_pcm: I/O error ocurred";
|
logger.error() << "Wav::load_pcm: I/O error occurred";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return in.gcount();
|
return in.gcount();
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ class Hud : public util::ObjectsKeeper {
|
||||||
/// @brief Allow actual pause
|
/// @brief Allow actual pause
|
||||||
bool allowPause = true;
|
bool allowPause = true;
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
/// @brief UI element will be dynamicly positioned near to inventory or in screen center
|
/// @brief UI element will be dynamically positioned near to inventory or in screen center
|
||||||
std::shared_ptr<gui::UINode> secondUI;
|
std::shared_ptr<gui::UINode> secondUI;
|
||||||
|
|
||||||
std::shared_ptr<gui::UINode> debugMinimap;
|
std::shared_ptr<gui::UINode> debugMinimap;
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,9 @@ private:
|
||||||
|
|
||||||
// Does block allow to see other blocks sides (is it transparent)
|
// Does block allow to see other blocks sides (is it transparent)
|
||||||
bool isOpen(const glm::ivec3& pos, const Block& def, const Variant& variant) const {
|
bool isOpen(const glm::ivec3& pos, const Block& def, const Variant& variant) const {
|
||||||
|
if (pos.y >= CHUNK_H) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
const auto& vox = voxelsBuffer->pickBlock(
|
const auto& vox = voxelsBuffer->pickBlock(
|
||||||
chunk->x * CHUNK_W + pos.x, pos.y, chunk->z * CHUNK_D + pos.z
|
chunk->x * CHUNK_W + pos.x, pos.y, chunk->z * CHUNK_D + pos.z
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ namespace gui {
|
||||||
virtual ~BasePanel() = default;
|
virtual ~BasePanel() = default;
|
||||||
|
|
||||||
virtual void setOrientation(Orientation orientation) {
|
virtual void setOrientation(Orientation orientation) {
|
||||||
|
this->mainScrollDir = orientation;
|
||||||
this->orientation = orientation;
|
this->orientation = orientation;
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ void Container::act(float delta) {
|
||||||
|
|
||||||
void Container::scrolled(int value) {
|
void Container::scrolled(int value) {
|
||||||
auto size = getSize();
|
auto size = getSize();
|
||||||
bool isVertical = actualLengthY > size.y;
|
bool isVertical = mainScrollDir == Orientation::VERTICAL;
|
||||||
int diff = (isVertical ? actualLengthY - size.y : actualLengthX - size.x);
|
int diff = (isVertical ? actualLengthY - size.y : actualLengthX - size.x);
|
||||||
int& scroll = (isVertical ? scrollY : scrollX);
|
int& scroll = (isVertical ? scrollY : scrollX);
|
||||||
|
|
||||||
|
|
@ -245,6 +245,7 @@ void Container::setSize(const glm::vec2& size) {
|
||||||
for (auto& node : nodes) {
|
for (auto& node : nodes) {
|
||||||
node->reposition();
|
node->reposition();
|
||||||
}
|
}
|
||||||
|
scrolled(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Container::getScrollStep() const {
|
int Container::getScrollStep() const {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ namespace gui {
|
||||||
int actualLengthY = 0;
|
int actualLengthY = 0;
|
||||||
int actualLengthX = 0;
|
int actualLengthX = 0;
|
||||||
bool scrollable = true;
|
bool scrollable = true;
|
||||||
|
Orientation mainScrollDir = Orientation::VERTICAL;
|
||||||
|
|
||||||
bool isScrolling() const {
|
bool isScrolling() const {
|
||||||
return scrollbarTriggered;
|
return scrollbarTriggered;
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ static std::unique_ptr<xml::xmlelement> toxml(lua::State* L) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
auto key = lua::require_lstring(L, -1);
|
auto key = lua::require_lstring(L, -1);
|
||||||
if (key == "@") {
|
if (key == TAG_ATTR) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
auto value = lua::require_lstring(L, -2);
|
auto value = lua::require_lstring(L, -2);
|
||||||
|
|
|
||||||
|
|
@ -323,7 +323,7 @@ namespace lua {
|
||||||
|
|
||||||
if (found == usertypeNames.end()) {
|
if (found == usertypeNames.end()) {
|
||||||
log_error(
|
log_error(
|
||||||
"usertype is not registred: " + std::string(typeid(T).name())
|
"usertype is not registered: " + std::string(typeid(T).name())
|
||||||
);
|
);
|
||||||
} else if (getglobal(L, found->second)) {
|
} else if (getglobal(L, found->second)) {
|
||||||
setmetatable(L);
|
setmetatable(L);
|
||||||
|
|
|
||||||
|
|
@ -128,11 +128,10 @@ static int l_noise(lua::State* L) {
|
||||||
}
|
}
|
||||||
|
|
||||||
float noiseValue = fnlGetNoise2D(noise, u, v);
|
float noiseValue = fnlGetNoise2D(noise, u, v);
|
||||||
|
float t = 1.0f / static_cast<float>(1 << c) * multiplier;
|
||||||
if (normalizedNoise) {
|
if (normalizedNoise) {
|
||||||
float t = 1.0f / (static_cast<float>(1 << c) * multiplier);
|
|
||||||
value = value * (1.0f - t) + noiseValue * t;
|
value = value * (1.0f - t) + noiseValue * t;
|
||||||
} else {
|
} else {
|
||||||
float t = 1.0f / static_cast<float>(1 << c) * multiplier;
|
|
||||||
value += noiseValue * t;
|
value += noiseValue * t;
|
||||||
}
|
}
|
||||||
heights[i] = value;
|
heights[i] = value;
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ public:
|
||||||
state = ConnectionState::CLOSED;
|
state = ConnectionState::CLOSED;
|
||||||
break;
|
break;
|
||||||
} else if (size < 0) {
|
} else if (size < 0) {
|
||||||
logger.warning() << "an error ocurred while receiving from "
|
logger.warning() << "an error occurred while receiving from "
|
||||||
<< to_string(addr);
|
<< to_string(addr);
|
||||||
auto error = handle_socket_error("recv(...) error");
|
auto error = handle_socket_error("recv(...) error");
|
||||||
closesocket(descriptor);
|
closesocket(descriptor);
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,10 @@
|
||||||
#include "util/EnumMetadata.hpp"
|
#include "util/EnumMetadata.hpp"
|
||||||
|
|
||||||
enum class ParticleSpawnShape {
|
enum class ParticleSpawnShape {
|
||||||
/// @brief Coordinates are regulary distributed within
|
/// @brief Coordinates are regularly distributed within
|
||||||
/// the volume of a ball.
|
/// the volume of a ball.
|
||||||
BALL = 0,
|
BALL = 0,
|
||||||
/// @brief Coordinates are regulary distributed on
|
/// @brief Coordinates are regularly distributed on
|
||||||
/// a sphere.
|
/// a sphere.
|
||||||
SPHERE,
|
SPHERE,
|
||||||
/// @brief Coordinates are uniform distributed within
|
/// @brief Coordinates are uniform distributed within
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ namespace util {
|
||||||
|
|
||||||
/// @brief Simple heap implementation for memory-optimal sparse array of
|
/// @brief Simple heap implementation for memory-optimal sparse array of
|
||||||
/// small different structures
|
/// small different structures
|
||||||
/// @note alignment is not impemented
|
/// @note alignment is not implemented
|
||||||
/// (impractical in the context of scripting and memory consumption)
|
/// (impractical in the context of scripting and memory consumption)
|
||||||
/// @tparam Tindex entry index type
|
/// @tparam Tindex entry index type
|
||||||
/// @tparam Tsize entry size type
|
/// @tparam Tsize entry size type
|
||||||
|
|
|
||||||
|
|
@ -323,7 +323,7 @@ void WorldRegions::processBlocksData(int x, int z, const BlockDataProc& func) {
|
||||||
try {
|
try {
|
||||||
func(&blocksData, std::move(voxData));
|
func(&blocksData, std::move(voxData));
|
||||||
} catch (const std::exception& err) {
|
} catch (const std::exception& err) {
|
||||||
logger.error() << "an error ocurred while processing blocks "
|
logger.error() << "an error occurred while processing blocks "
|
||||||
"data in chunk (" << gx << ", " << gz << "): " << err.what();
|
"data in chunk (" << gx << ", " << gz << "): " << err.what();
|
||||||
blocksData = {};
|
blocksData = {};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue