Implemented pre-streaming of textures for KRSprite objects

This commit is contained in:
2014-06-06 00:46:40 -07:00
parent d067ddda5f
commit 2e169eeb9a

View File

@@ -85,6 +85,19 @@ KRAABB KRSprite::getBounds() {
void KRSprite::render(KRCamera *pCamera, std::vector<KRPointLight *> &point_lights, std::vector<KRDirectionalLight *> &directional_lights, std::vector<KRSpotLight *>&spot_lights, const KRViewport &viewport, KRNode::RenderPass renderPass) { void KRSprite::render(KRCamera *pCamera, std::vector<KRPointLight *> &point_lights, std::vector<KRDirectionalLight *> &directional_lights, std::vector<KRSpotLight *>&spot_lights, const KRViewport &viewport, KRNode::RenderPass renderPass) {
if(m_lod_visible >= LOD_VISIBILITY_PRESTREAM && renderPass == KRNode::RENDER_PASS_PRESTREAM) {
// Pre-stream sprites, even if the alpha is zero
if(m_spriteTexture.size() && m_pSpriteTexture == NULL) {
if(!m_pSpriteTexture && m_spriteTexture.size()) {
m_pSpriteTexture = getContext().getTextureManager()->getTexture(m_spriteTexture);
}
}
if(m_pSpriteTexture) {
m_pSpriteTexture->resetPoolExpiry(0.0f, KRTexture::TEXTURE_USAGE_SPRITE);
}
}
if(m_lod_visible <= LOD_VISIBILITY_PRESTREAM) return; if(m_lod_visible <= LOD_VISIBILITY_PRESTREAM) return;
KRNode::render(pCamera, point_lights, directional_lights, spot_lights, viewport, renderPass); KRNode::render(pCamera, point_lights, directional_lights, spot_lights, viewport, renderPass);