00001 // Filename: eggVertexPool.I 00002 // Created by: drose (16Jan99) 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: EggVertexPool::has_vertex 00018 // Access: Public 00019 // Description: Returns true if the indicated vertex has been defined 00020 // in the vertex pool, false otherwise. This does not 00021 // include forward references. 00022 //////////////////////////////////////////////////////////////////// 00023 INLINE bool EggVertexPool:: 00024 has_vertex(int index) const { 00025 return get_vertex(index) != (EggVertex *)NULL; 00026 } 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Function: EggVertexPool::indexing operator 00030 // Access: Public 00031 // Description: Returns the vertex in the pool with the indicated 00032 // index number, or NULL if no vertices have that index 00033 // number. 00034 //////////////////////////////////////////////////////////////////// 00035 INLINE EggVertex *EggVertexPool:: 00036 operator [](int index) const { 00037 return get_vertex(index); 00038 } 00039 00040 //////////////////////////////////////////////////////////////////// 00041 // Function: EggVertexPool::make_new_vertex() 00042 // Access: Public 00043 // Description: Allocates and returns a new vertex from the pool. 00044 // This is one of three ways to add new vertices to a 00045 // vertex pool. 00046 //////////////////////////////////////////////////////////////////// 00047 INLINE EggVertex *EggVertexPool:: 00048 make_new_vertex() { 00049 PT(EggVertex) vertex = new EggVertex; 00050 return add_vertex(vertex); 00051 } 00052 00053 //////////////////////////////////////////////////////////////////// 00054 // Function: EggVertexPool::make_new_vertex() 00055 // Access: Public 00056 // Description: Allocates and returns a new vertex from the pool. 00057 // This is one of three ways to add new vertices to a 00058 // vertex pool. 00059 // 00060 // This flavor of make_new_vertex() explicitly sets the 00061 // vertex position as it is allocated. It does not 00062 // attempt to share vertices. 00063 //////////////////////////////////////////////////////////////////// 00064 INLINE EggVertex *EggVertexPool:: 00065 make_new_vertex(double pos) { 00066 EggVertex *vertex = make_new_vertex(); 00067 vertex->set_pos(pos); 00068 return vertex; 00069 } 00070 00071 //////////////////////////////////////////////////////////////////// 00072 // Function: EggVertexPool::make_new_vertex() 00073 // Access: Public 00074 // Description: Allocates and returns a new vertex from the pool. 00075 // This is one of three ways to add new vertices to a 00076 // vertex pool. 00077 // 00078 // This flavor of make_new_vertex() explicitly sets the 00079 // vertex position as it is allocated. It does not 00080 // attempt to share vertices. 00081 //////////////////////////////////////////////////////////////////// 00082 INLINE EggVertex *EggVertexPool:: 00083 make_new_vertex(const LPoint2d &pos) { 00084 EggVertex *vertex = make_new_vertex(); 00085 vertex->set_pos(pos); 00086 return vertex; 00087 } 00088 00089 //////////////////////////////////////////////////////////////////// 00090 // Function: EggVertexPool::make_new_vertex() 00091 // Access: Public 00092 // Description: Allocates and returns a new vertex from the pool. 00093 // This is one of three ways to add new vertices to a 00094 // vertex pool. 00095 // 00096 // This flavor of make_new_vertex() explicitly sets the 00097 // vertex position as it is allocated. It does not 00098 // attempt to share vertices. 00099 //////////////////////////////////////////////////////////////////// 00100 INLINE EggVertex *EggVertexPool:: 00101 make_new_vertex(const LPoint3d &pos) { 00102 EggVertex *vertex = make_new_vertex(); 00103 vertex->set_pos(pos); 00104 return vertex; 00105 } 00106 00107 //////////////////////////////////////////////////////////////////// 00108 // Function: EggVertexPool::make_new_vertex() 00109 // Access: Public 00110 // Description: Allocates and returns a new vertex from the pool. 00111 // This is one of three ways to add new vertices to a 00112 // vertex pool. 00113 // 00114 // This flavor of make_new_vertex() explicitly sets the 00115 // vertex position as it is allocated. It does not 00116 // attempt to share vertices. 00117 //////////////////////////////////////////////////////////////////// 00118 INLINE EggVertex *EggVertexPool:: 00119 make_new_vertex(const LPoint4d &pos) { 00120 EggVertex *vertex = make_new_vertex(); 00121 vertex->set_pos(pos); 00122 return vertex; 00123 }