18 #include "pandabase.h" 19 #include "copyOnWriteObject.h" 20 #include "copyOnWritePointer.h" 21 #include "cycleData.h" 22 #include "cycleDataLockedReader.h" 23 #include "cycleDataReader.h" 24 #include "cycleDataWriter.h" 25 #include "cycleDataStageReader.h" 26 #include "cycleDataStageWriter.h" 27 #include "pipelineCycler.h" 28 #include "geomVertexData.h" 29 #include "geomPrimitive.h" 30 #include "geomMunger.h" 31 #include "geomEnums.h" 32 #include "geomCacheEntry.h" 33 #include "textureStage.h" 34 #include "updateSeq.h" 35 #include "pointerTo.h" 36 #include "indirectLess.h" 39 #include "boundingVolume.h" 40 #include "pStatCollector.h" 41 #include "deletedChain.h" 42 #include "lightMutex.h" 69 void operator = (
const Geom ©);
71 ALLOC_DELETED_CHAIN(
Geom);
73 virtual Geom *make_copy()
const;
75 INLINE PrimitiveType get_primitive_type()
const;
76 INLINE ShadeModel get_shade_model()
const;
77 INLINE
int get_geom_rendering()
const;
79 INLINE UsageHint get_usage_hint()
const;
80 void set_usage_hint(UsageHint usage_hint);
86 int make_nonindexed(
bool composite_only);
88 INLINE
bool is_empty()
const;
90 INLINE
int get_num_primitives()
const;
92 MAKE_SEQ(get_primitives, get_num_primitives, get_primitive);
96 void remove_primitive(
int i);
97 void clear_primitives();
99 INLINE PT(
Geom) decompose()
const;
100 INLINE PT(
Geom) doubleside()
const;
101 INLINE PT(
Geom) reverse()
const;
102 INLINE PT(
Geom) rotate()
const;
103 INLINE PT(
Geom) unify(
int max_indices,
bool preserve_order)
const;
104 INLINE PT(
Geom) make_points()
const;
105 INLINE PT(
Geom) make_lines()
const;
106 INLINE PT(
Geom) make_patches()
const;
108 void decompose_in_place();
109 void doubleside_in_place();
110 void reverse_in_place();
111 void rotate_in_place();
112 void unify_in_place(
int max_indices,
bool preserve_order);
113 void make_points_in_place();
114 void make_lines_in_place();
115 void make_patches_in_place();
117 virtual bool copy_primitives_from(
const Geom *other);
119 int get_num_bytes()
const;
122 bool request_resident()
const;
124 void transform_vertices(
const LMatrix4 &mat);
125 bool check_valid()
const;
130 INLINE
void mark_bounds_stale()
const;
131 INLINE
void set_bounds_type(BoundingVolume::BoundsType bounds_type);
132 INLINE BoundingVolume::BoundsType get_bounds_type()
const;
134 INLINE
void clear_bounds();
136 virtual void output(ostream &out)
const;
137 virtual void write(ostream &out,
int indent_level = 0)
const;
140 void clear_cache_stage(
Thread *current_thread);
154 bool force,
Thread *current_thread)
const;
156 INLINE
void calc_tight_bounds(
LPoint3 &min_point,
LPoint3 &max_point,
160 Thread *current_thread)
const;
161 INLINE
void calc_tight_bounds(
LPoint3 &min_point,
LPoint3 &max_point,
162 bool &found_any,
Thread *current_thread)
const;
163 INLINE
void calc_tight_bounds(
LPoint3 &min_point,
LPoint3 &max_point,
167 const InternalName *column_name,
168 Thread *current_thread)
const;
175 INLINE
void mark_internal_bounds_stale(CData *cdata);
176 void compute_internal_bounds(CData *cdata,
Thread *current_thread)
const;
179 PN_stdfloat &sq_center_dist,
bool &found_any,
182 const InternalName *column_name,
183 const CData *cdata,
Thread *current_thread)
const;
185 void do_calc_sphere_radius(
const LPoint3 ¢er,
186 PN_stdfloat &sq_radius,
bool &found_any,
188 const CData *cdata,
Thread *current_thread)
const;
191 bool check_will_be_valid(
const GeomVertexData *vertex_data)
const;
193 void reset_usage_hint(CData *cdata);
194 void reset_geom_rendering(CData *cdata);
214 class EXPCL_PANDA_GOBJ CDataCache :
public CycleData {
217 INLINE CDataCache(
const CDataCache ©);
218 virtual ~CDataCache();
219 ALLOC_DELETED_CHAIN(CDataCache);
222 return Geom::get_class_type();
228 const Geom *_geom_result;
235 static void init_type() {
236 register_type(_type_handle,
"Geom::CDataCache");
255 INLINE CacheKey(
const CacheKey ©);
256 #ifdef USE_MOVE_SEMANTICS 257 INLINE CacheKey(CacheKey &&from) NOEXCEPT;
259 INLINE
bool operator < (
const CacheKey &other)
const;
271 #ifdef USE_MOVE_SEMANTICS 272 INLINE CacheEntry(
Geom *source,
CacheKey &&key) NOEXCEPT;
274 ALLOC_DELETED_CHAIN(CacheEntry);
276 virtual void evict_callback();
277 virtual void output(ostream &out)
const;
288 static void init_type() {
289 GeomCacheEntry::init_type();
290 register_type(_type_handle,
"Geom::CacheEntry",
291 GeomCacheEntry::get_class_type());
301 class EXPCL_PANDA_GOBJ CData :
public CycleData {
304 INLINE CData(
const CData ©);
305 ALLOC_DELETED_CHAIN(CData);
311 return Geom::get_class_type();
315 Primitives _primitives;
316 PrimitiveType _primitive_type;
317 ShadeModel _shade_model;
319 UsageHint _usage_hint;
320 bool _got_usage_hint;
324 int _nested_vertices;
325 bool _internal_bounds_stale;
326 BoundingVolume::BoundsType _bounds_type;
333 static void init_type() {
334 register_type(_type_handle,
"Geom::CData");
360 static void register_with_read_factory();
363 virtual void finalize(
BamReader *manager);
373 static void init_type() {
374 CopyOnWriteObject::init_type();
375 register_type(_type_handle,
"Geom",
376 CopyOnWriteObject::get_class_type());
377 CDataCache::init_type();
378 CacheEntry::init_type();
382 return get_class_type();
384 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
405 INLINE GeomPipelineReader(
const GeomPipelineReader ©);
406 INLINE
void operator = (
const GeomPipelineReader ©);
409 INLINE ~GeomPipelineReader();
410 ALLOC_DELETED_CHAIN(GeomPipelineReader);
412 INLINE
const Geom *get_object()
const;
413 INLINE
Thread *get_current_thread()
const;
415 void check_usage_hint()
const;
417 INLINE PrimitiveType get_primitive_type()
const;
418 INLINE ShadeModel get_shade_model()
const;
419 INLINE
int get_geom_rendering()
const;
420 INLINE UsageHint get_usage_hint()
const;
422 INLINE
int get_num_primitives()
const;
439 const Geom::CData *_cdata;
445 static void init_type() {
446 register_type(_type_handle,
"GeomPipelineReader");
453 INLINE ostream &operator << (ostream &out,
const Geom &obj);
This is a special class object that holds all the information returned by a particular GSG to indicat...
This is our own Panda specialization on the default STL map.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Objects of this class are used to convert vertex data from a Geom into a format suitable for passing ...
This class is similar to CycleDataWriter, except it allows writing to a particular stage of the pipel...
A single page of data maintained by a PipelineCycler.
Base class for objects that can be written to and read from Bam files.
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
virtual TypeHandle get_parent_type() const
Returns the type of the container that owns the CycleData.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This is our own Panda specialization on the default STL list.
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...
A lightweight class that represents a single element that may be timed and/or counted via stats...
This is a 4-by-4 transform matrix.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
This template class calls PipelineCycler::read() in the constructor and PipelineCycler::release_read(...
A container for geometry primitives.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
This class is similar to CycleDataReader, except it allows reading from a particular stage of the pip...
This base class provides basic reference counting, but also can be used with a CopyOnWritePointer to ...
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.
Encapsulates the data from a GeomVertexData, pre-fetched for one stage of the pipeline.
This object contains a single cache entry in the GeomCacheManager.
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
This is a sequence number that increments monotonically.
This is a standard, non-reentrant mutex, similar to the Mutex class.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...