This commit is contained in:
clasher113 2025-07-19 15:37:06 +03:00
commit 941d3bcf8e
12 changed files with 131 additions and 105 deletions

View File

@ -1,6 +1,6 @@
# 0.27 - 2025.03.25 # 0.28 - 2025.07.18
[Documentation](https://github.com/MihailRis/VoxelEngine-Cpp/tree/release-0.27/doc/en/main-page.md) for 0.27 [Documentation](https://github.com/MihailRis/VoxelEngine-Cpp/tree/release-0.28/doc/en/main-page.md) for 0.28
Table of contents: Table of contents:
@ -11,101 +11,64 @@ Table of contents:
## Added ## Added
- items data - advanced graphics mode
- weather - state bits based models
- work with ZIP-files - post-effects
- splitbox ui element - ui elements:
- history in textbox - iframe
- reloading content scripts within the editor - select
- libraries: - modelviewer
- gfx.weather - vcm models format
- [add side mouse buttons](https://github.com/MihailRis/VoxelEngine-Cpp/pull/461) - bit.compile
- item properties: - yaml encoder/decoder
- uses - error handler argument in http.get, http.post
- uses-display - ui properties:
- textbox attributes: - image.region
- oncontrolkey - rotation profiles:
- container attributes: - stairs
- scroll - libraries
- multiline tooltips suppoirt - gfx.posteffects
- ['@' prefix support in tooltips](https://github.com/MihailRis/VoxelEngine-Cpp/commit/fa990e393986aad07e9fb9a570338b08fd4f9a0c) - yaml
- stairs rotation profile
- models editing in console
- syntax highlighting: xml, glsl, vcm
- beginning of projects system
### Changes ### Changes
- file subsystem upgrade - reserved 'project', 'pack', 'packid', 'root' entry points
- code editor upgrade - Bytearray optimized with FFI
- block materials update - chunks non-unloading zone limited with circle
- actual file path now may be specified in audio.play_stream/play_stream_2d call.
### Functions ### Functions
- file.create_zip - yaml.tostring
- file.mount - yaml.parse
- file.unmount - gfx.posteffects.index
- file.path - gfx.posteffects.set_effect
- file.parent - gfx.posteffects.get_intensity
- file.join - gfx.posteffects.set_intensity
- pack.request_writeable - gfx.posteffects.is_active
- crc32 - gfx.posteffects.set_params
- table.merge - gfx.posteffects.set_array
- table.map - block.get_variant
- table.filter - block.set_variant
- table.set_default - bit.compile
- table.flat - Bytearray_as_string
- table.deep_flat
- table.sub
- math.sum
- string.pad
- string.left_pad
- string.right_pad
- block.reload_script
- world.reload_script
- entities.reload_component
- hud.reload_script
- item.reload_script
- gfx.weather.change
- gfx.weather.get_current
- gfx.weather.get_current_data
- gfx.weather.get_fall_intensity
- gfx.weather.is_transition
- inventory.decrement
- inventory.use
- inventory.set_count
- inventory.get_data
- inventory.set_data
- inventory.get_all_data
- inventory.has_data
- item.uses
- core.capture_output
Methods:
- canvas:set_data
- canvas:line
- canvas:blit
- canvas:clear
- canvas:create_texture
## Fixes ## Fixes
- [fix incorrect entity transform scale & rotation combination](https://github.com/MihailRis/VoxelEngine-Cpp/commit/b832b9850f709053b43714bb0e3481560711e872) - [fix: "unknown argument --memcheck" in vctest](https://github.com/MihailRis/voxelcore/commit/281d5e09e6f1c016646af6000f6b111695c994b3)
- [fix syntax highlighting not refreshing on selected text removal](https://github.com/MihailRis/VoxelEngine-Cpp/commit/33795f06f710de569a24b2d1937310b16dd040f5) - [fix "upgrade square is not fully inside of area" error](https://github.com/MihailRis/voxelcore/commit/bf79f6bc75a7686d59fdd0dba8b9018d6191e980 )
- [fix TextBox behavior with markup used](https://github.com/MihailRis/VoxelEngine-Cpp/commit/31d5cb68800d965a668a67fd60bb4d3365181242) - [fix generator area centering](https://github.com/MihailRis/voxelcore/commit/98813472a8c25b1de93dd5d843af38c5aec9b1d8 "fix generator area centering")
- [fix: console/chat open still available when menu is open & cleanup](https://github.com/MihailRis/VoxelEngine-Cpp/commit/c7061c70cb3b6382197c93d9442bfbb4c9fc1def) - [fix incomplete content reset](https://github.com/MihailRis/voxelcore/commit/61af8ba943a24f6544c6482def2e244cf0af4d18)
- [fix: Label.cpp: uinode size](https://github.com/MihailRis/VoxelEngine-Cpp/commit/6e8a4bacff77b7eba39393bcc8a5fb417a288884) - [fix stack traces](https://github.com/MihailRis/voxelcore/commit/05ddffb5c9902e237c73cdea55d4ac1e303c6a8e)
- [fix: camera rotation not updating when menu is open](https://github.com/MihailRis/VoxelEngine-Cpp/commit/801354c15d96343b00963183f6f08219bd375ee8) - [fix containers refreshing](https://github.com/MihailRis/voxelcore/commit/34295faca276b55c6e3c0ddd98b867a0aab3eb2a)
- [fix stack split (right click) with item data](https://github.com/MihailRis/VoxelEngine-Cpp/commit/6ef82982bdc813bfc5c0ed2437a1a3fa9a2242d1) - [fix toml encoder](https://github.com/MihailRis/voxelcore/commit/9cd95bb0eb73521bef07f6f0d5e8b78f3e309ebf)
- [fix stack increment (right click) with item data](https://github.com/MihailRis/VoxelEngine-Cpp/commit/449b0ebca464f913f63913ad7af91811c717c349) - [fix InputBindBox](https://github.com/MihailRis/voxelcore/commit/7c976a573b01e3fb6f43bacaab22e34037b55b73 "fix InputBindBox")
- [fix caves generation](https://github.com/MihailRis/VoxelEngine-Cpp/commit/4c8b0824181f05aa5611a1e077f999788f575c42) - [fix inventory.* functions error messages](https://github.com/MihailRis/voxelcore/commit/af3c315c04959eea6c11f5ae2854a6f253e3450f)
- [fix: incorrect UV on custom model blocks](https://github.com/MihailRis/VoxelEngine-Cpp/commit/12105c29335481de429c8e6acc953e8cbcdc6ecf) - [fix: validator not called after backspace](https://github.com/MihailRis/voxelcore/commit/df3640978d279b85653d647facb26ef15c509848)
- [bug fix content_menu.xml.lua](https://github.com/MihailRis/VoxelEngine-Cpp/commit/15e143afb0364f816a1033868b2501c9a9e69fda) - [fix: missing pack.has_indices if content is not loaded](https://github.com/MihailRis/voxelcore/commit/b02b45457322e1ce8f6b9735caeb5b58b1e2ffb4)
- [fix: disabled bodies not skipping in entities raycast](https://github.com/MihailRis/VoxelEngine-Cpp/commit/5e10afc9b5d6582617fe34ec37abdb682e46197a) - [fix: entities despawn on F5](https://github.com/MihailRis/voxelcore/commit/6ab48fda935f3f1d97d76a833c8511522857ba6a)
- [table.filter bug fix](https://github.com/MihailRis/VoxelEngine-Cpp/pull/481) - [bug fix [#549]](https://github.com/MihailRis/voxelcore/commit/49727ec02647e48323266fbf814c15f6d5632ee9)
- [fix: incorrect canvas Y direction](https://github.com/MihailRis/VoxelEngine-Cpp/commit/ee3fbc68314865384d2a7d78a22221b5987979a4) - [fix player camera zoom with fov-effects disabled](https://github.com/MihailRis/voxelcore/commit/014ffab183687ed9acbb93ab90e43d8f82ed826a)
- [fix fatal error on audio.play_sound in headless-mode](https://github.com/MihailRis/VoxelEngine-Cpp/commit/a74a4fcf5366c8f78625f7087f42a8150f6896e0)
- [fix BasicParser '\v' and '\x' escapes](https://github.com/MihailRis/VoxelEngine-Cpp/commit/8b0935d2b745acb11cba9c8bc647b4186d1817a3)
- [fix: entity:despawn in on_save not preventing entity save](https://github.com/MihailRis/VoxelEngine-Cpp/pull/480)
- [fix syntax highlighting unicode support](https://github.com/MihailRis/VoxelEngine-Cpp/pull/475)
- [fix reading binary file as string](https://github.com/MihailRis/VoxelEngine-Cpp/commit/104cc116456aba6e569892521ecae92d8bf6b9ff)
- [fix inventory.move_range](https://github.com/MihailRis/VoxelEngine-Cpp/commit/f5a4b5ca79806418b0736d3f84e9efa8d9992a34)
- [fix: multiline text draw is not limited to the render area](https://github.com/MihailRis/VoxelEngine-Cpp/commit/a8067ad9d634cb3fc4632378277d62b32e4afb15)

View File

@ -3,7 +3,7 @@
## Latest release ## Latest release
- [Download](https://github.com/MihailRis/VoxelCore/releases/latest) | [Скачать](https://github.com/MihailRis/VoxelCore/releases/latest) - [Download](https://github.com/MihailRis/VoxelCore/releases/latest) | [Скачать](https://github.com/MihailRis/VoxelCore/releases/latest)
- [Documentation](https://github.com/MihailRis/VoxelCore/blob/release-0.27/doc/en/main-page.md) | [Документация](https://github.com/MihailRis/VoxelCore/blob/release-0.27/doc/ru/main-page.md) - [Documentation](https://github.com/MihailRis/VoxelCore/blob/release-0.28/doc/en/main-page.md) | [Документация](https://github.com/MihailRis/VoxelCore/blob/release-0.28/doc/ru/main-page.md)
## Build project in Linux ## Build project in Linux

View File

@ -75,6 +75,7 @@ Common methods:
| ------------------------------- | -------------------------------------------------------------------------------------------- | | ------------------------------- | -------------------------------------------------------------------------------------------- |
| clear() | clears content | | clear() | clears content |
| add(xml) | adds an element, creating it using xml code. Example: `container:add("<image src='test'/>")` | | add(xml) | adds an element, creating it using xml code. Example: `container:add("<image src='test'/>")` |
| add(xml, data) | overload with table, which in events declared in xml will be available as DATA |
| setInterval(interval, callback) | assigns a function to be executed repeatedly at an interval specified in milliseconds | | setInterval(interval, callback) | assigns a function to be executed repeatedly at an interval specified in milliseconds |
## Textbox ## Textbox

View File

@ -20,3 +20,4 @@
- [Скриптинг](scripting.md) - [Скриптинг](scripting.md)
- [Стили текста](text-styles.md) - [Стили текста](text-styles.md)
- [Частицы](particles.md) - [Частицы](particles.md)
- [Формат моделей VCM](vcm.md)

View File

@ -71,11 +71,12 @@ document["worlds-panel"]:clear()
Методы: Методы:
| Метод | Описание | | Метод | Описание |
| ------------------------------- | ------------------------------------------------------------------------------------------- | | ------------------------------- | --------------------------------------------------------------------------------------------- |
| clear() | очищает контент | | clear() | очищает контент |
| add(xml) | добавляет элемент, создавая его по xml коду. Пример: `container:add("<image src='test'/>")` | | add(xml) | добавляет элемент, создавая его по xml коду. Пример: `container:add("<image src='test'/>")` |
| setInterval(interval, callback) | назначает функцию на повторяющееся выполнение с заданным в миллисекундах интервалом | | add(xml, data) | перегрузка с передачей таблицы, которая в событиях, объявленных в xml будет доступна как DATA |
| setInterval(interval, callback) | назначает функцию на повторяющееся выполнение с заданным в миллисекундах интервалом |
## Текстовое поле (textbox) ## Текстовое поле (textbox)

49
doc/ru/vcm.md Normal file
View File

@ -0,0 +1,49 @@
## VCM
Текстовый формат описания 3D моделей, являющийся заменой устаревшего свойства `model-primitives`.
Синтаксис:
```
@примитив атрибут (значение1,значение2,...) атрибут2 "значение3" {
@внутренний_примитив ...
}
```
Аналогичная структура в XML:
```xml
<примитив атрибут="значение1,значение2,..." атрибут2="значение3">
<внутренний_примитив .../>
</примитив>
```
В отличие от XML в корне может находиться несколько элементов.
На данный момент существует два вида примитивов: box и rect, а также, part (описывает часть примитива, такую как, например, сторона куба).
### Свойства `rect`
- `from` - точка начала примитива. Пример: `from (0,0.5,0.125)`
- `right` - вектор X, также определяющий ширину примитива. Пример: `right (1,0,0)`
- `up` - вектор Y, также определяющий высоту примитива. Пример: `up (0,1,0)`
- `texture` - отображаемая текстура. По-умолчанию: `$0`. Пример: `texture "blocks:sand"`
- `region` - UV регион в границах выбранной текстуры, определяется позициями противоположных углов. Пример: `region (0,0,1,1)`
- `region-scale` вектор-множитель для автоматически выбранного UV региона. Пример: `region-scale (0.5,1)`
- `shading` определяет возможность затенения на примитиве. Пример: `shading off`
- `flip` отражает UV регион по горизонтали или вертикали. Пример: `flip v`
### Свойства `box`
- `from` - точка начала примитива. Пример: `from (0,0,0)`
- `to` - противоположная от начала точка. Пример: `to (1,1,1)`
- `texture` - отображаемая текстура для всех сторон по-умолчанию.
- `shading` определяет возможность затенения на примитиве. Пример: `shading off`
- `delete` удаляет стороны по именам (top, bottom, east, west, north, south)
### Свойства `part``box`)
- `tags` - определяет то, на какаие из сторон будут применены свойства. Пример: `tags (top,bottom)`
- `texture` - отображаемая текстура. По-умолчанию: `$индекс_стороны`.
- `region` - UV регион в границах выбранной текстуры, определяется позициями противоположных углов. Пример: `region (0,0,1,1)`
- `region-scale` вектор-множитель для автоматически выбранного UV региона. Пример: `region-scale (0.5,1)`

View File

@ -1,6 +1,6 @@
language = "VCM" language = "VCM"
extensions = ["vcm"] extensions = ["vcm"]
line-comment-start = "#" line-comment = "#"
keywords = [ keywords = [
"on", "off" "on", "off"
] ]

View File

@ -51,7 +51,9 @@ void main() {
mat4 viewmodel = u_view * u_model; mat4 viewmodel = u_view * u_model;
a_distance = length(viewmodel * vec4(pos3d, 0.0)); a_distance = length(viewmodel * vec4(pos3d, 0.0));
#ifndef ADVANCED_RENDER
a_fog = calc_fog(length(viewmodel * vec4(pos3d * FOG_POS_SCALE, 0.0)) / 256.0); a_fog = calc_fog(length(viewmodel * vec4(pos3d * FOG_POS_SCALE, 0.0)) / 256.0);
#endif
a_emission = v_normal.w; a_emission = v_normal.w;
vec4 viewmodelpos = u_view * a_modelpos; vec4 viewmodelpos = u_view * a_modelpos;

View File

@ -151,6 +151,12 @@ public:
return std::wstring(source.substr(start, pos - start)); return std::wstring(source.substr(start, pos - start));
} }
void emitLineComment(devtools::Location start) {
auto string = readUntilEOL();
emitToken(TokenTag::COMMENT, std::wstring(string), start);
skipLine();
}
std::vector<Token> tokenize() { std::vector<Token> tokenize() {
skipWhitespace(); skipWhitespace();
while (hasNext()) { while (hasNext()) {
@ -229,16 +235,18 @@ public:
} }
if (is_lua_operator_start(c)) { if (is_lua_operator_start(c)) {
auto text = parseOperator(); auto text = parseOperator();
if (text == L"--") { if (text == syntax.lineComment) {
auto string = readUntilEOL(); emitLineComment(start);
emitToken(TokenTag::COMMENT, std::wstring(string), start);
skipLine();
continue; continue;
} }
emitToken(TokenTag::OPERATOR, std::move(text), start); emitToken(TokenTag::OPERATOR, std::move(text), start);
continue; continue;
} }
auto text = readUntilWhitespace(); auto text = readUntilWhitespace();
if (text.find(syntax.lineComment) == 0) {
emitLineComment(start);
continue;
}
emitToken(TokenTag::UNEXPECTED, std::wstring(text), start); emitToken(TokenTag::UNEXPECTED, std::wstring(text), start);
} }
return std::move(tokens); return std::move(tokens);

View File

@ -67,7 +67,7 @@ void ContentGfxCache::refresh(const Block& def, const Atlas& atlas) {
if (def.variants) { if (def.variants) {
const auto& variants = def.variants->variants; const auto& variants = def.variants->variants;
for (int i = 1; i < variants.size() - 1; i++) { for (int i = 1; i < variants.size() - 1; i++) {
refresh_variant(assets, def, variants[i], i + 1, sideregions, atlas, settings, models); refresh_variant(assets, def, variants[i], i, sideregions, atlas, settings, models);
} }
def.variants->variants.at(0) = def.defaults; def.variants->variants.at(0) = def.defaults;
} }

View File

@ -164,14 +164,14 @@ void WorldRenderer::setupWorldShader(
auto inventory = player.getInventory(); auto inventory = player.getInventory();
ItemStack& stack = inventory->getSlot(player.getChosenSlot()); ItemStack& stack = inventory->getSlot(player.getChosenSlot());
auto& item = indices->items.require(stack.getItemId()); auto& item = indices->items.require(stack.getItemId());
float multiplier = 0.5f; float multiplier = 0.75f;
shader.uniform3f( shader.uniform3f(
"u_torchlightColor", "u_torchlightColor",
item.emission[0] / 15.0f * multiplier, item.emission[0] / 15.0f * multiplier,
item.emission[1] / 15.0f * multiplier, item.emission[1] / 15.0f * multiplier,
item.emission[2] / 15.0f * multiplier item.emission[2] / 15.0f * multiplier
); );
shader.uniform1f("u_torchlightDistance", 6.0f); shader.uniform1f("u_torchlightDistance", 8.0f);
} }
} }

View File

@ -220,6 +220,7 @@ void EnginePaths::cleanup() {
io::remove_device(entryPoint); io::remove_device(entryPoint);
} }
entryPoints.clear(); entryPoints.clear();
writeables.clear();
} }
void EnginePaths::setEntryPoints(std::vector<PathsRoot> entryPoints) { void EnginePaths::setEntryPoints(std::vector<PathsRoot> entryPoints) {