This commit is contained in:
Andrew Nakas 2026-08-11 14:23:36 -06:00 • committed by GitHub
commit 951fa2ca46
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View file

@ -2107,8 +2107,16 @@ bool BuildItemFromMesh(uint8_t* base, uint32_t mesh, DrawItem& item) {
item.vb_bytes = BSwap32(vb_words[2]);
item.ib_addr = BSwap32(ib_words[0]) & 0xFFFFFFFC;
item.ib_count = BSwap32(ib_words[2]);
// vb_bytes need only COVER a whole number of vertices, not equal one
// exactly. Community custom maps (ArenaBuilder-built worlds) ship vertex
// buffers with a few trailing bytes past the last vertex - e.g. 43968
// bytes at stride 36 leaves 12 over - and requiring an exact multiple
// rejected the entire mesh, so the world rendered with no ground at all.
// Every consumer already derives the vertex count as vb_bytes / stride
// (integer division), so the trailing bytes are simply unused; all that
// is really required is room for at least one vertex.
if (item.vb_addr == 0 || item.ib_addr == 0 || item.vb_bytes == 0 ||
item.ib_count == 0 || item.vb_bytes % item.stride != 0) {
item.ib_count == 0 || item.stride == 0 || item.vb_bytes < item.stride) {
g_rej_geom.fetch_add(1, std::memory_order_relaxed);
return false;
}

View file

@ -856,6 +856,14 @@ bool DecodeMesh(nrhi::Device* device, uint8_t* base, const DrawItem& item,
break;
case 37: // k_32_32_FLOAT (hair strand-alpha UV; xenos enum 37)
case 38: // k_32_32_32_32_FLOAT (use xy)
case 57: // k_32_32_32_FLOAT (use xy). Community custom maps
// (ArenaBuilder-built worlds) declare their texcoord this
// way; without this case the decode fell through to the
// default and left the UV at (0,0), so every pixel sampled
// one texel and the whole surface rendered as a single flat
// colour - the "custom maps have no textures on the native
// renderer" report. x is at +0 and y at +4 exactly as for
// the other float pairs.
u = std::bit_cast<float>(SwapU32(*reinterpret_cast<const uint32_t*>(q)));
w = std::bit_cast<float>(SwapU32(*reinterpret_cast<const uint32_t*>(q + 4)));
break;