Panda3D
Loading...
Searching...
No Matches
geomVertexData.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file geomVertexData.h
10 * @author drose
11 * @date 2005-03-06
12 */
13
14#ifndef GEOMVERTEXDATA_H
15#define GEOMVERTEXDATA_H
16
17#include "pandabase.h"
18#include "copyOnWriteObject.h"
19#include "copyOnWritePointer.h"
20#include "geomVertexFormat.h"
21#include "geomVertexColumn.h"
22#include "geomVertexArrayData.h"
23#include "geomEnums.h"
24#include "geomCacheEntry.h"
25#include "transformTable.h"
26#include "transformBlendTable.h"
27#include "sliderTable.h"
28#include "internalName.h"
29#include "cycleData.h"
31#include "cycleDataReader.h"
32#include "cycleDataWriter.h"
35#include "pipelineCycler.h"
36#include "pStatCollector.h"
37#include "pointerTo.h"
38#include "pmap.h"
39#include "pvector.h"
40#include "deletedChain.h"
41
42class FactoryParams;
45
46/**
47 * This defines the actual numeric vertex data stored in a Geom, in the
48 * structure defined by a particular GeomVertexFormat object.
49 *
50 * The data consists of one or more arrays, each of which in turn consists of
51 * a series of rows, one per vertex. All arrays should have the same number
52 * of rows; each vertex is defined by the column data from a particular row
53 * across all arrays.
54 *
55 * Often, there will be only one array per Geom, and the various columns
56 * defined in the GeomVertexFormat will be interleaved within that array.
57 * However, it is also possible to have multiple different arrays, with a
58 * certain subset of the total columns defined in each array.
59 *
60 * However the data is distributed, the effect is of a single table of
61 * vertices, where each vertex is represented by one row of the table.
62 *
63 * In general, application code should not attempt to directly manipulate the
64 * vertex data through this structure; instead, use the GeomVertexReader,
65 * GeomVertexWriter, and GeomVertexRewriter objects to read and write vertex
66 * data at a high level.
67 */
68class EXPCL_PANDA_GOBJ GeomVertexData : public CopyOnWriteObject, public GeomEnums {
69private:
70 GeomVertexData();
71protected:
72 virtual PT(CopyOnWriteObject) make_cow_copy();
73
74PUBLISHED:
75 explicit GeomVertexData(const std::string &name,
76 const GeomVertexFormat *format,
77 UsageHint usage_hint);
78 GeomVertexData(const GeomVertexData &copy);
79 explicit GeomVertexData(const GeomVertexData &copy,
80 const GeomVertexFormat *format);
81 void operator = (const GeomVertexData &copy);
82 virtual ~GeomVertexData();
83 ALLOC_DELETED_CHAIN(GeomVertexData);
84
85 int compare_to(const GeomVertexData &other) const;
86
87 INLINE const std::string &get_name() const;
88 void set_name(const std::string &name);
89 MAKE_PROPERTY(name, get_name, set_name);
90
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);
94
95 INLINE const GeomVertexFormat *get_format() const;
96 void set_format(const GeomVertexFormat *format);
97 void unclean_set_format(const GeomVertexFormat *format);
98 MAKE_PROPERTY(format, get_format, set_format);
99
100 INLINE bool has_column(const InternalName *name) const;
101
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);
106 void clear_rows();
107
108 INLINE size_t get_num_arrays() const;
109 INLINE CPT(GeomVertexArrayData) get_array(size_t i) const;
110 INLINE CPT(GeomVertexArrayDataHandle) get_array_handle(size_t i) const;
111 MAKE_SEQ(get_arrays, get_num_arrays, get_array);
112 INLINE PT(GeomVertexArrayData) modify_array(size_t i);
113 INLINE PT(GeomVertexArrayDataHandle) modify_array_handle(size_t i);
114 INLINE void set_array(size_t i, const GeomVertexArrayData *array);
115 MAKE_SEQ_PROPERTY(arrays, get_num_arrays, get_array, set_array);
116
117 INLINE const TransformTable *get_transform_table() const;
118 void set_transform_table(const TransformTable *table);
119 INLINE void clear_transform_table();
120 MAKE_PROPERTY(transform_table, get_transform_table, set_transform_table);
121
122 INLINE CPT(TransformBlendTable) get_transform_blend_table() const;
125 INLINE void clear_transform_blend_table();
126
127 INLINE const SliderTable *get_slider_table() const;
128 void set_slider_table(const SliderTable *table);
129 INLINE void clear_slider_table();
130 MAKE_PROPERTY(slider_table, get_slider_table, set_slider_table);
131
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);
136
137 bool request_resident() const;
138
139 void copy_from(const GeomVertexData *source, bool keep_data_objects,
140 Thread *current_thread = Thread::get_current_thread());
141 void copy_row_from(int dest_row, const GeomVertexData *source,
142 int source_row, Thread *current_thread);
143 CPT(GeomVertexData) convert_to(const GeomVertexFormat *new_format) const;
144 CPT(GeomVertexData)
145 scale_color(const LVecBase4 &color_scale) const;
146 CPT(GeomVertexData)
147 scale_color(const LVecBase4 &color_scale, int num_components,
148 NumericType numeric_type, Contents contents) const;
149 CPT(GeomVertexData)
150 set_color(const LColor &color) const;
151 CPT(GeomVertexData)
152 set_color(const LColor &color, int num_components,
153 NumericType numeric_type, Contents contents) const;
154
155 CPT(GeomVertexData) reverse_normals() const;
156
157 CPT(GeomVertexData) animate_vertices(bool force, Thread *current_thread) const;
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);
162
163 PT(GeomVertexData)
164 replace_column(InternalName *name, int num_components,
165 NumericType numeric_type, Contents contents) const;
166
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;
170
171 void clear_cache();
172 void clear_cache_stage();
173
174public:
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);
181
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);
186
187private:
188 static void do_set_color(GeomVertexData *vdata, const LColor &color);
189
190 static void bytewise_copy(unsigned char *to, int to_stride,
191 const unsigned char *from, int from_stride,
192 const GeomVertexColumn *from_type,
193 int num_records);
194 static void
195 packed_argb_to_uint8_rgba(unsigned char *to, int to_stride,
196 const unsigned char *from, int from_stride,
197 int num_records);
198 static void
199 uint8_rgba_to_packed_argb(unsigned char *to, int to_stride,
200 const unsigned char *from, int from_stride,
201 int num_records);
202
203 typedef pmap<const VertexTransform *, int> TransformMap;
204 INLINE static int
205 add_transform(TransformTable *table, const VertexTransform *transform,
206 TransformMap &already_added);
207
208private:
209 std::string _name;
210
211 typedef pvector< COWPT(GeomVertexArrayData) > Arrays;
212
213 // The pipelined data with each CacheEntry.
214 class EXPCL_PANDA_GOBJ CDataCache : public CycleData {
215 public:
216 INLINE CDataCache();
217 INLINE CDataCache(const CDataCache &copy);
218 ALLOC_DELETED_CHAIN(CDataCache);
219 virtual CycleData *make_copy() const;
220 virtual TypeHandle get_parent_type() const {
221 return GeomVertexData::get_class_type();
222 }
223
224 CPT(GeomVertexData) _result;
225
226 public:
227 static TypeHandle get_class_type() {
228 return _type_handle;
229 }
230 static void init_type() {
231 register_type(_type_handle, "GeomVertexData::CDataCache");
232 }
233
234 private:
235 static TypeHandle _type_handle;
236 };
237 typedef CycleDataReader<CDataCache> CDCacheReader;
238 typedef CycleDataWriter<CDataCache> CDCacheWriter;
239
240public:
241 // The CacheKey class separates out just the part of CacheEntry that is used
242 // to key the cache entry within the map. We have this as a separate class
243 // so we can easily look up a new entry in the map, without having to
244 // execute the relatively expensive CacheEntry constructor.
245 class EXPCL_PANDA_GOBJ CacheKey {
246 public:
247 INLINE CacheKey(const GeomVertexFormat *modifier);
248 INLINE CacheKey(const CacheKey &copy);
249 INLINE CacheKey(CacheKey &&from) noexcept;
250
251 INLINE bool operator < (const CacheKey &other) const;
252
253 CPT(GeomVertexFormat) _modifier;
254 };
255 // It is not clear why MSVC7 needs this class to be public.
256 class EXPCL_PANDA_GOBJ CacheEntry : public GeomCacheEntry {
257 public:
258 INLINE CacheEntry(GeomVertexData *source,
259 const GeomVertexFormat *modifier);
260 INLINE CacheEntry(GeomVertexData *source, const CacheKey &key);
261 INLINE CacheEntry(GeomVertexData *source, CacheKey &&key) noexcept;
262
263 ALLOC_DELETED_CHAIN(CacheEntry);
264
265 virtual void evict_callback();
266 virtual void output(std::ostream &out) const;
267
268 GeomVertexData *_source; // A back pointer to the containing data.
269 CacheKey _key;
270
272
273 public:
274 static TypeHandle get_class_type() {
275 return _type_handle;
276 }
277 static void init_type() {
278 GeomCacheEntry::init_type();
279 register_type(_type_handle, "GeomVertexData::CacheEntry",
280 GeomCacheEntry::get_class_type());
281 }
282
283 private:
284 static TypeHandle _type_handle;
285 };
286 typedef pmap<const CacheKey *, PT(CacheEntry), IndirectLess<CacheKey> > Cache;
287
288private:
289 // This is the data that must be cycled between pipeline stages.
290 class EXPCL_PANDA_GOBJ CData : public CycleData {
291 public:
292 INLINE CData();
293 INLINE CData(const GeomVertexFormat *format, UsageHint usage_hint);
294
295 ALLOC_DELETED_CHAIN(CData);
296 virtual CycleData *make_copy() const;
297 virtual void write_datagram(BamWriter *manager, Datagram &dg) const;
298 virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
299 virtual void fillin(DatagramIterator &scan, BamReader *manager);
300 virtual TypeHandle get_parent_type() const {
301 return GeomVertexData::get_class_type();
302 }
303
304 UsageHint _usage_hint;
305 CPT(GeomVertexFormat) _format;
306 Arrays _arrays;
307 CPT(TransformTable) _transform_table;
308 COWPT(TransformBlendTable) _transform_blend_table;
309 CPT(SliderTable) _slider_table;
310 PT(GeomVertexData) _animated_vertices;
311 UpdateSeq _animated_vertices_modified;
312 UpdateSeq _modified;
313
314 public:
315 static TypeHandle get_class_type() {
316 return _type_handle;
317 }
318 static void init_type() {
319 register_type(_type_handle, "GeomVertexData::CData");
320 }
321
322 private:
323 static TypeHandle _type_handle;
324 };
325
326 PipelineCycler<CData> _cycler;
327 typedef CycleDataLockedReader<CData> CDLockedReader;
328 typedef CycleDataReader<CData> CDReader;
329 typedef CycleDataWriter<CData> CDWriter;
330 typedef CycleDataStageReader<CData> CDStageReader;
331 typedef CycleDataStageWriter<CData> CDStageWriter;
332
333 Cache _cache;
334 LightMutex _cache_lock;
335
336private:
337 void update_animated_vertices(CData *cdata, Thread *current_thread);
338 void do_transform_point_column(const GeomVertexFormat *format, GeomVertexRewriter &data,
339 const LMatrix4 &mat, int begin_row, int end_row);
340 void do_transform_vector_column(const GeomVertexFormat *format, GeomVertexRewriter &data,
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);
350
351 static PStatCollector _convert_pcollector;
352 static PStatCollector _scale_color_pcollector;
353 static PStatCollector _set_color_pcollector;
354 static PStatCollector _animation_pcollector;
355
356 PStatCollector _char_pcollector;
357 PStatCollector _skinning_pcollector;
358 PStatCollector _morphs_pcollector;
359 PStatCollector _blends_pcollector;
360
361public:
362 static void register_with_read_factory();
363 virtual void write_datagram(BamWriter *manager, Datagram &dg);
364 virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
365 virtual bool require_fully_complete() const;
366
367 virtual void finalize(BamReader *manager);
368
369protected:
370 static TypedWritable *make_from_bam(const FactoryParams &params);
371 void fillin(DatagramIterator &scan, BamReader *manager);
372
373public:
374 static TypeHandle get_class_type() {
375 return _type_handle;
376 }
377 static void init_type() {
378 CopyOnWriteObject::init_type();
379 register_type(_type_handle, "GeomVertexData",
380 CopyOnWriteObject::get_class_type());
381 CDataCache::init_type();
382 CacheEntry::init_type();
383 CData::init_type();
384 }
385 virtual TypeHandle get_type() const {
386 return get_class_type();
387 }
388 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
389
390private:
391 static TypeHandle _type_handle;
392
393 friend class CacheEntry;
394 friend class GeomVertexDataPipelineBase;
395 friend class GeomVertexDataPipelineReader;
396 friend class GeomVertexDataPipelineWriter;
397};
398
399/**
400 * The common code from GeomVertexDataPipelineReader and
401 * GeomVertexDataPipelineWriter.
402 */
403class EXPCL_PANDA_GOBJ GeomVertexDataPipelineBase : public GeomEnums {
404protected:
405 INLINE GeomVertexDataPipelineBase(Thread *current_thread);
406 INLINE GeomVertexDataPipelineBase(GeomVertexData *object,
407 Thread *current_thread,
408 GeomVertexData::CData *cdata);
409
410public:
411 GeomVertexDataPipelineBase(const GeomVertexDataPipelineBase &copy) = delete;
412 INLINE ~GeomVertexDataPipelineBase();
413
414 GeomVertexDataPipelineBase &operator = (const GeomVertexDataPipelineBase &copy) = delete;
415
416 INLINE Thread *get_current_thread() const;
417
418 INLINE const GeomVertexFormat *get_format() const;
419 INLINE bool has_column(const InternalName *name) const;
420
421 INLINE UsageHint get_usage_hint() const;
422 INLINE size_t get_num_arrays() const;
423 INLINE CPT(GeomVertexArrayData) get_array(size_t i) const;
424 INLINE const TransformTable *get_transform_table() const;
425 INLINE CPT(TransformBlendTable) get_transform_blend_table() const;
426 INLINE const SliderTable *get_slider_table() const;
427 int get_num_bytes() const;
428 INLINE UpdateSeq get_modified() const;
429
430protected:
431 GeomVertexData *_object;
432 Thread *_current_thread;
433 GeomVertexData::CData *_cdata;
434};
435
436/**
437 * Encapsulates the data from a GeomVertexData, pre-fetched for one stage of
438 * the pipeline.
439 * Does not hold a reference to the GeomVertexData, so make sure it does not
440 * go out of scope.
441 */
442class EXPCL_PANDA_GOBJ GeomVertexDataPipelineReader : public GeomVertexDataPipelineBase {
443public:
444 INLINE GeomVertexDataPipelineReader(Thread *current_thread);
445 INLINE GeomVertexDataPipelineReader(const GeomVertexData *object, Thread *current_thread);
446
447 ALLOC_DELETED_CHAIN(GeomVertexDataPipelineReader);
448
449 INLINE void set_object(const GeomVertexData *object);
450 INLINE const GeomVertexData *get_object() const;
451
452 INLINE void check_array_readers() const;
453 INLINE const GeomVertexArrayDataHandle *get_array_reader(int i) const;
454 int get_num_rows() const;
455
456 bool get_array_info(const InternalName *name,
457 const GeomVertexArrayDataHandle *&array_reader,
458 int &num_values, NumericType &numeric_type,
459 int &start, int &stride) const;
460
461 bool get_array_info(const InternalName *name,
462 const GeomVertexArrayDataHandle *&array_reader,
463 int &num_values, NumericType &numeric_type,
464 bool &normalized, int &start, int &stride, int &divisor,
465 int &num_elements, int &element_stride) const;
466
467 INLINE bool has_vertex() const;
468 INLINE bool is_vertex_transformed() const;
469 bool get_vertex_info(const GeomVertexArrayDataHandle *&array_reader,
470 int &num_values, NumericType &numeric_type,
471 int &start, int &stride) const;
472
473 INLINE bool has_normal() const;
474 bool get_normal_info(const GeomVertexArrayDataHandle *&array_reader,
475 NumericType &numeric_type,
476 int &start, int &stride) const;
477
478 INLINE bool has_color() const;
479 bool get_color_info(const GeomVertexArrayDataHandle *&array_reader,
480 int &num_values, NumericType &numeric_type,
481 int &start, int &stride) const;
482
483private:
484 void make_array_readers();
485
486 bool _got_array_readers;
487 typedef pvector<CPT(GeomVertexArrayDataHandle) > ArrayReaders;
488 ArrayReaders _array_readers;
489
490public:
491 static TypeHandle get_class_type() {
492 return _type_handle;
493 }
494 static void init_type() {
495 register_type(_type_handle, "GeomVertexDataPipelineReader");
496 }
497
498private:
499 static TypeHandle _type_handle;
500};
501
502/**
503 * Encapsulates the data from a GeomVertexData, pre-fetched for one stage of
504 * the pipeline.
505 * Does not hold a reference to the GeomVertexData, so make sure it does not
506 * go out of scope.
507 */
508class EXPCL_PANDA_GOBJ GeomVertexDataPipelineWriter : public GeomVertexDataPipelineBase {
509public:
510 INLINE GeomVertexDataPipelineWriter(GeomVertexData *object, bool force_to_0,
511 Thread *current_thread);
512
513 INLINE ~GeomVertexDataPipelineWriter();
514 ALLOC_DELETED_CHAIN(GeomVertexDataPipelineWriter);
515
516 INLINE GeomVertexData *get_object() const;
517
518 INLINE void check_array_writers() const;
519 INLINE GeomVertexArrayDataHandle *get_array_writer(size_t i) const;
520
521 PT(GeomVertexArrayData) modify_array(size_t i);
522 void set_array(size_t i, const GeomVertexArrayData *array);
523
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);
528
529 void copy_row_from(int dest_row, const GeomVertexDataPipelineReader &source,
530 int source_row);
531
532private:
533 void make_array_writers();
534 void delete_array_writers();
535
536 bool _got_array_writers;
537 typedef pvector<PT(GeomVertexArrayDataHandle) > ArrayWriters;
538 ArrayWriters _array_writers;
539
540public:
541 static TypeHandle get_class_type() {
542 return _type_handle;
543 }
544 static void init_type() {
545 register_type(_type_handle, "GeomVertexDataPipelineWriter");
546 }
547
548private:
549 static TypeHandle _type_handle;
550};
551
552INLINE std::ostream &operator << (std::ostream &out, const GeomVertexData &obj);
553
554#include "geomVertexData.I"
555
556#endif
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition bamReader.h:110
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition bamWriter.h:63
A single page of data maintained by a PipelineCycler.
Definition cycleData.h:50
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition datagram.h:38
An instance of this class is passed to the Factory when requesting it to do its business and construc...
This class exists just to provide scoping for the various enumerated types used by Geom,...
Definition geomEnums.h:24
This data object is returned by GeomVertexArrayData::get_handle() or modify_handle().
This is the data for one array of a GeomVertexData structure.
This defines how a single column is interleaved within a vertex array stored within a Geom.
Encapsulates the data from a GeomVertexData, pre-fetched for one stage of the pipeline.
void copy_row_from(int dest_row, const GeomVertexDataPipelineReader &source, int source_row)
Copies a single row of the data from the other array into the indicated row of this array.
virtual void evict_callback()
Called when the entry is evicted from the cache, this should clean up the owning object appropriately...
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
bool set_num_rows(int n)
Sets the length of the array to n rows in all of the various arrays (presumably by adding rows).
void copy_row_from(int dest_row, const GeomVertexData *source, int source_row, Thread *current_thread)
Copies a single row of the data from the other array into the indicated row of this array.
PointerTo< GeomVertexData > replace_column(InternalName *name, int num_components, NumericType numeric_type, Contents contents) const
Returns a new GeomVertexData object, suitable for modification, with the indicated data type replaced...
ConstPointerTo< GeomVertexData > scale_color(const LVecBase4 &color_scale) const
Returns a new GeomVertexData object with the color table modified in-place to apply the indicated sca...
static uint32_t pack_ufloat(float a, float b, float c)
Packs three float values in an unsigned 32-bit int.
get_name
Returns the name passed to the constructor, if any.
int compare_to(const GeomVertexData &other) const
Returns 0 if the two objects are equivalent, even if they are not the same pointer.
get_transform_table
Returns a const pointer to the TransformTable assigned to this data.
void clear_cache_stage()
Removes all of the previously-cached results of convert_to(), at the current pipeline stage and upstr...
static float unpack_ufloat_c(uint32_t data)
Unpacks an unsigned float10 value from an uint32.
set_format
Changes the format of the vertex data.
static float unpack_ufloat_a(uint32_t data)
Unpacks an unsigned float11 value from an uint32.
void clear_transform_table()
Sets the TransformTable pointer to NULL, removing the table from the vertex data.
bool has_column(const InternalName *name) const
Returns true if the data has the named column, false otherwise.
int get_num_rows() const
Returns the number of rows stored within all the arrays.
static float unpack_ufloat_b(uint32_t data)
Unpacks an unsigned float11 value from an uint32.
set_array
Replaces the indicated vertex data array with a completely new array.
bool reserve_num_rows(int n)
This ensures that enough memory space for n rows is allocated, so that you may increase the number of...
void describe_vertex(std::ostream &out, int row) const
Writes a verbose, human-friendly description of the indicated vertex number.
void clear_rows()
Removes all of the rows from the arrays; functionally equivalent to set_num_rows(0) (but faster).
get_num_arrays
Returns the number of individual arrays stored within the data.
get_slider_table
Returns a const pointer to the SliderTable assigned to this data.
set_usage_hint
Changes the UsageHint hint for this vertex data, and for all of the arrays that share this data.
void clear_animated_vertices()
Removes the cache of animated vertices computed by a previous call to animate_vertices() within the s...
set_transform_table
Replaces the TransformTable on this vertex data with the indicated table.
static unsigned int unpack_abcd_b(uint32_t data)
Returns the second packed value from a DirectX-style NT_packed_abcd.
ConstPointerTo< GeomVertexData > convert_to(const GeomVertexFormat *new_format) const
Returns a new GeomVertexData that represents the same contents as this one, with all data types match...
static unsigned int unpack_abcd_a(uint32_t data)
Returns the first packed value from a DirectX-style NT_packed_abcd.
set_slider_table
Replaces the SliderTable on this vertex data with the indicated table.
set_name
Changes the name of the vertex data.
get_num_bytes
Returns the total number of bytes consumed by the different arrays of the vertex data.
ConstPointerTo< GeomVertexData > set_color(const LColor &color) const
Returns a new GeomVertexData object with the color data modified in-place with the new value.
ConstPointerTo< GeomVertexData > animate_vertices(bool force, Thread *current_thread) const
Returns a GeomVertexData that represents the results of computing the vertex animation on the CPU for...
void set_transform_blend_table(const TransformBlendTable *table)
Replaces the TransformBlendTable on this vertex data with the indicated table.
static uint32_t pack_abcd(unsigned int a, unsigned int b, unsigned int c, unsigned int d)
Packs four values in a DirectX-style NT_packed_abcd value.
get_modified
Returns a sequence number which is guaranteed to change at least every time the vertex data is modifi...
static unsigned int unpack_abcd_c(uint32_t data)
Returns the third packed value from a DirectX-style NT_packed_abcd.
static unsigned int unpack_abcd_d(uint32_t data)
Returns the fourth packed value from a DirectX-style NT_packed_abcd.
PointerTo< TransformBlendTable > modify_transform_blend_table()
Returns a modifiable pointer to the current TransformBlendTable on this vertex data,...
get_format
Returns a pointer to the GeomVertexFormat structure that defines this data.
get_usage_hint
Returns the usage hint that was passed to the constructor, and which will be passed to each array dat...
bool unclean_set_num_rows(int n)
This method behaves like set_num_rows(), except the new data is not initialized.
void unclean_set_format(const GeomVertexFormat *format)
Changes the format of the vertex data, without reformatting the data to match.
bool request_resident() const
Returns true if the vertex data is currently resident in memory.
void copy_from(const GeomVertexData *source, bool keep_data_objects, Thread *current_thread=Thread::get_current_thread())
Copies all the data from the other array into the corresponding data types in this array,...
void clear_slider_table()
Sets the SliderTable pointer to NULL, removing the table from the vertex data.
void transform_vertices(const LMatrix4 &mat)
Applies the indicated transform matrix to all of the vertices in the GeomVertexData.
ConstPointerTo< GeomVertexData > reverse_normals() const
Returns a new GeomVertexData object with the normal data modified in-place, so that each lighting nor...
void clear_cache()
Removes all of the previously-cached results of convert_to().
This class defines the physical layout of the vertex data stored within a Geom.
This object provides the functionality of both a GeomVertexReader and a GeomVertexWriter,...
An STL function object class, this is intended to be used on any ordered collection of pointers to cl...
Encodes a string name in a hash table, mapping it to a pointer.
Stores the total set of VertexSliders that the vertices in a particular GeomVertexData object might d...
Definition sliderTable.h:37
This class records a set of integers, where each integer is either present or not present in the set.
Definition sparseArray.h:43
A thread; that is, a lightweight process.
Definition thread.h:46
get_current_thread
Returns a pointer to the currently-executing Thread object.
Definition thread.h:109
This structure collects together the different combinations of transforms and blend amounts used by a...
Stores the total set of VertexTransforms that the vertices in a particular GeomVertexData object migh...
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
Base class for objects that can be written to and read from Bam files.
virtual void finalize(BamReader *manager)
Called by the BamReader to perform any final actions needed for setting up the object after all objec...
virtual bool require_fully_complete() const
Some objects require all of their nested pointers to have been completed before the objects themselve...
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...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
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 is a sequence number that increments monotonically.
Definition updateSeq.h:37
This is an abstract base class that holds a pointer to some transform, computed in some arbitrary way...
STL class.
This is our own Panda specialization on the default STL list.
Definition plist.h:35
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.
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.
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.
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.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
This class maintains different copies of a page of data between stages of the graphics pipeline (or a...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.