added IUnknown::getReferenceCount and IMeshCache::clearUnusedMeshes to flush unused meshes from the mesh cache.
Fixed CGUIModalScreen, which I broke with the IGUIElement changes. Also fixed a small bug with the tooltip appearing directly under the mouse cursor. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@760 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
9bd033b0a1
commit
64ea350e23
|
@ -1,5 +1,11 @@
|
|||
Changes in version 1.4 (... 2007)
|
||||
|
||||
- Added IMeshCache::clearUnusedMeshes(). This allows the user to remove
|
||||
meshes that are sitting in the mesh cache but aren't used by any scene nodes.
|
||||
This is useful for example when changing levels.
|
||||
|
||||
- Added IUnknown::getReferenceCount()
|
||||
|
||||
- createDevice now reports errors if the driverType is unknown, previously it
|
||||
created a window but populated it with a null driver without any warning.
|
||||
|
||||
|
|
|
@ -112,8 +112,15 @@ namespace scene
|
|||
|
||||
//! Clears the whole mesh cache, removing all meshes.
|
||||
/** All meshes will be reloaded completely when using ISceneManager::getMesh()
|
||||
after calling this method. */
|
||||
after calling this method.
|
||||
Warning: If you have pointers to meshes that were loaded with ISceneManager::getMesh()
|
||||
and you did not grab them, then they may become invalid. */
|
||||
virtual void clear() = 0;
|
||||
|
||||
//! Clears all meshes that are held in the mesh cache but not used anywhere else.
|
||||
/** Warning: If you have pointers to meshes that were loaded with ISceneManager::getMesh()
|
||||
and you did not grab them, then they may become invalid. */
|
||||
virtual void clearUnusedMeshes() = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -123,13 +123,19 @@ namespace irr
|
|||
return false;
|
||||
}
|
||||
|
||||
//! Returns the reference counter.
|
||||
s32 getReferenceCount() const
|
||||
{
|
||||
return ReferenceCounter;
|
||||
}
|
||||
|
||||
//! Returns the debug name of the object. The Debugname may only be set and
|
||||
//! changed by the object itself. This method should only be used in Debug mode.
|
||||
//! \return Returns a string, previously set by setDebugName();
|
||||
const c8* getDebugName() const
|
||||
{
|
||||
return DebugName;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -328,7 +328,7 @@ void CGUIEnvironment::OnPostRender( u32 time )
|
|||
dim.Width += getSkin()->getSize(EGDS_TEXT_DISTANCE_X)*2;
|
||||
dim.Height += getSkin()->getSize(EGDS_TEXT_DISTANCE_Y)*2;
|
||||
|
||||
pos.UpperLeftCorner.Y -= dim.Height-1;
|
||||
pos.UpperLeftCorner.Y -= dim.Height+1;
|
||||
pos.LowerRightCorner.Y = pos.UpperLeftCorner.Y + dim.Height-1;
|
||||
pos.LowerRightCorner.X = pos.UpperLeftCorner.X + dim.Width;
|
||||
|
||||
|
|
|
@ -43,6 +43,9 @@ bool CGUIModalScreen::OnEvent(SEvent event)
|
|||
MouseDownTime = os::Timer::getTime();
|
||||
}
|
||||
}
|
||||
|
||||
if (Parent)
|
||||
Parent->OnEvent(event);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -219,6 +219,21 @@ void CMeshCache::clear()
|
|||
Meshes.clear();
|
||||
}
|
||||
|
||||
//! Clears all meshes that are held in the mesh cache but not used anywhere else.
|
||||
void CMeshCache::clearUnusedMeshes()
|
||||
{
|
||||
for (u32 i=0; i<Meshes.size(); ++i)
|
||||
{
|
||||
if (Meshes[i].Mesh->getReferenceCount() == 1)
|
||||
{
|
||||
Meshes[i].Mesh->drop();
|
||||
Meshes.erase(i);
|
||||
--i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // end namespace scene
|
||||
} // end namespace irr
|
||||
|
||||
|
|
|
@ -92,6 +92,9 @@ namespace scene
|
|||
//! Clears the whole mesh cache, removing all meshes.
|
||||
virtual void clear();
|
||||
|
||||
//! Clears all meshes that are held in the mesh cache but not used anywhere else.
|
||||
virtual void clearUnusedMeshes();
|
||||
|
||||
protected:
|
||||
|
||||
struct MeshEntry
|
||||
|
|
Loading…
Reference in New Issue