Panda3D
|
00001 // Filename: modelRoot.I 00002 // Created by: drose (16Mar02) 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: ModelRoot::Constructor 00018 // Access: Published 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE ModelRoot:: 00022 ModelRoot(const string &name) : 00023 ModelNode(name), 00024 _fullpath(name), 00025 _reference(new ModelRoot::ModelReference) 00026 { 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function: ModelRoot::get_model_ref_count 00031 // Access: Published 00032 // Description: Returns the number of copies that exist of this 00033 // particular ModelRoot node. Each time 00034 // ModelRoot::copy_subgraph() or make_copy() is called 00035 // (or some other copying mechanism, such as 00036 // NodePath.copy_to(), is used), this count will 00037 // increment by one in all copies; when one of the 00038 // copies is destructed, this count will decrement. 00039 //////////////////////////////////////////////////////////////////// 00040 INLINE int ModelRoot:: 00041 get_model_ref_count() const { 00042 return _reference->get_ref_count(); 00043 } 00044 00045 //////////////////////////////////////////////////////////////////// 00046 // Function: ModelRoot::get_fullpath 00047 // Access: Published 00048 // Description: Returns the full pathname of the model represented by 00049 // this node, as found on disk. This is mainly useful 00050 // for reference purposes, but is also used to index the 00051 // ModelRoot into the ModelPool. 00052 //////////////////////////////////////////////////////////////////// 00053 INLINE const Filename &ModelRoot:: 00054 get_fullpath() const { 00055 return _fullpath; 00056 } 00057 00058 //////////////////////////////////////////////////////////////////// 00059 // Function: ModelRoot::set_fullpath 00060 // Access: Published 00061 // Description: Sets the full pathname of the model represented by 00062 // this node, as found on disk. This is mainly useful 00063 // for reference purposes, but is also used to index the 00064 // ModelRoot into the ModelPool. 00065 // 00066 // This is normally set automatically when a model is 00067 // loaded, and should not be set directly by the user. 00068 // If you change this on a loaded model, then 00069 // ModelPool::release_model() may fail. 00070 //////////////////////////////////////////////////////////////////// 00071 INLINE void ModelRoot:: 00072 set_fullpath(const Filename &fullpath) { 00073 _fullpath = fullpath; 00074 } 00075 00076 //////////////////////////////////////////////////////////////////// 00077 // Function: ModelRoot::get_reference 00078 // Access: Published 00079 // Description: Returns the pointer that represents the object shared 00080 // between all copies of this ModelRoot. Since there's 00081 // not much associated with this object other than a 00082 // reference count, normally there's not much reason to 00083 // get the pointer (though it may be compared 00084 // pointerwise with other ModelRoot objects). 00085 //////////////////////////////////////////////////////////////////// 00086 INLINE ModelRoot::ModelReference *ModelRoot:: 00087 get_reference() const { 00088 return _reference; 00089 } 00090 00091 //////////////////////////////////////////////////////////////////// 00092 // Function: ModelRoot::set_reference 00093 // Access: Published 00094 // Description: Changes the pointer that represents the object shared 00095 // between all copies of this ModelRoot. This will 00096 // disassociate this ModelRoot from all of its copies. 00097 // Normally, there's no reason to do this. 00098 //////////////////////////////////////////////////////////////////// 00099 INLINE void ModelRoot:: 00100 set_reference(ModelRoot::ModelReference *ref) { 00101 _reference = ref; 00102 } 00103 00104 //////////////////////////////////////////////////////////////////// 00105 // Function: ModelRoot::Copy Constructor 00106 // Access: Protected 00107 // Description: 00108 //////////////////////////////////////////////////////////////////// 00109 INLINE ModelRoot:: 00110 ModelRoot(const ModelRoot ©) : 00111 ModelNode(copy), 00112 _fullpath(copy._fullpath), 00113 _reference(copy._reference) 00114 { 00115 } 00116 00117 //////////////////////////////////////////////////////////////////// 00118 // Function: ModelRoot::ModelReference::Constructor 00119 // Access: Published 00120 // Description: 00121 //////////////////////////////////////////////////////////////////// 00122 INLINE ModelRoot::ModelReference:: 00123 ModelReference() { 00124 }