Panda3D
textureStagePool.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file textureStagePool.I
10  * @author drose
11  * @date 2010-05-03
12  */
13 
14 /**
15  * Returns a TextureStage pointer that represents the same TextureStage
16  * described by temp, except that it is a shared pointer.
17  *
18  * Each call to get_stage() passing an equivalent TextureStage pointer will
19  * return the same shared pointer.
20  *
21  * If you modify the shared pointer, it will automatically disassociate it
22  * from the pool.
23  *
24  * Also, the return value may be a different pointer than that passed in, or
25  * it may be the same pointer. In either case, the passed in pointer has now
26  * been sacrificed to the greater good and should not be used again (like any
27  * other PointerTo, it will be freed when the last reference count is
28  * removed).
29  */
32  return get_global_ptr()->ns_get_stage(temp);
33 }
34 
35 /**
36  * Removes the indicated TextureStage from the pool.
37  */
38 INLINE void TextureStagePool::
40  get_global_ptr()->ns_release_stage(stage);
41 }
42 
43 /**
44  * Releases all TextureStages in the pool and restores the pool to the empty
45  * state.
46  */
47 INLINE void TextureStagePool::
49  get_global_ptr()->ns_release_all_stages();
50 }
51 
52 /**
53  * Specifies the fundamental operating mode of the TextureStagePool.
54  *
55  * If this is M_none, each call to get_stage() returns the same TextureStage
56  * pointer that was passed in (the pool is effectively disabled). If this is
57  * M_name, each call to get_stage() returns the last TextureStage passed in
58  * with the same name, whether it has different properties or not. If this is
59  * M_unique, then each call to get_stage() returns only TextureStages with
60  * identical properties.
61  */
62 INLINE void TextureStagePool::
63 set_mode(TextureStagePool::Mode mode) {
64  get_global_ptr()->ns_set_mode(mode);
65 }
66 
67 /**
68  * Returns the fundamental operating mode of the TextureStagePool. See
69  * set_mode().
70  */
71 INLINE TextureStagePool::Mode TextureStagePool::
72 get_mode() {
73  return get_global_ptr()->ns_get_mode();
74 }
75 
76 /**
77  * Releases only those TextureStages in the pool that have a reference count
78  * of exactly 1; i.e. only those TextureStages that are not being used
79  * outside of the pool. Returns the number of TextureStages released.
80  */
81 INLINE int TextureStagePool::
83  return get_global_ptr()->ns_garbage_collect();
84 }
85 
86 /**
87  * Lists the contents of the TextureStage pool to the indicated output stream.
88  */
89 INLINE void TextureStagePool::
90 list_contents(std::ostream &out) {
91  get_global_ptr()->ns_list_contents(out);
92 }
set_mode
Specifies the fundamental operating mode of the TextureStagePool.
static int garbage_collect()
Releases only those TextureStages in the pool that have a reference count of exactly 1; i....
static void release_stage(TextureStage *temp)
Removes the indicated TextureStage from the pool.
static void list_contents(std::ostream &out)
Lists the contents of the TextureStage pool to the indicated output stream.
Defines the properties of a named stage of the multitexture pipeline.
Definition: textureStage.h:35
static TextureStage * get_stage(TextureStage *temp)
Returns a TextureStage pointer that represents the same TextureStage described by temp,...
static void release_all_stages()
Releases all TextureStages in the pool and restores the pool to the empty state.