Texture by index instead of map (#2107)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -131,18 +131,13 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr
|
||||
|
||||
// create texture. to be reused for all the tiles of the debug layers
|
||||
auto texture = context.createTexture2D();
|
||||
std::optional<uint32_t> samplerLocation;
|
||||
{
|
||||
std::array<uint8_t, 4> data{{0, 0, 0, 0}};
|
||||
auto emptyImage = std::make_shared<PremultipliedImage>(Size(1, 1), data.data(), data.size());
|
||||
texture->setImage(emptyImage);
|
||||
texture->setSamplerConfiguration(
|
||||
{gfx::TextureFilterType::Linear, gfx::TextureWrapType::Clamp, gfx::TextureWrapType::Clamp});
|
||||
static const StringIdentity idDebugOverlayUniformName = stringIndexer().get("u_overlay");
|
||||
samplerLocation = debugShader->getSamplerLocation(idDebugOverlayUniformName);
|
||||
}
|
||||
assert(samplerLocation.has_value());
|
||||
if (!samplerLocation.has_value()) return;
|
||||
|
||||
// function to update existing tile drawables with UBO value. return number of updated drawables
|
||||
const auto updateDrawables =
|
||||
@@ -172,7 +167,7 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr
|
||||
debugBuilder->addVertices(verts, 0, verts.size());
|
||||
debugBuilder->setSegments(mode, indexes, segments.data(), segments.size());
|
||||
// texture
|
||||
debugBuilder->setTexture(texture, samplerLocation.value());
|
||||
debugBuilder->setTexture(texture, idDebugOverlayTexture);
|
||||
|
||||
// finish
|
||||
debugBuilder->flush(context);
|
||||
|
||||
Reference in New Issue
Block a user