Panda3D
Public Types | Static Public Member Functions

TextureStagePool Class Reference

The TextureStagePool (there is only one in the universe) serves to unify different pointers to the same TextureStage, mainly to help developers use a common pointer to access things that are loaded from different model files. More...

#include "textureStagePool.h"

List of all members.

Public Types

enum  Mode { M_none, M_name, M_unique }

Static Public Member Functions

static int garbage_collect ()
 Releases only those TextureStages in the pool that have a reference count of exactly 1; i.e.
static Mode get_mode ()
 Returns the fundamental operating mode of the TextureStagePool.
static TextureStageget_stage (TextureStage *temp)
 Returns a TextureStage pointer that represents the same TextureStage described by temp, except that it is a shared pointer.
static void list_contents (ostream &out)
 Lists the contents of the TextureStage pool to the indicated output stream.
static void release_all_stages ()
 Releases all TextureStages in the pool and restores the pool to the empty state.
static void release_stage (TextureStage *temp)
 Removes the indicated TextureStage from the pool.
static void set_mode (Mode mode)
 Specifies the fundamental operating mode of the TextureStagePool.
static void write (ostream &out)
 Lists the contents of the TextureStage pool to the indicated output stream.

Detailed Description

The TextureStagePool (there is only one in the universe) serves to unify different pointers to the same TextureStage, mainly to help developers use a common pointer to access things that are loaded from different model files.

It runs in one of three different modes, according to set_mode(). See that method for more information.

Definition at line 35 of file textureStagePool.h.


Member Function Documentation

int TextureStagePool::garbage_collect ( ) [inline, static]

Releases only those TextureStages in the pool that have a reference count of exactly 1; i.e.

only those TextureStages that are not being used outside of the pool. Returns the number of TextureStages released.

Definition at line 102 of file textureStagePool.I.

TextureStagePool::Mode TextureStagePool::get_mode ( ) [inline, static]

Returns the fundamental operating mode of the TextureStagePool.

See set_mode().

Definition at line 89 of file textureStagePool.I.

TextureStage * TextureStagePool::get_stage ( TextureStage temp) [inline, static]

Returns a TextureStage pointer that represents the same TextureStage described by temp, except that it is a shared pointer.

Each call to get_stage() passing an equivalent TextureStage pointer will return the same shared pointer.

If you modify the shared pointer, it will automatically disassociate it from the pool.

Also, the return value may be a different pointer than that passed in, or it may be the same pointer. In either case, the passed in pointer has now been sacrificed to the greater good and should not be used again (like any other PointerTo, it will be freed when the last reference count is removed).

Definition at line 37 of file textureStagePool.I.

Referenced by TextureAttrib::complete_pointers().

void TextureStagePool::list_contents ( ostream &  out) [inline, static]

Lists the contents of the TextureStage pool to the indicated output stream.

Definition at line 113 of file textureStagePool.I.

void TextureStagePool::release_all_stages ( ) [inline, static]

Releases all TextureStages in the pool and restores the pool to the empty state.

Definition at line 58 of file textureStagePool.I.

void TextureStagePool::release_stage ( TextureStage temp) [inline, static]

Removes the indicated TextureStage from the pool.

Definition at line 47 of file textureStagePool.I.

void TextureStagePool::set_mode ( TextureStagePool::Mode  mode) [inline, static]

Specifies the fundamental operating mode of the TextureStagePool.

If this is M_none, each call to get_stage() returns the same TextureStage pointer that was passed in (the pool is effectively disabled). If this is M_name, each call to get_stage() returns the last TextureStage passed in with the same name, whether it has different properties or not. If this is M_unique, then each call to get_stage() returns only TextureStages with identical properties.

Definition at line 78 of file textureStagePool.I.

void TextureStagePool::write ( ostream &  out) [static]

Lists the contents of the TextureStage pool to the indicated output stream.

Definition at line 31 of file textureStagePool.cxx.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations