Move pre-streaming logic from KRNode and descendants to KRScene, simplifying KRNode render methods

This commit is contained in:
2025-11-13 22:01:24 -08:00
parent 614ce0a151
commit e029e0b3fc
14 changed files with 40 additions and 41 deletions

View File

@@ -112,24 +112,24 @@ AABB KRSprite::getBounds()
}
void KRSprite::preStream(const KRViewport& viewport)
{
KRNode::preStream(viewport);
// Pre-stream sprites, even if the alpha is zero
m_spriteTexture.load(&getContext());
if (m_spriteTexture.isLoaded()) {
m_spriteTexture.get()->resetPoolExpiry(0.0f, KRTexture::TEXTURE_USAGE_SPRITE);
}
}
void KRSprite::render(RenderInfo& ri)
{
if (m_lod_visible >= LOD_VISIBILITY_PRESTREAM && ri.renderPass->getType() == RenderPassType::RENDER_PASS_PRESTREAM) {
// Pre-stream sprites, even if the alpha is zero
m_spriteTexture.load(&getContext());
if (m_spriteTexture.isLoaded()) {
m_spriteTexture.get()->resetPoolExpiry(0.0f, KRTexture::TEXTURE_USAGE_SPRITE);
}
}
if (m_lod_visible <= LOD_VISIBILITY_PRESTREAM) return;
ri.reflectedObjects.push_back(this);
KRNode::render(ri);
if (ri.renderPass->getType() == RenderPassType::RENDER_PASS_ADDITIVE_PARTICLES) {
if (m_spriteAlpha > 0.0f) {
if (m_spriteTexture.isLoaded()) {