14 #ifndef GEOMVERTEXDATA_H 15 #define GEOMVERTEXDATA_H 77 UsageHint usage_hint);
87 INLINE
const std::string &get_name()
const;
88 void set_name(
const std::string &name);
89 MAKE_PROPERTY(name, get_name, set_name);
91 INLINE UsageHint get_usage_hint()
const;
92 void set_usage_hint(UsageHint usage_hint);
93 MAKE_PROPERTY(usage_hint, get_usage_hint, set_usage_hint);
98 MAKE_PROPERTY(format, get_format, set_format);
102 INLINE
int get_num_rows()
const;
103 INLINE
bool set_num_rows(
int n);
104 INLINE
bool unclean_set_num_rows(
int n);
105 INLINE
bool reserve_num_rows(
int n);
108 INLINE
size_t get_num_arrays()
const;
111 MAKE_SEQ(get_arrays, get_num_arrays, get_array);
115 MAKE_SEQ_PROPERTY(arrays, get_num_arrays, get_array, set_array);
119 INLINE
void clear_transform_table();
120 MAKE_PROPERTY(transform_table, get_transform_table, set_transform_table);
125 INLINE
void clear_transform_blend_table();
127 INLINE
const SliderTable *get_slider_table()
const;
129 INLINE
void clear_slider_table();
130 MAKE_PROPERTY(slider_table, get_slider_table, set_slider_table);
132 INLINE
int get_num_bytes()
const;
133 INLINE
UpdateSeq get_modified(
Thread *current_thread = Thread::get_current_thread())
const;
134 MAKE_PROPERTY(num_bytes, get_num_bytes);
135 MAKE_PROPERTY(modified, get_modified);
137 bool request_resident()
const;
139 void copy_from(
const GeomVertexData *source,
bool keep_data_objects,
140 Thread *current_thread = Thread::get_current_thread());
142 int source_row,
Thread *current_thread);
145 scale_color(
const LVecBase4 &color_scale)
const;
147 scale_color(
const LVecBase4 &color_scale,
int num_components,
148 NumericType numeric_type, Contents contents)
const;
150 set_color(
const LColor &color)
const;
152 set_color(
const LColor &color,
int num_components,
153 NumericType numeric_type, Contents contents)
const;
158 void clear_animated_vertices();
159 void transform_vertices(
const LMatrix4 &mat);
160 void transform_vertices(
const LMatrix4 &mat,
int begin_row,
int end_row);
161 void transform_vertices(
const LMatrix4 &mat,
const SparseArray &rows);
165 NumericType numeric_type, Contents contents)
const;
167 void output(std::ostream &out)
const;
168 void write(std::ostream &out,
int indent_level = 0)
const;
169 void describe_vertex(std::ostream &out,
int row)
const;
172 void clear_cache_stage();
175 static INLINE uint32_t pack_abcd(
unsigned int a,
unsigned int b,
176 unsigned int c,
unsigned int d);
177 static INLINE
unsigned int unpack_abcd_a(uint32_t data);
178 static INLINE
unsigned int unpack_abcd_b(uint32_t data);
179 static INLINE
unsigned int unpack_abcd_c(uint32_t data);
180 static INLINE
unsigned int unpack_abcd_d(uint32_t data);
182 static INLINE uint32_t pack_ufloat(
float a,
float b,
float c);
183 static INLINE
float unpack_ufloat_a(uint32_t data);
184 static INLINE
float unpack_ufloat_b(uint32_t data);
185 static INLINE
float unpack_ufloat_c(uint32_t data);
188 static void do_set_color(
GeomVertexData *vdata,
const LColor &color);
190 static void bytewise_copy(
unsigned char *to,
int to_stride,
191 const unsigned char *from,
int from_stride,
195 packed_argb_to_uint8_rgba(
unsigned char *to,
int to_stride,
196 const unsigned char *from,
int from_stride,
199 uint8_rgba_to_packed_argb(
unsigned char *to,
int to_stride,
200 const unsigned char *from,
int from_stride,
214 class EXPCL_PANDA_GOBJ CDataCache :
public CycleData {
217 INLINE CDataCache(
const CDataCache ©);
218 ALLOC_DELETED_CHAIN(CDataCache);
221 return GeomVertexData::get_class_type();
230 static void init_type() {
251 INLINE
bool operator < (
const CacheKey &other)
const;
266 virtual void output(std::ostream &out)
const;
277 static void init_type() {
278 GeomCacheEntry::init_type();
280 GeomCacheEntry::get_class_type());
290 class EXPCL_PANDA_GOBJ CData :
public CycleData {
295 ALLOC_DELETED_CHAIN(CData);
301 return GeomVertexData::get_class_type();
304 UsageHint _usage_hint;
318 static void init_type() {
337 void update_animated_vertices(CData *cdata,
Thread *current_thread);
339 const LMatrix4 &mat,
int begin_row,
int end_row);
341 const LMatrix4 &mat,
int begin_row,
int end_row);
342 static void table_xform_point3f(
unsigned char *datat,
size_t num_rows,
343 size_t stride,
const LMatrix4f &matf);
344 static void table_xform_normal3f(
unsigned char *datat,
size_t num_rows,
345 size_t stride,
const LMatrix4f &matf);
346 static void table_xform_vector3f(
unsigned char *datat,
size_t num_rows,
347 size_t stride,
const LMatrix4f &matf);
348 static void table_xform_vecbase4f(
unsigned char *datat,
size_t num_rows,
349 size_t stride,
const LMatrix4f &matf);
362 static void register_with_read_factory();
365 virtual bool require_fully_complete()
const;
367 virtual void finalize(
BamReader *manager);
377 static void init_type() {
378 CopyOnWriteObject::init_type();
380 CopyOnWriteObject::get_class_type());
381 CDataCache::init_type();
382 CacheEntry::init_type();
386 return get_class_type();
388 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
393 friend class CacheEntry;
408 GeomVertexData::CData *cdata);
416 INLINE
Thread *get_current_thread()
const;
421 INLINE UsageHint get_usage_hint()
const;
422 INLINE
size_t get_num_arrays()
const;
426 INLINE
const SliderTable *get_slider_table()
const;
427 int get_num_bytes()
const;
433 GeomVertexData::CData *_cdata;
452 INLINE
void check_array_readers()
const;
454 int get_num_rows()
const;
458 int &num_values, NumericType &numeric_type,
459 int &start,
int &stride)
const;
463 int &num_values, NumericType &numeric_type,
464 bool &normalized,
int &start,
int &stride,
int &divisor,
465 int &num_elements,
int &element_stride)
const;
467 INLINE
bool has_vertex()
const;
468 INLINE
bool is_vertex_transformed()
const;
470 int &num_values, NumericType &numeric_type,
471 int &start,
int &stride)
const;
473 INLINE
bool has_normal()
const;
475 NumericType &numeric_type,
476 int &start,
int &stride)
const;
478 INLINE
bool has_color()
const;
480 int &num_values, NumericType &numeric_type,
481 int &start,
int &stride)
const;
484 void make_array_readers();
486 bool _got_array_readers;
494 static void init_type() {
518 INLINE
void check_array_writers()
const;
524 int get_num_rows()
const;
525 bool set_num_rows(
int n);
526 bool unclean_set_num_rows(
int n);
527 bool reserve_num_rows(
int n);
533 void make_array_writers();
534 void delete_array_writers();
536 bool _got_array_writers;
544 static void init_type() {
552 INLINE std::ostream &operator << (std::ostream &out,
const GeomVertexData &obj);
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is our own Panda specialization on the default STL map.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
An STL function object class, this is intended to be used on any ordered collection of pointers to cl...
This is our own Panda specialization on the default STL vector.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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(...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Encodes a string name in a hash table, mapping it to a pointer.
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 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 ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A thread; that is, a lightweight process.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This object provides the functionality of both a GeomVertexReader and a GeomVertexWriter,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the data for one array of a GeomVertexData structure.