36 get_num_geoms()
const {
37 CDReader cdata(_cycler);
38 return cdata->get_geoms()->size();
48 get_geom(
int n)
const {
49 CDReader cdata(_cycler);
50 CPT(GeomList) geoms = cdata->get_geoms();
51 nassertr(n >= 0 && n < (
int)geoms->size(),
nullptr);
52 return (*geoms)[n]._geom.get_read_pointer();
67 INLINE PT(
Geom) GeomNode::
69 CDWriter cdata(_cycler,
true);
70 PT(GeomList) geoms = cdata->modify_geoms();
71 nassertr(n >= 0 && n < (
int)geoms->size(),
nullptr);
72 mark_internal_bounds_stale();
73 return (*geoms)[n]._geom.get_write_pointer();
84 CDReader cdata(_cycler);
85 CPT(GeomList) geoms = cdata->get_geoms();
86 nassertr(n >= 0 && n < (
int)geoms->size(),
nullptr);
87 return (*geoms)[n]._state;
104 PT(
GeomList) geoms = cdata->modify_geoms();
105 nassertv(n >= 0 && n < (
int)geoms->size());
106 (*geoms)[n]._state = state;
115 PT(
GeomList) geoms = cdata->modify_geoms();
116 nassertv(n >= 0 && n < (
int)geoms->size());
118 geoms->erase(geoms->begin() + n);
119 mark_internal_bounds_stale();
129 mark_internal_bounds_stale();
136 get_default_collide_mask() {
137 return default_geom_node_collide_mask;
143 INLINE
void GeomNode::
145 std::pair<NameCount::iterator, bool> result =
146 name_count.insert(NameCount::value_type(name, 1));
147 if (!result.second) {
148 (*result.first).second++;
155 INLINE
int GeomNode::
157 NameCount::const_iterator ni;
158 ni = name_count.find(name);
159 if (ni != name_count.end()) {
178 CDReader cdata(_cycler, current_thread);
185 INLINE GeomNode::GeomEntry::
195 INLINE GeomNode::CData::
206 return _geoms.get_read_pointer();
214 return _geoms.get_write_pointer();
220 INLINE
void GeomNode::CData::
228 INLINE GeomNode::Geoms::
235 INLINE GeomNode::Geoms::
236 Geoms(
const GeomNode::CData *cdata) :
244 INLINE GeomNode::Geoms::
253 INLINE
void GeomNode::Geoms::
255 _geoms = copy._geoms;
261 INLINE GeomNode::Geoms::
263 _geoms(std::move(from._geoms))
270 INLINE
void GeomNode::Geoms::
272 _geoms = std::move(from._geoms);
280 nassertr(!_geoms.is_null(), 0);
281 return _geoms->size();
288 INLINE
CPT(
Geom) GeomNode::Geoms::
289 get_geom(
int n)
const {
290 nassertr(!_geoms.is_null(),
nullptr);
291 nassertr(n >= 0 && n < (
int)_geoms->size(),
nullptr);
292 return (*_geoms)[n]._geom.get_read_pointer();
302 get_geom_state(
int n)
const {
303 nassertr(!_geoms.is_null(),
nullptr);
304 nassertr(n >= 0 && n < (
int)_geoms->size(),
nullptr);
305 return (*_geoms)[n]._state;
get_geom_state
Returns the RenderState associated with the nth geom of the node.
This is our own Panda specialization on the default STL map.
int get_num_geoms() const
Returns the number of geoms of the node.
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
bool get_preserved() const
Returns the "preserved" flag.
void remove_geom(int n)
Removes the nth geom from the node.
A container for geometry primitives.
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
CPT(Geom) GeomNode
Returns the nth geom of the node.
Encodes a string name in a hash table, mapping it to a pointer.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
A thread; that is, a lightweight process.
This is similar to RefCountObj, but it implements a CopyOnWriteObject inheritance instead of a Refere...
Geoms get_geoms(Thread *current_thread=Thread::get_current_thread()) const
Returns an object that can be used to walk through the list of geoms of the node.
void set_geom_state(int n, const RenderState *state)
Changes the RenderState associated with the nth geom of the node.
A node that holds Geom objects, renderable pieces of geometry.
void set_preserved(bool value)
Sets the "preserved" flag.
void remove_all_geoms()
Removes all the geoms from the node at once.