int EmitVert(int x, int y, int z, Color32 color) { int INDEX = (y * (VOXEL_CHUNK_SIZE_XZ + 1) * (VOXEL_CHUNK_SIZE_XZ + 1)) + (z * (VOXEL_CHUNK_SIZE_XZ + 1)) + x; var idx = _vtoi[INDEX] - 1; if (idx < 0) { Assert(_vertCount < ushort.MaxValue); idx = _vertCount++; vtoiCounts[idx] = 0; _vtoi[INDEX] = idx + 1; positions[idx] = new Int3_t { x = x, y = y, z = z }; } var count = vtoiCounts[idx]; Assert(count < BANK_SIZE); colors[(idx * BANK_SIZE) + count] = color; vtoiCounts[idx] = count + 1; return(idx | (count << 24)); }
void BlendVertex(int index, out Int3_t outPos, out Color32 outColor) { var ofs = index >> 24; index = index & 0x00ffffff; var bankedIndex = (index * BANK_SIZE) + ofs; outPos = _smoothVerts.positions[index]; outColor = _smoothVerts.colors[bankedIndex]; }