21 INLINE Geom::PrimitiveType
Geom::
23 CDReader cdata(_cycler);
24 return cdata->_primitive_type;
31 INLINE Geom::ShadeModel
Geom::
33 CDReader cdata(_cycler);
34 return cdata->_shade_model;
43 CDReader cdata(_cycler);
44 return cdata->_geom_rendering;
52 get_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();
72 get_num_primitives()
const {
73 CDReader cdata(_cycler);
74 return cdata->_primitives.size();
83 get_primitive(
size_t i)
const {
84 CDReader cdata(_cycler);
85 nassertr(i < cdata->_primitives.size(),
nullptr);
86 return cdata->_primitives[i].get_read_pointer();
98 modify_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();
138 new_geom->doubleside_in_place();
149 new_geom->reverse_in_place();
160 new_geom->rotate_in_place();
176 unify(
int max_indices,
bool preserve_order)
const {
178 new_geom->unify_in_place(max_indices, preserve_order);
187 make_points()
const {
189 new_geom->make_points_in_place();
200 new_geom->make_lines_in_place();
209 make_patches()
const {
211 new_geom->make_patches_in_place();
222 make_adjacency()
const {
224 new_geom->make_adjacency_in_place();
235 get_modified(
Thread *current_thread)
const {
236 CDReader cdata(_cycler, current_thread);
237 return cdata->_modified;
245 mark_bounds_stale()
const {
246 CDWriter cdata(((
Geom *)
this)->_cycler,
false);
247 ((
Geom *)
this)->mark_internal_bounds_stale(cdata);
263 set_bounds_type(BoundingVolume::BoundsType bounds_type) {
264 CDWriter cdata(_cycler,
true);
265 cdata->_bounds_type = bounds_type;
266 mark_internal_bounds_stale(cdata);
272 INLINE 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);
381 mark_internal_bounds_stale(CData *cdata) {
382 cdata->_internal_bounds_stale =
true;
388 INLINE Geom::CDataCache::
391 _geom_result(nullptr),
392 _data_result(nullptr)
399 INLINE Geom::CDataCache::
400 CDataCache(
const Geom::CDataCache ©) :
401 _source(copy._source),
402 _geom_result(copy._geom_result),
403 _data_result(copy._data_result)
405 if (_geom_result != _source && _geom_result !=
nullptr) {
414 INLINE
void Geom::CDataCache::
416 if (geom_result != _geom_result) {
417 if (_geom_result != _source && _geom_result !=
nullptr) {
420 _geom_result = geom_result;
421 if (_geom_result != _source && _geom_result !=
nullptr) {
425 _data_result = data_result;
431 INLINE Geom::CacheKey::
433 _source_data(source_data),
441 INLINE Geom::CacheKey::
442 CacheKey(
const CacheKey ©) :
443 _source_data(copy._source_data),
444 _modifier(copy._modifier)
451 INLINE Geom::CacheKey::
452 CacheKey(CacheKey &&from) noexcept :
453 _source_data(std::move(from._source_data)),
454 _modifier(std::move(from._modifier))
463 if (_modifier != other._modifier) {
464 int compare = _modifier->geom_compare_to(*other._modifier);
466 return (compare < 0);
469 if (_source_data != other._source_data) {
470 return (_source_data < other._source_data);
478 INLINE Geom::CacheEntry::
482 _key(source_data, modifier)
489 INLINE Geom::CacheEntry::
499 INLINE Geom::CacheEntry::
511 _primitive_type(PT_none),
512 _shade_model(SM_uniform),
515 _internal_bounds_stale(true),
526 _primitive_type(PT_none),
527 _shade_model(SM_uniform),
530 _internal_bounds_stale(true),
538 INLINE GeomPipelineReader::
539 GeomPipelineReader(
Thread *current_thread) :
541 _current_thread(current_thread),
549 INLINE GeomPipelineReader::
550 GeomPipelineReader(
const Geom *
object,
Thread *current_thread) :
552 _current_thread(current_thread),
553 _cdata(object->_cycler.read_unlocked(current_thread))
556 nassertv(_object->test_ref_count_nonzero());
560 #endif // DO_PIPELINING
566 INLINE GeomPipelineReader::
567 ~GeomPipelineReader() {
569 if (_object !=
nullptr) {
570 nassertv(_object->test_ref_count_nonzero());
576 if (_cdata !=
nullptr) {
579 #endif // DO_PIPELINING
590 INLINE
void GeomPipelineReader::
591 set_object(
const Geom *
object) {
592 if (
object != _object) {
596 if (_cdata !=
nullptr) {
599 #endif // DO_PIPELINING
601 _cdata =
object->_cycler.read_unlocked(_current_thread);
605 #endif // DO_PIPELINING
614 INLINE
const Geom *GeomPipelineReader::
622 INLINE
Thread *GeomPipelineReader::
623 get_current_thread()
const {
624 return _current_thread;
630 INLINE GeomPipelineReader::PrimitiveType GeomPipelineReader::
631 get_primitive_type()
const {
632 return _cdata->_primitive_type;
638 INLINE GeomPipelineReader::ShadeModel GeomPipelineReader::
639 get_shade_model()
const {
640 return _cdata->_shade_model;
646 INLINE
int GeomPipelineReader::
647 get_geom_rendering()
const {
648 return _cdata->_geom_rendering;
655 get_vertex_data()
const {
656 return _cdata->_data.get_read_pointer();
662 INLINE
int GeomPipelineReader::
663 get_num_primitives()
const {
664 return _cdata->_primitives.size();
671 get_primitive(
int i)
const {
672 nassertr(i >= 0 && i < (
int)_cdata->_primitives.size(),
nullptr);
673 return _cdata->_primitives[i].get_read_pointer();
680 get_modified()
const {
681 return _cdata->_modified;
698 return ((
Geom *)_object)->prepare_now(prepared_objects, gsg);
701 INLINE std::ostream &
702 operator << (std::ostream &out,
const Geom &obj) {