Merge branch 'main' into refactor-world-renderer

This commit is contained in:
MihailRis 2026-08-04 20:48:14 +03:00
commit a8886bccfb
18 changed files with 404 additions and 118 deletions

View file

@ -403,6 +403,7 @@ static int l_start_background_instance(lua::State* L) {
"--script", io::resolve(scriptPath).u8string(),
"--sub-depth", std::to_string(engine->getCoreParameters()
.subProcessDepth + 1),
"--log", io::resolve(outputPath).u8string(),
};
args.emplace_back("--project");
args.emplace_back(io::resolve(engine->getProject().path).u8string());
@ -417,11 +418,9 @@ static int l_start_background_instance(lua::State* L) {
if (handle == -1) {
throw std::runtime_error("sub-processes limit exceeded");
}
::processes[handle] = platform::new_engine_instance(
std::move(args),
outputPath.empty() ? "" : io::resolve(outputPath),
true
);
::processes[handle] =
platform::new_engine_instance(std::move(args), "", true);
return lua::pushinteger(L, handle);
}

View file

@ -161,17 +161,13 @@ static LuaCanvas& require_canvas(State* L, int idx) {
static int l_clear(State* L) {
auto& canvas = require_canvas(L, 1);
auto& image = canvas.getData();
ubyte* data = image.getData();
RGBA rgba {};
size_t pixelscount = image.getWidth() * image.getHeight();
uint32_t* data = reinterpret_cast<uint32_t*>(image.getData());
if (gettop(L) == 1) {
std::fill(data, data + image.getDataSize(), 0);
return 0;
}
rgba = get_rgba(L, 2);
size_t pixels = image.getWidth() * image.getHeight();
const size_t channels = 4;
for (size_t i = 0; i < pixels * channels; i++) {
data[i] = rgba.arr[i % channels];
std::fill(data, data + pixelscount, 0);
} else {
std::fill(data, data + pixelscount, get_rgba(L, 2).rgba);
}
return 0;
}