Panda3D
eggVertexPool.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file eggVertexPool.I
10  * @author drose
11  * @date 1999-01-16
12  */
13 
14 /**
15  * Returns true if the indicated vertex has been defined in the vertex pool,
16  * false otherwise. This does not include forward references.
17  */
18 INLINE bool EggVertexPool::
19 has_vertex(int index) const {
20  return get_vertex(index) != nullptr;
21 }
22 
23 /**
24  * Returns the vertex in the pool with the indicated index number, or NULL if
25  * no vertices have that index number.
26  */
28 operator [](int index) const {
29  return get_vertex(index);
30 }
31 
32 /**
33  * Allocates and returns a new vertex from the pool. This is one of three
34  * ways to add new vertices to a vertex pool.
35  */
38  PT(EggVertex) vertex = new EggVertex;
39  return add_vertex(vertex);
40 }
41 
42 /**
43  * Allocates and returns a new vertex from the pool. This is one of three
44  * ways to add new vertices to a vertex pool.
45  *
46  * This flavor of make_new_vertex() explicitly sets the vertex position as it
47  * is allocated. It does not attempt to share vertices.
48  */
50 make_new_vertex(double pos) {
51  EggVertex *vertex = make_new_vertex();
52  vertex->set_pos(pos);
53  return vertex;
54 }
55 
56 /**
57  * Allocates and returns a new vertex from the pool. This is one of three
58  * ways to add new vertices to a vertex pool.
59  *
60  * This flavor of make_new_vertex() explicitly sets the vertex position as it
61  * is allocated. It does not attempt to share vertices.
62  */
64 make_new_vertex(const LPoint2d &pos) {
65  EggVertex *vertex = make_new_vertex();
66  vertex->set_pos(pos);
67  return vertex;
68 }
69 
70 /**
71  * Allocates and returns a new vertex from the pool. This is one of three
72  * ways to add new vertices to a vertex pool.
73  *
74  * This flavor of make_new_vertex() explicitly sets the vertex position as it
75  * is allocated. It does not attempt to share vertices.
76  */
78 make_new_vertex(const LPoint3d &pos) {
79  EggVertex *vertex = make_new_vertex();
80  vertex->set_pos(pos);
81  return vertex;
82 }
83 
84 /**
85  * Allocates and returns a new vertex from the pool. This is one of three
86  * ways to add new vertices to a vertex pool.
87  *
88  * This flavor of make_new_vertex() explicitly sets the vertex position as it
89  * is allocated. It does not attempt to share vertices.
90  */
92 make_new_vertex(const LPoint4d &pos) {
93  EggVertex *vertex = make_new_vertex();
94  vertex->set_pos(pos);
95  return vertex;
96 }
bool has_vertex(int index) const
Returns true if the indicated vertex has been defined in the vertex pool, false otherwise.
Definition: eggVertexPool.I:19
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:42
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...
EggVertex * make_new_vertex()
Allocates and returns a new vertex from the pool.
Definition: eggVertexPool.I:37
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal.
Definition: eggVertex.h:39
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:28