21INLINE Geom::PrimitiveType
Geom::
23 CDReader cdata(_cycler);
24 return cdata->_primitive_type;
31INLINE Geom::ShadeModel
Geom::
33 CDReader cdata(_cycler);
34 return cdata->_shade_model;
43 CDReader cdata(_cycler);
44 return cdata->_geom_rendering;
52get_vertex_data(
Thread *current_thread)
const {
53 CDReader cdata(_cycler, current_thread);
54 return cdata->_data.get_read_pointer(current_thread);
63 CDReader cdata(_cycler);
64 return cdata->_primitives.empty();
72get_num_primitives()
const {
73 CDReader cdata(_cycler);
74 return cdata->_primitives.size();
83get_primitive(
size_t i)
const {
84 CDReader cdata(_cycler);
85 nassertr(i < cdata->_primitives.size(),
nullptr);
86 return cdata->_primitives[i].get_read_pointer();
98modify_primitive(
size_t i) {
100 CDWriter cdata(_cycler,
true, current_thread);
101 nassertr(i < cdata->_primitives.size(),
nullptr);
104 return cdata->_primitives[i].get_write_pointer();
127 new_geom->decompose_in_place();
135INLINE PT(
Geom) Geom::
138 new_geom->doubleside_in_place();
146INLINE PT(
Geom) Geom::
149 new_geom->reverse_in_place();
157INLINE PT(
Geom) Geom::
160 new_geom->rotate_in_place();
175INLINE PT(
Geom) Geom::
176unify(
int max_indices,
bool preserve_order)
const {
178 new_geom->unify_in_place(max_indices, preserve_order);
186INLINE PT(
Geom) Geom::
189 new_geom->make_points_in_place();
197INLINE PT(
Geom) Geom::
200 new_geom->make_lines_in_place();
208INLINE PT(
Geom) Geom::
209make_patches()
const {
211 new_geom->make_patches_in_place();
221INLINE PT(
Geom) Geom::
222make_adjacency()
const {
224 new_geom->make_adjacency_in_place();
235get_modified(
Thread *current_thread)
const {
236 CDReader cdata(_cycler, current_thread);
237 return cdata->_modified;
245mark_bounds_stale()
const {
246 CDWriter cdata(((
Geom *)
this)->_cycler,
false);
247 ((
Geom *)
this)->mark_internal_bounds_stale(cdata);
263set_bounds_type(BoundingVolume::BoundsType bounds_type) {
264 CDWriter cdata(_cycler,
true);
265 cdata->_bounds_type = bounds_type;
266 mark_internal_bounds_stale(cdata);
272INLINE BoundingVolume::BoundsType
Geom::
274 CDReader cdata(_cycler);
275 return cdata->_bounds_type;
290 if (volume ==
nullptr) {
291 cdata->_user_bounds =
nullptr;
293 cdata->_user_bounds = volume->make_copy();
308 cdata->_user_bounds =
nullptr;
309 mark_internal_bounds_stale(cdata);
327 bool got_mat,
const LMatrix4 &mat,
328 Thread *current_thread)
const {
329 CDReader cdata(_cycler, current_thread);
331 PN_stdfloat sq_radius;
332 do_calc_tight_bounds(min_point, max_point, sq_radius, found_any,
333 vertex_data, got_mat, mat,
334 InternalName::get_vertex(),
335 cdata, current_thread);
349 bool &found_any,
Thread *current_thread)
const {
352 get_vertex_data(current_thread),
false,
353 LMatrix4::ident_mat(),
364 bool got_mat,
const LMatrix4 &mat,
366 Thread *current_thread)
const {
367 CDReader cdata(_cycler, current_thread);
369 PN_stdfloat sq_radius;
370 do_calc_tight_bounds(min_point, max_point, sq_radius, found_any,
371 vertex_data, got_mat, mat,
372 column_name, cdata, current_thread);
381mark_internal_bounds_stale(CData *cdata) {
382 cdata->_nested_vertices = 0;
383 cdata->_internal_bounds_stale =
true;
389INLINE Geom::CDataCache::
392 _geom_result(nullptr),
393 _data_result(nullptr)
400INLINE Geom::CDataCache::
401CDataCache(
const Geom::CDataCache ©) :
402 _source(copy._source),
403 _geom_result(copy._geom_result),
404 _data_result(copy._data_result)
406 if (_geom_result != _source && _geom_result !=
nullptr) {
415INLINE
void Geom::CDataCache::
417 if (geom_result != _geom_result) {
418 if (_geom_result != _source && _geom_result !=
nullptr) {
421 _geom_result = geom_result;
422 if (_geom_result != _source && _geom_result !=
nullptr) {
426 _data_result = data_result;
432INLINE Geom::CacheKey::
434 _source_data(source_data),
442INLINE Geom::CacheKey::
443CacheKey(
const CacheKey ©) :
444 _source_data(copy._source_data),
445 _modifier(copy._modifier)
452INLINE Geom::CacheKey::
453CacheKey(CacheKey &&from) noexcept :
454 _source_data(std::move(from._source_data)),
455 _modifier(std::move(from._modifier))
464 if (_modifier != other._modifier) {
465 int compare = _modifier->geom_compare_to(*other._modifier);
467 return (compare < 0);
470 if (_source_data != other._source_data) {
471 return (_source_data < other._source_data);
479INLINE Geom::CacheEntry::
483 _key(source_data, modifier)
490INLINE Geom::CacheEntry::
500INLINE Geom::CacheEntry::
512 _primitive_type(PT_none),
513 _shade_model(SM_uniform),
516 _internal_bounds_stale(true),
527 _primitive_type(PT_none),
528 _shade_model(SM_uniform),
531 _internal_bounds_stale(true),
539INLINE GeomPipelineReader::
540GeomPipelineReader(
Thread *current_thread) :
542 _current_thread(current_thread),
550INLINE GeomPipelineReader::
551GeomPipelineReader(
const Geom *
object,
Thread *current_thread) :
553 _current_thread(current_thread),
554 _cdata(object->_cycler.read_unlocked(current_thread))
557 nassertv(_object->test_ref_count_nonzero());
567INLINE GeomPipelineReader::
568~GeomPipelineReader() {
570 if (_object !=
nullptr) {
571 nassertv(_object->test_ref_count_nonzero());
577 if (_cdata !=
nullptr) {
591INLINE
void GeomPipelineReader::
592set_object(
const Geom *
object) {
593 if (
object != _object) {
597 if (_cdata !=
nullptr) {
602 _cdata =
object->_cycler.read_unlocked(_current_thread);
615INLINE
const Geom *GeomPipelineReader::
623INLINE
Thread *GeomPipelineReader::
624get_current_thread()
const {
625 return _current_thread;
631INLINE GeomPipelineReader::PrimitiveType GeomPipelineReader::
632get_primitive_type()
const {
633 return _cdata->_primitive_type;
639INLINE GeomPipelineReader::ShadeModel GeomPipelineReader::
640get_shade_model()
const {
641 return _cdata->_shade_model;
647INLINE
int GeomPipelineReader::
648get_geom_rendering()
const {
649 return _cdata->_geom_rendering;
656get_vertex_data()
const {
657 return _cdata->_data.get_read_pointer();
663INLINE
int GeomPipelineReader::
664get_num_primitives()
const {
665 return _cdata->_primitives.size();
672get_primitive(
int i)
const {
673 nassertr(i >= 0 && i < (
int)_cdata->_primitives.size(),
nullptr);
674 return _cdata->_primitives[i].get_read_pointer();
681get_modified()
const {
682 return _cdata->_modified;
699 return ((
Geom *)_object)->prepare_now(prepared_objects, gsg);
703operator << (std::ostream &out,
const Geom &obj) {
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
A single page of data maintained by a PipelineCycler.
This is a special class object that holds all the information returned by a particular GSG to indicat...
Objects of this class are used to convert vertex data from a Geom into a format suitable for passing ...
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
bool operator<(const CacheKey &other) const
Provides a unique ordering within the map.
A container for geometry primitives.
void calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point, bool &found_any, const GeomVertexData *vertex_data, bool got_mat, const LMatrix4 &mat, Thread *current_thread) const
Expands min_point and max_point to include all of the vertices in the Geom, if any.
insert_primitive
Inserts a new GeomPrimitive structure to the Geom object.
void set_bounds(const BoundingVolume *volume)
Resets the bounding volume so that it is the indicated volume.
void clear_bounds()
Reverses the effect of a previous call to set_bounds(), and allows the bounding volume to be automati...
void add_primitive(const GeomPrimitive *primitive)
Inserts a new GeomPrimitive structure to the Geom object.
void clear_cache_stage(Thread *current_thread)
Removes all of the previously-cached results of munge_geom(), at the current pipeline stage and upstr...
get_bounds_type
Returns the bounding volume type set with set_bounds_type().
get_shade_model
Returns the shade model common to all of the individual GeomPrimitives that have been added to the ge...
static UpdateSeq get_next_modified()
Returns a monotonically increasing sequence.
virtual Geom * make_copy() const
Returns a newly-allocated Geom that is a shallow copy of this one.
get_primitive_type
Returns the fundamental primitive type that is common to all GeomPrimitives added within the Geom.
get_geom_rendering
Returns the set of GeomRendering bits that represent the rendering properties required to properly re...
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
Encodes a string name in a hash table, mapping it to a pointer.
A table of objects that are saved within the graphics context for reference by handle later.
void ref() const
Explicitly increments the reference count.
A thread; that is, a lightweight process.
get_current_thread
Returns a pointer to the currently-executing Thread object.
This is a sequence number that increments monotonically.
void unref_delete(RefCountType *ptr)
This global helper function will unref the given ReferenceCount object, and if the reference count re...