15 #ifndef GEOMVERTEXDATA_H 16 #define GEOMVERTEXDATA_H 18 #include "pandabase.h" 19 #include "copyOnWriteObject.h" 20 #include "copyOnWritePointer.h" 21 #include "geomVertexFormat.h" 22 #include "geomVertexColumn.h" 23 #include "geomVertexArrayData.h" 24 #include "geomEnums.h" 25 #include "geomCacheEntry.h" 26 #include "transformTable.h" 27 #include "transformBlendTable.h" 28 #include "sliderTable.h" 29 #include "internalName.h" 30 #include "cycleData.h" 31 #include "cycleDataLockedReader.h" 32 #include "cycleDataReader.h" 33 #include "cycleDataWriter.h" 34 #include "cycleDataStageReader.h" 35 #include "cycleDataStageWriter.h" 36 #include "pipelineCycler.h" 37 #include "pStatCollector.h" 38 #include "pointerTo.h" 41 #include "deletedChain.h" 84 const GeomVertexFormat *format,
85 UsageHint usage_hint);
88 const GeomVertexFormat *format);
95 INLINE
const string &get_name()
const;
96 void set_name(
const string &name);
98 INLINE UsageHint get_usage_hint()
const;
99 void set_usage_hint(UsageHint usage_hint);
101 INLINE
const GeomVertexFormat *get_format()
const;
102 void set_format(
const GeomVertexFormat *format);
103 void unclean_set_format(
const GeomVertexFormat *format);
105 INLINE
bool has_column(
const InternalName *name)
const;
107 INLINE
int get_num_rows()
const;
108 INLINE
bool set_num_rows(
int n);
109 INLINE
bool unclean_set_num_rows(
int n);
110 INLINE
bool reserve_num_rows(
int n);
113 INLINE
int get_num_arrays()
const;
115 MAKE_SEQ(get_arrays, get_num_arrays, get_array);
121 INLINE
void clear_transform_table();
126 INLINE
void clear_transform_blend_table();
128 INLINE
const SliderTable *get_slider_table()
const;
130 INLINE
void clear_slider_table();
132 INLINE
int get_num_bytes()
const;
135 bool request_resident()
const;
137 void copy_from(
const GeomVertexData *source,
bool keep_data_objects,
140 int source_row,
Thread *current_thread);
141 CPT(
GeomVertexData) convert_to(
const GeomVertexFormat *new_format)
const;
143 scale_color(
const LVecBase4 &color_scale)
const;
145 scale_color(
const LVecBase4 &color_scale,
int num_components,
146 NumericType numeric_type, Contents contents)
const;
150 set_color(
const LColor &color,
int num_components,
151 NumericType numeric_type, Contents contents)
const;
156 void clear_animated_vertices();
157 void transform_vertices(
const LMatrix4 &mat);
158 void transform_vertices(
const LMatrix4 &mat,
int begin_row,
int end_row);
162 replace_column(InternalName *name,
int num_components,
163 NumericType numeric_type, Contents contents)
const;
165 void output(ostream &out)
const;
166 void write(ostream &out,
int indent_level = 0)
const;
167 void describe_vertex(ostream &out,
int row)
const;
170 void clear_cache_stage();
173 static INLINE PN_uint32 pack_abcd(
unsigned int a,
unsigned int b,
174 unsigned int c,
unsigned int d);
175 static INLINE
unsigned int unpack_abcd_a(PN_uint32 data);
176 static INLINE
unsigned int unpack_abcd_b(PN_uint32 data);
177 static INLINE
unsigned int unpack_abcd_c(PN_uint32 data);
178 static INLINE
unsigned int unpack_abcd_d(PN_uint32 data);
181 static void bytewise_copy(
unsigned char *to,
int to_stride,
182 const unsigned char *from,
int from_stride,
186 packed_argb_to_uint8_rgba(
unsigned char *to,
int to_stride,
187 const unsigned char *from,
int from_stride,
190 uint8_rgba_to_packed_argb(
unsigned char *to,
int to_stride,
191 const unsigned char *from,
int from_stride,
197 TransformMap &already_added);
205 class EXPCL_PANDA_GOBJ CDataCache :
public CycleData {
208 INLINE CDataCache(
const CDataCache ©);
209 ALLOC_DELETED_CHAIN(CDataCache);
212 return GeomVertexData::get_class_type();
221 static void init_type() {
222 register_type(_type_handle,
"GeomVertexData::CDataCache");
239 INLINE
CacheKey(
const GeomVertexFormat *modifier);
240 INLINE CacheKey(
const CacheKey ©);
241 #ifdef USE_MOVE_SEMANTICS 242 INLINE CacheKey(CacheKey &&from) NOEXCEPT;
245 INLINE
bool operator < (
const CacheKey &other)
const;
247 CPT(GeomVertexFormat) _modifier;
253 const GeomVertexFormat *modifier);
255 #ifdef USE_MOVE_SEMANTICS 258 ALLOC_DELETED_CHAIN(CacheEntry);
261 virtual void output(ostream &out)
const;
272 static void init_type() {
273 GeomCacheEntry::init_type();
274 register_type(_type_handle,
"GeomVertexData::CacheEntry",
275 GeomCacheEntry::get_class_type());
285 class EXPCL_PANDA_GOBJ CData :
public CycleData {
288 INLINE CData(
const CData ©);
289 ALLOC_DELETED_CHAIN(CData);
295 return GeomVertexData::get_class_type();
298 UsageHint _usage_hint;
299 CPT(GeomVertexFormat) _format;
312 static void init_type() {
313 register_type(_type_handle,
"GeomVertexData::CData");
331 void update_animated_vertices(CData *cdata,
Thread *current_thread);
332 void do_transform_point_column(
const GeomVertexFormat *format,
GeomVertexRewriter &data,
333 const LMatrix4 &mat,
int begin_row,
int end_row);
334 void do_transform_vector_column(
const GeomVertexFormat *format,
GeomVertexRewriter &data,
335 const LMatrix4 &mat,
int begin_row,
int end_row);
336 static void table_xform_point3f(
unsigned char *datat,
size_t num_rows,
338 static void table_xform_normal3f(
unsigned char *datat,
size_t num_rows,
340 static void table_xform_vector3f(
unsigned char *datat,
size_t num_rows,
342 static void table_xform_vecbase4f(
unsigned char *datat,
size_t num_rows,
356 static void register_with_read_factory();
359 virtual bool require_fully_complete()
const;
361 virtual void finalize(
BamReader *manager);
371 static void init_type() {
372 CopyOnWriteObject::init_type();
373 register_type(_type_handle,
"GeomVertexData",
374 CopyOnWriteObject::get_class_type());
375 CDataCache::init_type();
376 CacheEntry::init_type();
380 return get_class_type();
382 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
403 GeomVertexData::CData *cdata);
406 INLINE ~GeomVertexDataPipelineBase();
409 INLINE
Thread *get_current_thread()
const;
411 INLINE
const GeomVertexFormat *get_format()
const;
412 INLINE
bool has_column(
const InternalName *name)
const;
414 INLINE UsageHint get_usage_hint()
const;
415 INLINE
int get_num_arrays()
const;
419 INLINE
const SliderTable *get_slider_table()
const;
420 int get_num_bytes()
const;
426 GeomVertexData::CData *_cdata;
438 INLINE GeomVertexDataPipelineReader(
const GeomVertexDataPipelineReader ©);
439 INLINE
void operator = (
const GeomVertexDataPipelineReader ©);
442 INLINE ~GeomVertexDataPipelineReader();
443 ALLOC_DELETED_CHAIN(GeomVertexDataPipelineReader);
447 INLINE
void check_array_readers()
const;
449 int get_num_rows()
const;
451 bool get_array_info(
const InternalName *name,
453 int &num_values, NumericType &numeric_type,
454 int &start,
int &stride)
const;
456 bool get_array_info(
const InternalName *name,
458 int &num_values, NumericType &numeric_type,
459 int &start,
int &stride,
int &divisor,
460 int &num_elements,
int &element_stride)
const;
462 INLINE
bool has_vertex()
const;
463 INLINE
bool is_vertex_transformed()
const;
465 int &num_values, NumericType &numeric_type,
466 int &start,
int &stride)
const;
468 INLINE
bool has_normal()
const;
470 NumericType &numeric_type,
471 int &start,
int &stride)
const;
473 INLINE
bool has_color()
const;
475 int &num_values, NumericType &numeric_type,
476 int &start,
int &stride)
const;
479 void make_array_readers();
480 void delete_array_readers();
482 bool _got_array_readers;
484 ArrayReaders _array_readers;
490 static void init_type() {
491 register_type(_type_handle,
"GeomVertexDataPipelineReader");
508 INLINE GeomVertexDataPipelineWriter(
const GeomVertexDataPipelineWriter ©);
509 INLINE
void operator = (
const GeomVertexDataPipelineWriter ©);
512 INLINE ~GeomVertexDataPipelineWriter();
513 ALLOC_DELETED_CHAIN(GeomVertexDataPipelineWriter);
517 INLINE
void check_array_writers()
const;
523 int get_num_rows()
const;
524 bool set_num_rows(
int n);
525 bool unclean_set_num_rows(
int n);
526 bool reserve_num_rows(
int n);
529 void make_array_writers();
530 void delete_array_writers();
533 bool _got_array_writers;
535 ArrayWriters _array_writers;
541 static void init_type() {
542 register_type(_type_handle,
"GeomVertexDataPipelineWriter");
549 INLINE ostream &operator << (ostream &out,
const GeomVertexData &obj);
551 #include "geomVertexData.I" This class records a set of integers, where each integer is either present or not present in the set...
The common code from GeomVertexDataPipelineReader and GeomVertexDataPipelineWriter.
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...
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.
virtual TypeHandle get_parent_type() const
Returns the type of the container that owns the CycleData.
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.
This data object is returned by GeomVertexArrayData::get_handle() or modify_handle().
Encapsulates the data from a GeomVertexData, pre-fetched for one stage of the pipeline.
This defines how a single column is interleaved within a vertex array stored within a Geom...
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 ...
A lightweight class that represents a single element that may be timed and/or counted via stats...
Stores the total set of VertexSliders that the vertices in a particular GeomVertexData object might d...
virtual void write_datagram(BamWriter *, Datagram &) const
Writes the contents of this object to the datagram for shipping out to a Bam file.
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(...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
virtual void evict_callback()
Called when the entry is evicted from the cache, this should clean up the owning object appropriately...
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin()...
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class's make_from_bam() method to read in all...
This is the base class for all three-component vectors and points.
This class is similar to CycleDataReader, except it allows reading from a particular stage of the pip...
An STL function object class, this is intended to be used on any ordered collection of class objects ...
This base class provides basic reference counting, but also can be used with a CopyOnWritePointer to ...
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 ...
This object provides the functionality of both a GeomVertexReader and a GeomVertexWriter, combined together into one convenient package.
This is the data for one array of a GeomVertexData structure.