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