Panda3D

textureStagePool.I

00001 // Filename: textureStagePool.I
00002 // Created by:  drose (03May10)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: TextureStagePool::get_stage
00018 //       Access: Public, Static
00019 //  Description: Returns a TextureStage pointer that represents the
00020 //               same TextureStage described by temp, except that it is a
00021 //               shared pointer.
00022 //
00023 //               Each call to get_stage() passing an equivalent
00024 //               TextureStage pointer will return the same shared pointer.
00025 //
00026 //               If you modify the shared pointer, it will
00027 //               automatically disassociate it from the pool.
00028 //
00029 //               Also, the return value may be a different pointer
00030 //               than that passed in, or it may be the same pointer.
00031 //               In either case, the passed in pointer has now been
00032 //               sacrificed to the greater good and should not be used
00033 //               again (like any other PointerTo, it will be freed
00034 //               when the last reference count is removed).
00035 ////////////////////////////////////////////////////////////////////
00036 INLINE TextureStage *TextureStagePool::
00037 get_stage(TextureStage *temp) {
00038   return get_global_ptr()->ns_get_stage(temp);
00039 }
00040 
00041 ////////////////////////////////////////////////////////////////////
00042 //     Function: TextureStagePool::release_stage
00043 //       Access: Published, Static
00044 //  Description: Removes the indicated TextureStage from the pool.
00045 ////////////////////////////////////////////////////////////////////
00046 INLINE void TextureStagePool::
00047 release_stage(TextureStage *stage) {
00048   get_global_ptr()->ns_release_stage(stage);
00049 }
00050 
00051 ////////////////////////////////////////////////////////////////////
00052 //     Function: TextureStagePool::release_all_stages
00053 //       Access: Published, Static
00054 //  Description: Releases all TextureStages in the pool and restores the
00055 //               pool to the empty state.
00056 ////////////////////////////////////////////////////////////////////
00057 INLINE void TextureStagePool::
00058 release_all_stages() {
00059   get_global_ptr()->ns_release_all_stages();
00060 }
00061 
00062 ////////////////////////////////////////////////////////////////////
00063 //     Function: TextureStagePool::set_mode
00064 //       Access: Published, Static
00065 //  Description: Specifies the fundamental operating mode of the
00066 //               TextureStagePool.
00067 //
00068 //               If this is M_none, each call to get_stage() returns
00069 //               the same TextureStage pointer that was passed in (the
00070 //               pool is effectively disabled).  If this is M_name,
00071 //               each call to get_stage() returns the last
00072 //               TextureStage passed in with the same name, whether it
00073 //               has different properties or not.  If this is
00074 //               M_unique, then each call to get_stage() returns only
00075 //               TextureStages with identical properties.
00076 ////////////////////////////////////////////////////////////////////
00077 INLINE void TextureStagePool::
00078 set_mode(TextureStagePool::Mode mode) {
00079   get_global_ptr()->ns_set_mode(mode);
00080 }
00081 
00082 ////////////////////////////////////////////////////////////////////
00083 //     Function: TextureStagePool::get_mode
00084 //       Access: Published, Static
00085 //  Description: Returns the fundamental operating mode of the
00086 //               TextureStagePool.  See set_mode().
00087 ////////////////////////////////////////////////////////////////////
00088 INLINE TextureStagePool::Mode TextureStagePool::
00089 get_mode() {
00090   return get_global_ptr()->ns_get_mode();
00091 }
00092 
00093 ////////////////////////////////////////////////////////////////////
00094 //     Function: TextureStagePool::garbage_collect
00095 //       Access: Public, Static
00096 //  Description: Releases only those TextureStages in the pool that have a
00097 //               reference count of exactly 1; i.e. only those
00098 //               TextureStages that are not being used outside of the pool.
00099 //               Returns the number of TextureStages released.
00100 ////////////////////////////////////////////////////////////////////
00101 INLINE int TextureStagePool::
00102 garbage_collect() {
00103   return get_global_ptr()->ns_garbage_collect();
00104 }
00105 
00106 ////////////////////////////////////////////////////////////////////
00107 //     Function: TextureStagePool::list_contents
00108 //       Access: Public, Static
00109 //  Description: Lists the contents of the TextureStage pool to the
00110 //               indicated output stream.
00111 ////////////////////////////////////////////////////////////////////
00112 INLINE void TextureStagePool::
00113 list_contents(ostream &out) {
00114   get_global_ptr()->ns_list_contents(out);
00115 }
 All Classes Functions Variables Enumerations