mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 19:41:51 +00:00
Merge branch 'main' into refactor-world-renderer
This commit is contained in:
commit
a8886bccfb
18 changed files with 404 additions and 118 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue