27 INLINE Geom::PrimitiveType
Geom::
30 return cdata->_primitive_type;
40 INLINE Geom::ShadeModel
Geom::
43 return cdata->_shade_model;
56 return cdata->_geom_rendering;
66 INLINE Geom::UsageHint
Geom::
69 if (!cdata->_got_usage_hint) {
71 ((
Geom *)
this)->reset_usage_hint(cdataw);
72 return cdataw->_usage_hint;
74 return cdata->_usage_hint;
85 get_vertex_data(
Thread *current_thread)
const {
86 CDReader cdata(_cycler, current_thread);
87 return cdata->_data.get_read_pointer();
99 return cdata->_primitives.empty();
112 return cdata->_primitives.size();
124 get_primitive(
int i)
const {
125 CDReader cdata(_cycler);
126 nassertr(i >= 0 && i < (
int)cdata->_primitives.size(), NULL);
127 return cdata->_primitives[i].get_read_pointer();
143 modify_primitive(
int i) {
145 CDWriter cdata(_cycler,
true, current_thread);
146 nassertr(i >= 0 && i < (
int)cdata->_primitives.size(), NULL);
147 cdata->_got_usage_hint =
false;
149 clear_cache_stage(current_thread);
150 return cdata->_primitives[i].get_write_pointer();
162 PT(
Geom) new_geom = make_copy();
163 new_geom->decompose_in_place();
176 PT(
Geom) new_geom = make_copy();
177 new_geom->doubleside_in_place();
190 PT(
Geom) new_geom = make_copy();
191 new_geom->reverse_in_place();
204 PT(
Geom) new_geom = make_copy();
205 new_geom->rotate_in_place();
226 unify(
int max_indices,
bool preserve_order)
const {
227 PT(
Geom) new_geom = make_copy();
228 new_geom->unify_in_place(max_indices, preserve_order);
239 make_points()
const {
240 PT(
Geom) new_geom = make_copy();
241 new_geom->make_points_in_place();
253 PT(
Geom) new_geom = make_copy();
254 new_geom->make_lines_in_place();
265 make_patches()
const {
266 PT(
Geom) new_geom = make_copy();
267 new_geom->make_patches_in_place();
282 get_modified(
Thread *current_thread)
const {
283 CDReader cdata(_cycler, current_thread);
284 return cdata->_modified;
297 ((
Geom *)
this)->mark_internal_bounds_stale(cdata);
321 cdata->_bounds_type = bounds_type;
322 mark_internal_bounds_stale(cdata);
331 INLINE BoundingVolume::BoundsType
Geom::
334 return cdata->_bounds_type;
353 if (volume == NULL) {
354 cdata->_user_bounds = NULL;
356 cdata->_user_bounds = volume->make_copy();
375 cdata->_user_bounds = NULL;
376 mark_internal_bounds_stale(cdata);
399 Thread *current_thread)
const {
400 CDReader cdata(_cycler, current_thread);
402 PN_stdfloat sq_radius;
403 do_calc_tight_bounds(min_point, max_point, sq_radius, found_any,
404 vertex_data, got_mat, mat,
405 InternalName::get_vertex(),
406 cdata, current_thread);
424 bool &found_any,
Thread *current_thread)
const {
427 get_vertex_data(current_thread),
false,
443 const InternalName *column_name,
444 Thread *current_thread)
const {
445 CDReader cdata(_cycler, current_thread);
447 PN_stdfloat sq_radius;
448 do_calc_tight_bounds(min_point, max_point, sq_radius, found_any,
449 vertex_data, got_mat, mat,
450 column_name, cdata, current_thread);
462 mark_internal_bounds_stale(CData *cdata) {
463 cdata->_internal_bounds_stale =
true;
471 INLINE Geom::CDataCache::
484 INLINE Geom::CDataCache::
485 CDataCache(
const Geom::CDataCache ©) :
486 _source(copy._source),
487 _geom_result(copy._geom_result),
488 _data_result(copy._data_result)
490 if (_geom_result != _source && _geom_result != (
Geom *)NULL) {
502 INLINE
void Geom::CDataCache::
504 if (geom_result != _geom_result) {
505 if (_geom_result != _source && _geom_result != (
Geom *)NULL) {
506 unref_delete(_geom_result);
508 _geom_result = geom_result;
509 if (_geom_result != _source && _geom_result != (
Geom *)NULL) {
513 _data_result = data_result;
521 INLINE Geom::CacheKey::
523 _source_data(source_data),
533 INLINE Geom::CacheKey::
534 CacheKey(
const CacheKey ©) :
535 _source_data(copy._source_data),
536 _modifier(copy._modifier)
540 #ifdef USE_MOVE_SEMANTICS
546 INLINE Geom::CacheKey::
547 CacheKey(CacheKey &&from) NOEXCEPT :
548 _source_data(move(from._source_data)),
549 _modifier(move(from._modifier))
552 #endif // USE_MOVE_SEMANTICS
561 if (_modifier != other._modifier) {
562 int compare = _modifier->geom_compare_to(*other._modifier);
564 return (compare < 0);
567 if (_source_data != other._source_data) {
568 return (_source_data < other._source_data);
578 INLINE Geom::CacheEntry::
582 _key(source_data, modifier)
591 INLINE Geom::CacheEntry::
598 #ifdef USE_MOVE_SEMANTICS
604 INLINE Geom::CacheEntry::
610 #endif // USE_MOVE_SEMANTICS
619 _primitive_type(PT_none),
620 _shade_model(SM_uniform),
622 _usage_hint(UH_unspecified),
623 _got_usage_hint(false),
625 _internal_bounds_stale(true),
636 CData(
const Geom::CData ©) :
638 _primitives(copy._primitives),
639 _primitive_type(copy._primitive_type),
640 _shade_model(copy._shade_model),
641 _geom_rendering(copy._geom_rendering),
642 _usage_hint(copy._usage_hint),
643 _got_usage_hint(copy._got_usage_hint),
644 _modified(copy._modified),
645 _internal_bounds(copy._internal_bounds),
646 _nested_vertices(copy._nested_vertices),
647 _internal_bounds_stale(copy._internal_bounds_stale),
648 _bounds_type(copy._bounds_type),
649 _user_bounds(copy._user_bounds)
658 INLINE GeomPipelineReader::
659 GeomPipelineReader(
const Geom *
object,
Thread *current_thread) :
661 _current_thread(current_thread),
662 _cdata(object->_cycler.read_unlocked(current_thread))
665 nassertv(_object->test_ref_count_nonzero());
669 #endif // DO_PIPELINING
677 INLINE GeomPipelineReader::
687 INLINE
void GeomPipelineReader::
697 INLINE GeomPipelineReader::
698 ~GeomPipelineReader() {
700 nassertv(_object->test_ref_count_nonzero());
706 #endif // DO_PIPELINING
719 INLINE
const Geom *GeomPipelineReader::
729 INLINE
Thread *GeomPipelineReader::
730 get_current_thread()
const {
731 return _current_thread;
739 INLINE GeomPipelineReader::PrimitiveType GeomPipelineReader::
740 get_primitive_type()
const {
741 return _cdata->_primitive_type;
749 INLINE GeomPipelineReader::ShadeModel GeomPipelineReader::
750 get_shade_model()
const {
751 return _cdata->_shade_model;
759 INLINE
int GeomPipelineReader::
760 get_geom_rendering()
const {
761 return _cdata->_geom_rendering;
769 INLINE GeomPipelineReader::UsageHint GeomPipelineReader::
770 get_usage_hint()
const {
771 nassertr(_cdata->_got_usage_hint, UH_static);
772 return _cdata->_usage_hint;
781 get_vertex_data()
const {
782 return _cdata->_data.get_read_pointer();
790 INLINE
int GeomPipelineReader::
791 get_num_primitives()
const {
792 return _cdata->_primitives.size();
801 get_primitive(
int i)
const {
802 nassertr(i >= 0 && i < (
int)_cdata->_primitives.size(), NULL);
803 return _cdata->_primitives[i].get_read_pointer();
812 get_modified()
const {
813 return _cdata->_modified;
839 operator << (ostream &out,
const Geom &obj) {
static const LMatrix4f & ident_mat()
Returns an identity matrix.
This is a special class object that holds all the information returned by a particular GSG to indicat...
BoundingVolume::BoundsType get_bounds_type() const
Returns the bounding volume type set with set_bounds_type().
bool is_empty() const
Returns true if there appear to be no vertices to be rendered by this Geom, false if has some actual ...
Objects of this class are used to convert vertex data from a Geom into a format suitable for passing ...
void set_bounds(const BoundingVolume *volume)
Resets the bounding volume so that it is the indicated volume.
A single page of data maintained by a PipelineCycler.
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
PrimitiveType get_primitive_type() const
Returns the fundamental primitive type that is common to all GeomPrimitives added within the Geom...
bool operator<(const CacheKey &other) const
Provides a unique ordering within the map.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
void clear_bounds()
Reverses the effect of a previous call to set_bounds(), and allows the bounding volume to be automati...
Encapsulates the data from a Geom, pre-fetched for one stage of the pipeline.
A table of objects that are saved within the graphics context for reference by handle later...
static Thread * get_current_thread()
Returns a pointer to the currently-executing Thread object.
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
This is a 4-by-4 transform matrix.
void mark_bounds_stale() const
Marks the bounding volume of the Geom as stale so that it should be recomputed.
ShadeModel get_shade_model() const
Returns the shade model common to all of the individual GeomPrimitives that have been added to the ge...
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
UsageHint get_usage_hint() const
Returns the minimum (i.e.
This template class calls PipelineCycler::read() in the constructor and PipelineCycler::release_read(...
A container for geometry primitives.
GeomContext * prepare_now(PreparedGraphicsObjects *prepared_objects, GraphicsStateGuardianBase *gsg)
Creates a context for the geom on the particular GSG, if it does not already exist.
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
void set_bounds_type(BoundingVolume::BoundsType bounds_type)
Specifies the desired type of bounding volume that will be created for this Geom. ...
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.
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
A thread; that is, a lightweight process.
static UpdateSeq get_next_modified()
Returns a monotonically increasing sequence.
GeomContext * prepare_now(PreparedGraphicsObjects *prepared_objects, GraphicsStateGuardianBase *gsg) const
Creates a context for the geom on the particular GSG, if it does not already exist.
void ref() const
Explicitly increments the reference count.
This is a sequence number that increments monotonically.
int get_geom_rendering() const
Returns the set of GeomRendering bits that represent the rendering properties required to properly re...
int get_num_primitives() const
Returns the number of GeomPrimitive objects stored within the Geom, each of which represents a number...