mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
commit
34cc778f0d
7 changed files with 44 additions and 32 deletions
|
|
@ -711,7 +711,7 @@ std::unique_ptr<ALAudio> ALAudio::create(const AudioSettings& settings) {
|
|||
return nullptr;
|
||||
}
|
||||
bool effects = true;
|
||||
ALint attribs[4] {};
|
||||
[[maybe_unused]] ALint attribs[4] {};
|
||||
if (alcIsExtensionPresent(device, "ALC_EXT_EFX") == AL_TRUE) {
|
||||
logger.info() << "AL effects extension present";
|
||||
attribs[0] = ALC_MAX_AUXILIARY_SENDS;
|
||||
|
|
|
|||
|
|
@ -55,12 +55,12 @@ model::Model VcmModel::squashed() const {
|
|||
}
|
||||
|
||||
static const std::unordered_map<std::string, int> side_indices {
|
||||
{"north", 0},
|
||||
{"south", 1},
|
||||
{"top", 2},
|
||||
{"bottom", 3},
|
||||
{"west", 4},
|
||||
{"east", 5},
|
||||
{"east", 0},
|
||||
{"west", 1},
|
||||
{"bottom", 2},
|
||||
{"top", 3},
|
||||
{"south", 4},
|
||||
{"north", 5},
|
||||
};
|
||||
|
||||
static bool to_boolean(const xml::Attribute& attr) {
|
||||
|
|
|
|||
|
|
@ -136,18 +136,18 @@ void Mesh::addBox(
|
|||
const bool enabledSides[6],
|
||||
const glm::mat4& transform
|
||||
) {
|
||||
if (enabledSides[0]) // north
|
||||
addPlane(pos+Z*size, X*size, Y*size, Z, uvs[0], transform);
|
||||
if (enabledSides[1]) // south
|
||||
addPlane(pos-Z*size, -X*size, Y*size, -Z, uvs[1], transform);
|
||||
if (enabledSides[2]) // top
|
||||
addPlane(pos+Y*size, X*size, -Z*size, Y, uvs[2] * glm::vec2(-1), transform);
|
||||
if (enabledSides[3]) // bottom
|
||||
addPlane(pos-Y*size, X*size, Z*size, -Y, uvs[3] * glm::vec2(-1, 1), transform);
|
||||
if (enabledSides[4]) // west
|
||||
addPlane(pos+X*size, -Z*size, Y*size, X, uvs[4], transform);
|
||||
if (enabledSides[5]) // east
|
||||
addPlane(pos-X*size, Z*size, Y*size, -X, uvs[5] * glm::vec2(-1, 1), transform);
|
||||
if (enabledSides[0]) // east
|
||||
addPlane(pos-X*size, Z*size, Y*size, -X, uvs[0], transform);
|
||||
if (enabledSides[1]) // west
|
||||
addPlane(pos+X*size, -Z*size, Y*size, X, uvs[1] * glm::vec2(-1, 1), transform);
|
||||
if (enabledSides[2]) // bottom
|
||||
addPlane(pos-Y*size, X*size, Z*size, -Y, uvs[2], transform);
|
||||
if (enabledSides[3]) // top
|
||||
addPlane(pos+Y*size, X*size, -Z*size, Y, uvs[3] * glm::vec2(-1, 1), transform);
|
||||
if (enabledSides[4]) // south
|
||||
addPlane(pos-Z*size, -X*size, Y*size, -Z, uvs[4], transform);
|
||||
if (enabledSides[5]) // north
|
||||
addPlane(pos+Z*size, X*size, Y*size, Z, uvs[5] * glm::vec2(-1, 1), transform);
|
||||
}
|
||||
|
||||
void Mesh::scale(const glm::vec3& size) {
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ Mesh<VertexStructure>::~Mesh() {
|
|||
MeshStats::meshesCount--;
|
||||
glDeleteVertexArrays(1, &vao);
|
||||
glDeleteBuffers(1, &vbo);
|
||||
for (int i = ibos.size() - 1; i >= 0; i--) {
|
||||
for (int i = 0; i < ibos.size(); i++) {
|
||||
glDeleteBuffers(1, &ibos[i].ibo);
|
||||
}
|
||||
}
|
||||
|
|
@ -98,7 +98,7 @@ void Mesh<VertexStructure>::reload(
|
|||
glBufferData(GL_ARRAY_BUFFER, 0, {}, GL_STREAM_DRAW);
|
||||
}
|
||||
|
||||
for (int i = indices.size(); i < ibos.size(); i++) {
|
||||
for (int i = 0; i < ibos.size(); i++) {
|
||||
glDeleteBuffers(1, &ibos[i].ibo);
|
||||
}
|
||||
ibos.clear();
|
||||
|
|
|
|||
|
|
@ -83,12 +83,12 @@ static util::TextureRegion determine_texture_region(
|
|||
const Assets& assets, const std::string& texture
|
||||
) {
|
||||
static std::array<std::string, 6> faces {
|
||||
"blocks:dbg_north",
|
||||
"blocks:dbg_south",
|
||||
"blocks:dbg_top",
|
||||
"blocks:dbg_bottom",
|
||||
"blocks:dbg_west",
|
||||
"blocks:dbg_east",
|
||||
"blocks:dbg_west",
|
||||
"blocks:dbg_bottom",
|
||||
"blocks:dbg_top",
|
||||
"blocks:dbg_south",
|
||||
"blocks:dbg_north",
|
||||
};
|
||||
|
||||
if (texture.length() < 2 || texture.at(0) != '$') {
|
||||
|
|
|
|||
|
|
@ -378,8 +378,11 @@ void EngineController::reconfigPacks(
|
|||
auto& manager = contentControl.scan();
|
||||
reconfig_packs_inside(manager, names, packsToAdd, packsToRemove);
|
||||
|
||||
const auto& settings = engine.getSettings();
|
||||
auto& wfile = *world->wfile;
|
||||
wfile.removeIndices(packsToRemove);
|
||||
if (!settings.debug.generatorTestMode.get()) {
|
||||
wfile.removeIndices(packsToRemove);
|
||||
}
|
||||
wfile.writePacks(manager.getAll(names));
|
||||
reopenWorld(world);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,6 +80,10 @@ int lua::pushwstring(State* L, const std::wstring& str) {
|
|||
return pushstring(L, util::wstr2str_utf8(str));
|
||||
}
|
||||
|
||||
static std::string to_ptr_string(State* L, int idx) {
|
||||
return std::to_string(reinterpret_cast<ptrdiff_t>(lua_topointer(L, idx)));
|
||||
}
|
||||
|
||||
dv::value lua::tovalue(State* L, int idx) {
|
||||
using dv::value_type;
|
||||
auto type = lua::type(L, idx);
|
||||
|
|
@ -99,11 +103,16 @@ dv::value lua::tovalue(State* L, int idx) {
|
|||
}
|
||||
}
|
||||
case LUA_TFUNCTION:
|
||||
return "<function " +
|
||||
std::to_string(
|
||||
reinterpret_cast<ptrdiff_t>(lua_topointer(L, idx))
|
||||
) +
|
||||
">";
|
||||
return "<function " + to_ptr_string(L, idx) + ">";
|
||||
case LUA_TTHREAD:
|
||||
return "<thread " + to_ptr_string(L, idx) + ">";
|
||||
case LUA_TUSERDATA:
|
||||
if (auto userdata = touserdata<Userdata>(L, idx)) {
|
||||
return "<userdata:" + userdata->getTypeName() + " " + to_ptr_string(L, idx) + ">";
|
||||
}
|
||||
return "<userdata " + to_ptr_string(L, idx) + ">";
|
||||
case LUA_TLIGHTUSERDATA:
|
||||
return "<lightuserdata " + to_ptr_string(L, idx) + ">";
|
||||
case LUA_TSTRING:
|
||||
return std::string(tostring(L, idx));
|
||||
case LUA_TTABLE: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue