From 39fc3b21ee23ff6b10cce77610801ad22d29b4fa Mon Sep 17 00:00:00 2001 From: Kearwood Gilbert Date: Wed, 9 Apr 2014 22:15:29 -0700 Subject: [PATCH] New texture streaming algorithm in progress --HG-- branch : nfb --- KREngine/kraken/KRTextureManager.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/KREngine/kraken/KRTextureManager.cpp b/KREngine/kraken/KRTextureManager.cpp index a250e40..878d254 100644 --- a/KREngine/kraken/KRTextureManager.cpp +++ b/KREngine/kraken/KRTextureManager.cpp @@ -266,6 +266,21 @@ void KRTextureManager::balanceTextureMemory() // Balance texture memory by reducing and increasing the maximum mip-map level of both active and inactive textures // Favour performance over maximum texture resolution when memory is insufficient for textures at full resolution. + /* + NEW ALGORITHM: + + The “fixed” textures will be assigned to the skybox and the animated character flares + The rest of the textures are assigned a “weight” by tuneable criteria: + - Area of screen coverage taken by objects containing material (more accurate and generic than distance) + - Type of texture (separate weight for normal, diffuse, spec maps) + - Last used time (to keep textures loaded for recently seen objects that are outside of the view frustum) + Those factors combine together to give a “weight”, which represents a proportion relative to all other textures weights + Mipmap levels are stripped off of each texture until they occupy the amount of memory they should proportionally have + This is in contrast to the global ceiling of texture resolution that slowly drops until the textures fit + + */ + + // Determine the additional amount of memory required in order to resize all active textures to the maximum size long wantedTextureMem = 0; for(std::set::iterator itr=m_activeTextures_streamer.begin(); itr != m_activeTextures_streamer.end(); itr++) {