Isle
Loading...
Searching...
No Matches
LegoTextureContainer Class Reference

Specialized LegoContainer handling LegoTextureInfo objects and their DirectDraw/Direct3D caching. More...

#include <legocontainer.h>

Inheritance diagram for LegoTextureContainer:
Collaboration diagram for LegoTextureContainer:

Public Member Functions

 ~LegoTextureContainer () override
 Destructor. More...
 
LegoTextureInfoGetCached (LegoTextureInfo *p_textureInfo)
 Attempt to find and return a cached LegoTextureInfo with the same properties as p_textureInfo, or create and cache a new one if not found. More...
 
void EraseCached (LegoTextureInfo *p_textureInfo)
 Mark a cached texture as unused and release its Direct3D/DirectDraw resources if its reference count reaches zero. More...
 
- Public Member Functions inherited from LegoContainer< LegoTextureInfo >
 LegoContainer ()
 Default constructor, sets this container to own its elements. More...
 
virtual ~LegoContainer ()
 Destructor. More...
 
void Clear ()
 Remove and delete all mapped objects; preserves key strings. More...
 
LegoTextureInfoGet (const char *p_name)
 Retrieve the element mapped to the given name, or nullptr if missing. More...
 
void Add (const char *p_name, LegoTextureInfo *p_value)
 Add an element mapped to the given name, replacing existing item if present. More...
 
void SetOwnership (LegoBool p_ownership)
 Set whether this container owns/deletes its objects (and name strings) on removal/destruction. More...
 

Protected Attributes

LegoCachedTextureList m_cached
 List of cached temporary texture objects, pairing texture info with a cache/in-use flag. [AI]. More...
 
- Protected Attributes inherited from LegoContainer< LegoTextureInfo >
LegoBool m_ownership
 If TRUE, container owns objects and keys; else no cleanup on destruction. [AI]. More...
 
LegoContainerInfo< LegoTextureInfom_map
 Underlying map from name strings to objects. [AI]. More...
 

Detailed Description

Specialized LegoContainer handling LegoTextureInfo objects and their DirectDraw/Direct3D caching.

[AI]

[AI] In addition to basic named texture management, supports tracking and sharing temporary DirectDraw/Direct3D textures, avoiding redundant texture loads and managing texture resources efficiently. [AI] @inherits LegoContainer<LegoTextureInfo> [AI]

Definition at line 169 of file legocontainer.h.

Constructor & Destructor Documentation

◆ ~LegoTextureContainer()

LegoTextureContainer::~LegoTextureContainer ( )
override

Destructor.

Cleans up all cached textures as well as the standard container cleanup. [AI]

[AI] Ensures that texture resources in m_cached are released. [AI]

Definition at line 13 of file legocontainer.cpp.

Member Function Documentation

◆ EraseCached()

void LegoTextureContainer::EraseCached ( LegoTextureInfo p_textureInfo)

Mark a cached texture as unused and release its Direct3D/DirectDraw resources if its reference count reaches zero.

[AI]

Parameters
p_textureInfoThe texture to erase from the cache. [AI]

[AI] Sets the cached/freed flag to FALSE and erases the texture from cache if its ref count is now 0, cleaning up its resources. [AI]

Definition at line 115 of file legocontainer.cpp.

◆ GetCached()

LegoTextureInfo * LegoTextureContainer::GetCached ( LegoTextureInfo p_textureInfo)

Attempt to find and return a cached LegoTextureInfo with the same properties as p_textureInfo, or create and cache a new one if not found.

[AI]

Parameters
p_textureInfoThe reference texture to match or duplicate. [AI]
Returns
Pointer to a cached (shared or newly-created) LegoTextureInfo, or nullptr if creation fails. [AI]

[AI] Tries to match any existing cached texture of the same name and size; if none, duplicates the DirectDraw surface and texture for sharing. [AI]

Definition at line 18 of file legocontainer.cpp.

Member Data Documentation

◆ m_cached

LegoCachedTextureList LegoTextureContainer::m_cached
protected

List of cached temporary texture objects, pairing texture info with a cache/in-use flag. [AI].

Definition at line 193 of file legocontainer.h.


The documentation for this class was generated from the following files: