Panda3D
eggVertexPool.I
1 // Filename: eggVertexPool.I
2 // Created by: drose (16Jan99)
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: EggVertexPool::has_vertex
18 // Access: Public
19 // Description: Returns true if the indicated vertex has been defined
20 // in the vertex pool, false otherwise. This does not
21 // include forward references.
22 ////////////////////////////////////////////////////////////////////
23 INLINE bool EggVertexPool::
24 has_vertex(int index) const {
25  return get_vertex(index) != (EggVertex *)NULL;
26 }
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function: EggVertexPool::indexing operator
30 // Access: Public
31 // Description: Returns the vertex in the pool with the indicated
32 // index number, or NULL if no vertices have that index
33 // number.
34 ////////////////////////////////////////////////////////////////////
36 operator [](int index) const {
37  return get_vertex(index);
38 }
39 
40 ////////////////////////////////////////////////////////////////////
41 // Function: EggVertexPool::make_new_vertex()
42 // Access: Public
43 // Description: Allocates and returns a new vertex from the pool.
44 // This is one of three ways to add new vertices to a
45 // vertex pool.
46 ////////////////////////////////////////////////////////////////////
49  PT(EggVertex) vertex = new EggVertex;
50  return add_vertex(vertex);
51 }
52 
53 ////////////////////////////////////////////////////////////////////
54 // Function: EggVertexPool::make_new_vertex()
55 // Access: Public
56 // Description: Allocates and returns a new vertex from the pool.
57 // This is one of three ways to add new vertices to a
58 // vertex pool.
59 //
60 // This flavor of make_new_vertex() explicitly sets the
61 // vertex position as it is allocated. It does not
62 // attempt to share vertices.
63 ////////////////////////////////////////////////////////////////////
65 make_new_vertex(double pos) {
66  EggVertex *vertex = make_new_vertex();
67  vertex->set_pos(pos);
68  return vertex;
69 }
70 
71 ////////////////////////////////////////////////////////////////////
72 // Function: EggVertexPool::make_new_vertex()
73 // Access: Public
74 // Description: Allocates and returns a new vertex from the pool.
75 // This is one of three ways to add new vertices to a
76 // vertex pool.
77 //
78 // This flavor of make_new_vertex() explicitly sets the
79 // vertex position as it is allocated. It does not
80 // attempt to share vertices.
81 ////////////////////////////////////////////////////////////////////
84  EggVertex *vertex = make_new_vertex();
85  vertex->set_pos(pos);
86  return vertex;
87 }
88 
89 ////////////////////////////////////////////////////////////////////
90 // Function: EggVertexPool::make_new_vertex()
91 // Access: Public
92 // Description: Allocates and returns a new vertex from the pool.
93 // This is one of three ways to add new vertices to a
94 // vertex pool.
95 //
96 // This flavor of make_new_vertex() explicitly sets the
97 // vertex position as it is allocated. It does not
98 // attempt to share vertices.
99 ////////////////////////////////////////////////////////////////////
102  EggVertex *vertex = make_new_vertex();
103  vertex->set_pos(pos);
104  return vertex;
105 }
106 
107 ////////////////////////////////////////////////////////////////////
108 // Function: EggVertexPool::make_new_vertex()
109 // Access: Public
110 // Description: Allocates and returns a new vertex from the pool.
111 // This is one of three ways to add new vertices to a
112 // vertex pool.
113 //
114 // This flavor of make_new_vertex() explicitly sets the
115 // vertex position as it is allocated. It does not
116 // attempt to share vertices.
117 ////////////////////////////////////////////////////////////////////
120  EggVertex *vertex = make_new_vertex();
121  vertex->set_pos(pos);
122  return vertex;
123 }
bool has_vertex(int index) const
Returns true if the indicated vertex has been defined in the vertex pool, false otherwise.
Definition: eggVertexPool.I:24
EggVertex * add_vertex(EggVertex *vertex, int index=-1)
Adds the indicated vertex to the pool.
void set_pos(double pos)
Sets the vertex position.
Definition: eggVertex.I:54
This is a four-component point in space.
Definition: lpoint4.h:457
EggVertex * get_vertex(int index) const
Returns the vertex in the pool with the indicated index number, or NULL if no vertices have that inde...
This is a two-component point in space.
Definition: lpoint2.h:424
EggVertex * make_new_vertex()
Allocates and returns a new vertex from the pool.
Definition: eggVertexPool.I:48
EggVertex * operator[](int index) const
Returns the vertex in the pool with the indicated index number, or NULL if no vertices have that inde...
Definition: eggVertexPool.I:36
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal...
Definition: eggVertex.h:41
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:544