Panda3D
geomVertexWriter.I
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 geomVertexWriter.I
10  * @author drose
11  * @date 2005-03-25
12  */
13 
14 /**
15  * Constructs an invalid GeomVertexWriter. You must use the assignment
16  * operator to assign a valid GeomVertexWriter to this object before you can
17  * use it.
18  */
19 INLINE GeomVertexWriter::
20 GeomVertexWriter(Thread *current_thread) :
21  _vertex_data(nullptr),
22  _current_thread(current_thread)
23 {
24  initialize();
25 }
26 
27 /**
28  * Constructs a new writer to process the vertices of the indicated data
29  * object.
30  */
31 INLINE GeomVertexWriter::
32 GeomVertexWriter(GeomVertexData *vertex_data, Thread *current_thread) :
33  _vertex_data(vertex_data),
34  _current_thread(current_thread)
35 {
36  initialize();
37 }
38 
39 /**
40  * Constructs a new writer to process the vertices of the indicated data
41  * object. This flavor creates the writer specifically to process the named
42  * data type.
43  */
44 INLINE GeomVertexWriter::
46  Thread *current_thread) :
47  _vertex_data(vertex_data),
48  _current_thread(current_thread)
49 {
50  initialize();
51  set_column(std::move(name));
52 }
53 
54 /**
55  * Constructs a new writer to process the vertices of the indicated array
56  * only.
57  */
58 INLINE GeomVertexWriter::
60  Thread *current_thread) :
61  _array_data(array_data),
62  _current_thread(current_thread)
63 {
64  initialize();
65 }
66 
67 /**
68  * Constructs a new writer to process the vertices of the indicated array
69  * only.
70  */
71 INLINE GeomVertexWriter::
72 GeomVertexWriter(GeomVertexArrayData *array_data, int column,
73  Thread *current_thread) :
74  _array_data(array_data),
75  _current_thread(current_thread)
76 {
77  initialize();
78  set_column(column);
79 }
80 
81 /**
82  * Constructs a new writer to process the vertices of the indicated data
83  * object. This flavor creates the writer specifically to process the named
84  * data type.
85  */
86 INLINE GeomVertexWriter::
88  const InternalName *name) :
89  _vertex_data(data_writer->get_object()),
90  _current_thread(data_writer->get_current_thread())
91 {
92  initialize();
93  const GeomVertexFormat *format = data_writer->get_format();
94  set_vertex_column(format->get_array_with(name),
95  format->get_column(name),
96  data_writer);
97 }
98 
99 /**
100  *
101  */
102 INLINE GeomVertexWriter::
103 GeomVertexWriter(const GeomVertexWriter &copy) :
104  _vertex_data(copy._vertex_data),
105  _array(copy._array),
106  _array_data(copy._array_data),
107  _current_thread(copy._current_thread),
108  _packer(copy._packer),
109  _stride(copy._stride),
110  _handle(copy._handle),
111  _pointer_begin(copy._pointer_begin),
112  _pointer_end(copy._pointer_end),
113  _pointer(copy._pointer),
114  _start_row(copy._start_row)
115 {
116 }
117 
118 /**
119  *
120  */
121 INLINE void GeomVertexWriter::
122 operator = (const GeomVertexWriter &copy) {
123  _vertex_data = copy._vertex_data;
124  _array = copy._array;
125  _array_data = copy._array_data;
126  _current_thread = copy._current_thread;
127  _packer = copy._packer;
128  _stride = copy._stride;
129  _handle = copy._handle;
130  _pointer_begin = copy._pointer_begin;
131  _pointer_end = copy._pointer_end;
132  _pointer = copy._pointer;
133  _start_row = copy._start_row;
134 }
135 
136 /**
137  *
138  */
139 INLINE GeomVertexWriter::
140 ~GeomVertexWriter() {
141 }
142 
143 /**
144  * Returns the vertex data object that the writer is processing. This may
145  * return NULL if the writer was constructed with just an array pointer.
146  */
149  return _vertex_data;
150 }
151 
152 /**
153  * Returns the particular array object that the writer is currently
154  * processing.
155  */
157 get_array_data() const {
158  return _array_data;
159 }
160 
161 /**
162  * Returns the write handle to the array object that the writer is currently
163  * processing. This low-level call should be used with caution; be careful
164  * with modifying the data in the handle out from under the GeomVertexWriter.
165  */
168  return _handle;
169 }
170 
171 /**
172  * Returns the per-row stride (bytes between consecutive rows) of the
173  * underlying vertex array. This low-level information is normally not needed
174  * to use the GeomVertexWriter directly.
175  */
176 INLINE size_t GeomVertexWriter::
177 get_stride() const {
178  return _stride;
179 }
180 
181 /**
182  * Returns the Thread pointer of the currently-executing thread, as passed to
183  * the constructor of this object.
184  */
187  return _current_thread;
188 }
189 
190 /**
191  * Sets up the writer to use the nth data type of the GeomVertexFormat,
192  * numbering from 0.
193  *
194  * This also resets the write row number to the start row (the same value
195  * passed to a previous call to set_row(), or 0 if set_row() was never
196  * called.)
197  *
198  * The return value is true if the data type is valid, false otherwise.
199  */
200 INLINE bool GeomVertexWriter::
201 set_column(int column) {
202  if (_vertex_data != nullptr) {
203  GeomVertexDataPipelineWriter writer(_vertex_data, true, _current_thread);
204  writer.check_array_writers();
205  const GeomVertexFormat *format = writer.get_format();
206  return set_vertex_column(format->get_array_with(column),
207  format->get_column(column),
208  &writer);
209  }
210  if (_array_data != nullptr) {
211  return set_array_column(_array_data->get_array_format()->get_column(column));
212  }
213  return false;
214 }
215 
216 /**
217  * Sets up the writer to use the data type with the indicated name.
218  *
219  * This also resets the write number to the start row (the same value passed
220  * to a previous call to set_row(), or 0 if set_row() was never called.)
221  *
222  * The return value is true if the data type is valid, false otherwise.
223  */
224 INLINE bool GeomVertexWriter::
226  if (_vertex_data != nullptr) {
227  GeomVertexDataPipelineWriter writer(_vertex_data, true, _current_thread);
228  writer.check_array_writers();
229  const GeomVertexFormat *format = writer.get_format();
230  return set_vertex_column(format->get_array_with(name),
231  format->get_column(name),
232  &writer);
233  }
234  if (_array_data != nullptr) {
235  return set_array_column(_array_data->get_array_format()->get_column(name));
236  }
237  return false;
238 }
239 
240 /**
241  * Resets the GeomVertexWriter to the initial state.
242  */
243 INLINE void GeomVertexWriter::
244 clear() {
245  (*this) = GeomVertexWriter(_current_thread);
246 }
247 
248 /**
249  * Returns true if a valid data type has been successfully set, or false if
250  * the data type does not exist.
251  */
252 INLINE bool GeomVertexWriter::
253 has_column() const {
254  return (_packer != nullptr);
255 }
256 
257 /**
258  * Returns the array index containing the data type that the writer is working
259  * on.
260  */
261 INLINE int GeomVertexWriter::
262 get_array() const {
263  return _array;
264 }
265 
266 /**
267  * Returns the description of the data type that the writer is working on.
268  */
270 get_column() const {
271  if (_packer != nullptr) {
272  return _packer->_column;
273  }
274  return nullptr;
275 }
276 
277 /**
278  * Sets the start row to the indicated value, without internal checks. This
279  * is the same as set_row(), but it does not check for the possibility that
280  * the array has been reallocated internally for some reason; use only when
281  * you are confident that the array is unchanged and you really need every bit
282  * of available performance.
283  */
284 INLINE void GeomVertexWriter::
285 set_row_unsafe(int row) {
286  _start_row = row;
287  if (has_column()) {
288  quick_set_pointer(_start_row);
289  }
290 }
291 
292 /**
293  * Sets the start row to the indicated value. The writer will begin writing
294  * to the indicated row; each subsequent set_data*() call will store the data
295  * into the subsequent row. If set_column() is called, the writer will return
296  * to this row.
297  */
298 INLINE void GeomVertexWriter::
299 set_row(int row) {
300  _start_row = row;
301  if (has_column()) {
302  set_pointer(_start_row);
303  }
304 }
305 
306 /**
307  * Returns the row index at which the writer started. It will return to this
308  * row if you reset the current column.
309  */
310 INLINE int GeomVertexWriter::
311 get_start_row() const {
312  return _start_row;
313 }
314 
315 /**
316  * Returns the row index to which the data will be written at the next call to
317  * set_data*() or add_data*().
318  */
319 INLINE int GeomVertexWriter::
320 get_write_row() const {
321  return (int)(_pointer - _pointer_begin) / _stride;
322 }
323 
324 /**
325  * Returns true if the writer is currently at the end of the list of vertices,
326  * false otherwise. If this is true, another call to set_data*() will result
327  * in a crash, but another call to add_data*() will add a new row.
328  */
329 INLINE bool GeomVertexWriter::
330 is_at_end() const {
331  return _pointer >= _pointer_end;
332 }
333 
334 /**
335  * Sets the write row to a particular 1-component value, and advances the
336  * write row.
337  *
338  * It is an error for the write row to advance past the end of data.
339  */
340 INLINE void GeomVertexWriter::
341 set_data1f(float data) {
342  nassertv(has_column());
343  _packer->set_data1f(inc_pointer(), data);
344 }
345 
346 /**
347  * Sets the write row to a particular 2-component value, and advances the
348  * write row.
349  *
350  * It is an error for the write row to advance past the end of data.
351  */
352 INLINE void GeomVertexWriter::
353 set_data2f(float x, float y) {
354  set_data2f(LVecBase2f(x, y));
355 }
356 
357 /**
358  * Sets the write row to a particular 2-component value, and advances the
359  * write row.
360  *
361  * It is an error for the write row to advance past the end of data.
362  */
363 INLINE void GeomVertexWriter::
364 set_data2f(const LVecBase2f &data) {
365  nassertv(has_column());
366  _packer->set_data2f(inc_pointer(), data);
367 }
368 
369 /**
370  * Sets the write row to a particular 3-component value, and advances the
371  * write row.
372  *
373  * It is an error for the write row to advance past the end of data.
374  */
375 INLINE void GeomVertexWriter::
376 set_data3f(float x, float y, float z) {
377  set_data3f(LVecBase3f(x, y, z));
378 }
379 
380 /**
381  * Sets the write row to a particular 3-component value, and advances the
382  * write row.
383  *
384  * It is an error for the write row to advance past the end of data.
385  */
386 INLINE void GeomVertexWriter::
387 set_data3f(const LVecBase3f &data) {
388  nassertv(has_column());
389  _packer->set_data3f(inc_pointer(), data);
390 }
391 
392 /**
393  * Sets the write row to a particular 4-component value, and advances the
394  * write row.
395  *
396  * It is an error for the write row to advance past the end of data.
397  */
398 INLINE void GeomVertexWriter::
399 set_data4f(float x, float y, float z, float w) {
400  set_data4f(LVecBase4f(x, y, z, w));
401 }
402 
403 /**
404  * Sets the write row to a particular 4-component value, and advances the
405  * write row.
406  *
407  * It is an error for the write row to advance past the end of data.
408  */
409 INLINE void GeomVertexWriter::
410 set_data4f(const LVecBase4f &data) {
411  nassertv(has_column());
412  _packer->set_data4f(inc_pointer(), data);
413 }
414 
415 /**
416  * Sets the write row to a 3-by-3 matrix, and advances the write row. This is
417  * a special method that can only be used on matrix columns.
418  *
419  * It is an error for the write row to advance past the end of data.
420  */
421 INLINE void GeomVertexWriter::
422 set_matrix3f(const LMatrix3f &mat) {
423  nassertv(has_column() &&
424  _packer->_column->get_contents() == C_matrix &&
425  _packer->_column->get_num_elements() == 3);
426 
427  size_t col_stride = _packer->_column->get_element_stride();
428  unsigned char *pointer = inc_pointer();
429 
430  _packer->set_data3f(pointer, mat.get_row(0));
431  pointer += col_stride;
432  _packer->set_data3f(pointer, mat.get_row(1));
433  pointer += col_stride;
434  _packer->set_data3f(pointer, mat.get_row(2));
435 }
436 
437 /**
438  * Sets the write row to a 4-by-4 matrix, and advances the write row. This is
439  * a special method that can only be used on matrix columns.
440  *
441  * It is an error for the write row to advance past the end of data.
442  */
443 INLINE void GeomVertexWriter::
444 set_matrix4f(const LMatrix4f &mat) {
445  nassertv(has_column() &&
446  _packer->_column->get_contents() == C_matrix &&
447  _packer->_column->get_num_elements() == 4);
448 
449  size_t col_stride = _packer->_column->get_element_stride();
450  unsigned char *pointer = inc_pointer();
451 
452  _packer->set_data4f(pointer, mat.get_row(0));
453  pointer += col_stride;
454  _packer->set_data4f(pointer, mat.get_row(1));
455  pointer += col_stride;
456  _packer->set_data4f(pointer, mat.get_row(2));
457  pointer += col_stride;
458  _packer->set_data4f(pointer, mat.get_row(3));
459 }
460 
461 /**
462  * Sets the write row to a particular 1-component value, and advances the
463  * write row.
464  *
465  * It is an error for the write row to advance past the end of data.
466  */
467 INLINE void GeomVertexWriter::
468 set_data1d(double data) {
469  nassertv(has_column());
470  _packer->set_data1d(inc_pointer(), data);
471 }
472 
473 /**
474  * Sets the write row to a particular 2-component value, and advances the
475  * write row.
476  *
477  * It is an error for the write row to advance past the end of data.
478  */
479 INLINE void GeomVertexWriter::
480 set_data2d(double x, double y) {
481  set_data2d(LVecBase2d(x, y));
482 }
483 
484 /**
485  * Sets the write row to a particular 2-component value, and advances the
486  * write row.
487  *
488  * It is an error for the write row to advance past the end of data.
489  */
490 INLINE void GeomVertexWriter::
491 set_data2d(const LVecBase2d &data) {
492  nassertv(has_column());
493  _packer->set_data2d(inc_pointer(), data);
494 }
495 
496 /**
497  * Sets the write row to a particular 3-component value, and advances the
498  * write row.
499  *
500  * It is an error for the write row to advance past the end of data.
501  */
502 INLINE void GeomVertexWriter::
503 set_data3d(double x, double y, double z) {
504  set_data3d(LVecBase3d(x, y, z));
505 }
506 
507 /**
508  * Sets the write row to a particular 3-component value, and advances the
509  * write row.
510  *
511  * It is an error for the write row to advance past the end of data.
512  */
513 INLINE void GeomVertexWriter::
514 set_data3d(const LVecBase3d &data) {
515  nassertv(has_column());
516  _packer->set_data3d(inc_pointer(), data);
517 }
518 
519 /**
520  * Sets the write row to a particular 4-component value, and advances the
521  * write row.
522  *
523  * It is an error for the write row to advance past the end of data.
524  */
525 INLINE void GeomVertexWriter::
526 set_data4d(double x, double y, double z, double w) {
527  set_data4d(LVecBase4d(x, y, z, w));
528 }
529 
530 /**
531  * Sets the write row to a particular 4-component value, and advances the
532  * write row.
533  *
534  * It is an error for the write row to advance past the end of data.
535  */
536 INLINE void GeomVertexWriter::
537 set_data4d(const LVecBase4d &data) {
538  nassertv(has_column());
539  _packer->set_data4d(inc_pointer(), data);
540 }
541 
542 /**
543  * Sets the write row to a 3-by-3 matrix, and advances the write row. This is
544  * a special method that can only be used on matrix columns.
545  *
546  * It is an error for the write row to advance past the end of data.
547  */
548 INLINE void GeomVertexWriter::
549 set_matrix3d(const LMatrix3d &mat) {
550  nassertv(has_column() &&
551  _packer->_column->get_contents() == C_matrix &&
552  _packer->_column->get_num_elements() == 3);
553 
554  size_t col_stride = _packer->_column->get_element_stride();
555  unsigned char *pointer = inc_pointer();
556 
557  _packer->set_data3d(pointer, mat.get_row(0));
558  pointer += col_stride;
559  _packer->set_data3d(pointer, mat.get_row(1));
560  pointer += col_stride;
561  _packer->set_data3d(pointer, mat.get_row(2));
562 }
563 
564 /**
565  * Sets the write row to a 4-by-4 matrix, and advances the write row. This is
566  * a special method that can only be used on matrix columns.
567  *
568  * It is an error for the write row to advance past the end of data.
569  */
570 INLINE void GeomVertexWriter::
571 set_matrix4d(const LMatrix4d &mat) {
572  nassertv(has_column() &&
573  _packer->_column->get_contents() == C_matrix &&
574  _packer->_column->get_num_elements() == 4);
575 
576  size_t col_stride = _packer->_column->get_element_stride();
577  unsigned char *pointer = inc_pointer();
578 
579  _packer->set_data4d(pointer, mat.get_row(0));
580  pointer += col_stride;
581  _packer->set_data4d(pointer, mat.get_row(1));
582  pointer += col_stride;
583  _packer->set_data4d(pointer, mat.get_row(2));
584  pointer += col_stride;
585  _packer->set_data4d(pointer, mat.get_row(3));
586 }
587 
588 /**
589  * Sets the write row to a particular 1-component value, and advances the
590  * write row.
591  *
592  * It is an error for the write row to advance past the end of data.
593  */
594 INLINE void GeomVertexWriter::
595 set_data1(PN_stdfloat data) {
596 #ifndef STDFLOAT_DOUBLE
597  set_data1f(data);
598 #else
599  set_data1d(data);
600 #endif
601 }
602 
603 /**
604  * Sets the write row to a particular 2-component value, and advances the
605  * write row.
606  *
607  * It is an error for the write row to advance past the end of data.
608  */
609 INLINE void GeomVertexWriter::
610 set_data2(PN_stdfloat x, PN_stdfloat y) {
611 #ifndef STDFLOAT_DOUBLE
612  set_data2f(x, y);
613 #else
614  set_data2d(x, y);
615 #endif
616 }
617 
618 /**
619  * Sets the write row to a particular 2-component value, and advances the
620  * write row.
621  *
622  * It is an error for the write row to advance past the end of data.
623  */
624 INLINE void GeomVertexWriter::
625 set_data2(const LVecBase2 &data) {
626 #ifndef STDFLOAT_DOUBLE
627  set_data2f(data);
628 #else
629  set_data2d(data);
630 #endif
631 }
632 
633 /**
634  * Sets the write row to a particular 3-component value, and advances the
635  * write row.
636  *
637  * It is an error for the write row to advance past the end of data.
638  */
639 INLINE void GeomVertexWriter::
640 set_data3(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) {
641 #ifndef STDFLOAT_DOUBLE
642  set_data3f(x, y, z);
643 #else
644  set_data3d(x, y, z);
645 #endif
646 }
647 
648 /**
649  * Sets the write row to a particular 3-component value, and advances the
650  * write row.
651  *
652  * It is an error for the write row to advance past the end of data.
653  */
654 INLINE void GeomVertexWriter::
655 set_data3(const LVecBase3 &data) {
656 #ifndef STDFLOAT_DOUBLE
657  set_data3f(data);
658 #else
659  set_data3d(data);
660 #endif
661 }
662 
663 /**
664  * Sets the write row to a particular 4-component value, and advances the
665  * write row.
666  *
667  * It is an error for the write row to advance past the end of data.
668  */
669 INLINE void GeomVertexWriter::
670 set_data4(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat w) {
671 #ifndef STDFLOAT_DOUBLE
672  set_data4f(x, y, z, w);
673 #else
674  set_data4d(x, y, z, w);
675 #endif
676 }
677 
678 /**
679  * Sets the write row to a particular 4-component value, and advances the
680  * write row.
681  *
682  * It is an error for the write row to advance past the end of data.
683  */
684 INLINE void GeomVertexWriter::
685 set_data4(const LVecBase4 &data) {
686 #ifndef STDFLOAT_DOUBLE
687  set_data4f(data);
688 #else
689  set_data4d(data);
690 #endif
691 }
692 
693 /**
694  * Sets the write row to a 3-by-3 matrix, and advances the write row. This is
695  * a special method that can only be used on matrix columns.
696  *
697  * It is an error for the write row to advance past the end of data.
698  */
699 INLINE void GeomVertexWriter::
700 set_matrix3(const LMatrix3 &mat) {
701 #ifndef STDFLOAT_DOUBLE
702  set_matrix3f(mat);
703 #else
704  set_matrix3d(mat);
705 #endif
706 }
707 
708 /**
709  * Sets the write row to a 4-by-4 matrix, and advances the write row. This is
710  * a special method that can only be used on matrix columns.
711  *
712  * It is an error for the write row to advance past the end of data.
713  */
714 INLINE void GeomVertexWriter::
715 set_matrix4(const LMatrix4 &mat) {
716 #ifndef STDFLOAT_DOUBLE
717  set_matrix4f(mat);
718 #else
719  set_matrix4d(mat);
720 #endif
721 }
722 
723 /**
724  * Sets the write row to a particular 1-component value, and advances the
725  * write row.
726  *
727  * It is an error for the write row to advance past the end of data.
728  */
729 INLINE void GeomVertexWriter::
730 set_data1i(int data) {
731  nassertv(has_column());
732  _packer->set_data1i(inc_pointer(), data);
733 }
734 
735 /**
736  * Sets the write row to a particular 2-component value, and advances the
737  * write row.
738  *
739  * It is an error for the write row to advance past the end of data.
740  */
741 INLINE void GeomVertexWriter::
742 set_data2i(int a, int b) {
743  set_data2i(LVecBase2i(a, b));
744 }
745 
746 /**
747  * Sets the write row to a particular 2-component value, and advances the
748  * write row.
749  *
750  * It is an error for the write row to advance past the end of data.
751  */
752 INLINE void GeomVertexWriter::
753 set_data2i(const LVecBase2i &data) {
754  nassertv(has_column());
755  _packer->set_data2i(inc_pointer(), data);
756 }
757 
758 /**
759  * Sets the write row to a particular 3-component value, and advances the
760  * write row.
761  *
762  * It is an error for the write row to advance past the end of data.
763  */
764 INLINE void GeomVertexWriter::
765 set_data3i(int a, int b, int c) {
766  set_data3i(LVecBase3i(a, b, c));
767 }
768 
769 /**
770  * Sets the write row to a particular 3-component value, and advances the
771  * write row.
772  *
773  * It is an error for the write row to advance past the end of data.
774  */
775 INLINE void GeomVertexWriter::
776 set_data3i(const LVecBase3i &data) {
777  nassertv(has_column());
778  _packer->set_data3i(inc_pointer(), data);
779 }
780 
781 /**
782  * Sets the write row to a particular 4-component value, and advances the
783  * write row.
784  *
785  * It is an error for the write row to advance past the end of data.
786  */
787 INLINE void GeomVertexWriter::
788 set_data4i(int a, int b, int c, int d) {
789  set_data4i(LVecBase4i(a, b, c, d));
790 }
791 
792 /**
793  * Sets the write row to a particular 4-component value, and advances the
794  * write row.
795  *
796  * It is an error for the write row to advance past the end of data.
797  */
798 INLINE void GeomVertexWriter::
799 set_data4i(const LVecBase4i &data) {
800  nassertv(has_column());
801  _packer->set_data4i(inc_pointer(), data);
802 }
803 
804 /**
805  * Sets the write row to a particular 1-component value, and advances the
806  * write row.
807  *
808  * If the write row advances past the end of data, implicitly adds a new row
809  * to the data.
810  */
811 INLINE void GeomVertexWriter::
812 add_data1f(float data) {
813  nassertv(has_column());
814  _packer->set_data1f(inc_add_pointer(), data);
815 }
816 
817 /**
818  * Sets the write row to a particular 2-component value, and advances the
819  * write row.
820  *
821  * If the write row advances past the end of data, implicitly adds a new row
822  * to the data.
823  */
824 INLINE void GeomVertexWriter::
825 add_data2f(float x, float y) {
826  add_data2f(LVecBase2f(x, y));
827 }
828 
829 /**
830  * Sets the write row to a particular 2-component value, and advances the
831  * write row.
832  *
833  * If the write row advances past the end of data, implicitly adds a new row
834  * to the data.
835  */
836 INLINE void GeomVertexWriter::
837 add_data2f(const LVecBase2f &data) {
838  nassertv(has_column());
839  _packer->set_data2f(inc_add_pointer(), data);
840 }
841 
842 /**
843  * Sets the write row to a particular 3-component value, and advances the
844  * write row.
845  *
846  * If the write row advances past the end of data, implicitly adds a new row
847  * to the data.
848  */
849 INLINE void GeomVertexWriter::
850 add_data3f(float x, float y, float z) {
851  add_data3f(LVecBase3f(x, y, z));
852 }
853 
854 /**
855  * Sets the write row to a particular 3-component value, and advances the
856  * write row.
857  *
858  * If the write row advances past the end of data, implicitly adds a new row
859  * to the data.
860  */
861 INLINE void GeomVertexWriter::
862 add_data3f(const LVecBase3f &data) {
863  nassertv(has_column());
864  _packer->set_data3f(inc_add_pointer(), data);
865 }
866 
867 /**
868  * Sets the write row to a particular 4-component value, and advances the
869  * write row.
870  *
871  * If the write row advances past the end of data, implicitly adds a new row
872  * to the data.
873  */
874 INLINE void GeomVertexWriter::
875 add_data4f(float x, float y, float z, float w) {
876  add_data4f(LVecBase4f(x, y, z, w));
877 }
878 
879 /**
880  * Sets the write row to a particular 4-component value, and advances the
881  * write row.
882  *
883  * If the write row advances past the end of data, implicitly adds a new row
884  * to the data.
885  */
886 INLINE void GeomVertexWriter::
887 add_data4f(const LVecBase4f &data) {
888  nassertv(has_column());
889  _packer->set_data4f(inc_add_pointer(), data);
890 }
891 
892 /**
893  * Sets the write row to a 3-by-3 matrix, and advances the write row. This is
894  * a special method that can only be used on matrix columns.
895  *
896  * If the write row advances past the end of data, implicitly adds a new row
897  * to the data.
898  */
899 INLINE void GeomVertexWriter::
900 add_matrix3f(const LMatrix3f &mat) {
901  nassertv(has_column() &&
902  _packer->_column->get_contents() == C_matrix &&
903  _packer->_column->get_num_elements() == 3);
904 
905  size_t col_stride = _packer->_column->get_element_stride();
906  unsigned char *pointer = inc_add_pointer();
907 
908  _packer->set_data3f(pointer, mat.get_row(0));
909  pointer += col_stride;
910  _packer->set_data3f(pointer, mat.get_row(1));
911  pointer += col_stride;
912  _packer->set_data3f(pointer, mat.get_row(2));
913 }
914 
915 /**
916  * Sets the write row to a 4-by-4 matrix, and advances the write row. This is
917  * a special method that can only be used on matrix columns.
918  *
919  * If the write row advances past the end of data, implicitly adds a new row
920  * to the data.
921  */
922 INLINE void GeomVertexWriter::
923 add_matrix4f(const LMatrix4f &mat) {
924  nassertv(has_column() &&
925  _packer->_column->get_contents() == C_matrix &&
926  _packer->_column->get_num_elements() == 4);
927 
928  size_t col_stride = _packer->_column->get_element_stride();
929  unsigned char *pointer = inc_add_pointer();
930 
931  _packer->set_data4f(pointer, mat.get_row(0));
932  pointer += col_stride;
933  _packer->set_data4f(pointer, mat.get_row(1));
934  pointer += col_stride;
935  _packer->set_data4f(pointer, mat.get_row(2));
936  pointer += col_stride;
937  _packer->set_data4f(pointer, mat.get_row(3));
938 }
939 
940 /**
941  * Sets the write row to a particular 1-component value, and advances the
942  * write row.
943  *
944  * If the write row advances past the end of data, implicitly adds a new row
945  * to the data.
946  */
947 INLINE void GeomVertexWriter::
948 add_data1d(double data) {
949  nassertv(has_column());
950  _packer->set_data1d(inc_add_pointer(), data);
951 }
952 
953 /**
954  * Sets the write row to a particular 2-component value, and advances the
955  * write row.
956  *
957  * If the write row advances past the end of data, implicitly adds a new row
958  * to the data.
959  */
960 INLINE void GeomVertexWriter::
961 add_data2d(double x, double y) {
962  add_data2d(LVecBase2d(x, y));
963 }
964 
965 /**
966  * Sets the write row to a particular 2-component value, and advances the
967  * write row.
968  *
969  * If the write row advances past the end of data, implicitly adds a new row
970  * to the data.
971  */
972 INLINE void GeomVertexWriter::
973 add_data2d(const LVecBase2d &data) {
974  nassertv(has_column());
975  _packer->set_data2d(inc_add_pointer(), data);
976 }
977 
978 /**
979  * Sets the write row to a particular 3-component value, and advances the
980  * write row.
981  *
982  * If the write row advances past the end of data, implicitly adds a new row
983  * to the data.
984  */
985 INLINE void GeomVertexWriter::
986 add_data3d(double x, double y, double z) {
987  add_data3d(LVecBase3d(x, y, z));
988 }
989 
990 /**
991  * Sets the write row to a particular 3-component value, and advances the
992  * write row.
993  *
994  * If the write row advances past the end of data, implicitly adds a new row
995  * to the data.
996  */
997 INLINE void GeomVertexWriter::
998 add_data3d(const LVecBase3d &data) {
999  nassertv(has_column());
1000  _packer->set_data3d(inc_add_pointer(), data);
1001 }
1002 
1003 /**
1004  * Sets the write row to a particular 4-component value, and advances the
1005  * write row.
1006  *
1007  * If the write row advances past the end of data, implicitly adds a new row
1008  * to the data.
1009  */
1010 INLINE void GeomVertexWriter::
1011 add_data4d(double x, double y, double z, double w) {
1012  add_data4d(LVecBase4d(x, y, z, w));
1013 }
1014 
1015 /**
1016  * Sets the write row to a particular 4-component value, and advances the
1017  * write row.
1018  *
1019  * If the write row advances past the end of data, implicitly adds a new row
1020  * to the data.
1021  */
1022 INLINE void GeomVertexWriter::
1023 add_data4d(const LVecBase4d &data) {
1024  nassertv(has_column());
1025  _packer->set_data4d(inc_add_pointer(), data);
1026 }
1027 
1028 /**
1029  * Sets the write row to a 3-by-3 matrix, and advances the write row. This is
1030  * a special method that can only be used on matrix columns.
1031  *
1032  * If the write row advances past the end of data, implicitly adds a new row
1033  * to the data.
1034  */
1035 INLINE void GeomVertexWriter::
1036 add_matrix3d(const LMatrix3d &mat) {
1037  nassertv(has_column() &&
1038  _packer->_column->get_contents() == C_matrix &&
1039  _packer->_column->get_num_elements() == 3);
1040 
1041  size_t col_stride = _packer->_column->get_element_stride();
1042  unsigned char *pointer = inc_add_pointer();
1043 
1044  _packer->set_data3d(pointer, mat.get_row(0));
1045  pointer += col_stride;
1046  _packer->set_data3d(pointer, mat.get_row(1));
1047  pointer += col_stride;
1048  _packer->set_data3d(pointer, mat.get_row(2));
1049 }
1050 
1051 /**
1052  * Sets the write row to a 4-by-4 matrix, and advances the write row. This is
1053  * a special method that can only be used on matrix columns.
1054  *
1055  * If the write row advances past the end of data, implicitly adds a new row
1056  * to the data.
1057  */
1058 INLINE void GeomVertexWriter::
1059 add_matrix4d(const LMatrix4d &mat) {
1060  nassertv(has_column() &&
1061  _packer->_column->get_contents() == C_matrix &&
1062  _packer->_column->get_num_elements() == 4);
1063 
1064  size_t col_stride = _packer->_column->get_element_stride();
1065  unsigned char *pointer = inc_add_pointer();
1066 
1067  _packer->set_data4d(pointer, mat.get_row(0));
1068  pointer += col_stride;
1069  _packer->set_data4d(pointer, mat.get_row(1));
1070  pointer += col_stride;
1071  _packer->set_data4d(pointer, mat.get_row(2));
1072  pointer += col_stride;
1073  _packer->set_data4d(pointer, mat.get_row(3));
1074 }
1075 
1076 /**
1077  * Sets the write row to a particular 1-component value, and advances the
1078  * write row.
1079  *
1080  * If the write row advances past the end of data, implicitly adds a new row
1081  * to the data.
1082  */
1083 INLINE void GeomVertexWriter::
1084 add_data1(PN_stdfloat data) {
1085 #ifndef STDFLOAT_DOUBLE
1086  add_data1f(data);
1087 #else
1088  add_data1d(data);
1089 #endif
1090 }
1091 
1092 /**
1093  * Sets the write row to a particular 2-component value, and advances the
1094  * write row.
1095  *
1096  * If the write row advances past the end of data, implicitly adds a new row
1097  * to the data.
1098  */
1099 INLINE void GeomVertexWriter::
1100 add_data2(PN_stdfloat x, PN_stdfloat y) {
1101 #ifndef STDFLOAT_DOUBLE
1102  add_data2f(x, y);
1103 #else
1104  add_data2d(x, y);
1105 #endif
1106 }
1107 
1108 /**
1109  * Sets the write row to a particular 2-component value, and advances the
1110  * write row.
1111  *
1112  * If the write row advances past the end of data, implicitly adds a new row
1113  * to the data.
1114  */
1115 INLINE void GeomVertexWriter::
1116 add_data2(const LVecBase2 &data) {
1117 #ifndef STDFLOAT_DOUBLE
1118  add_data2f(data);
1119 #else
1120  add_data2d(data);
1121 #endif
1122 }
1123 
1124 /**
1125  * Sets the write row to a particular 3-component value, and advances the
1126  * write row.
1127  *
1128  * If the write row advances past the end of data, implicitly adds a new row
1129  * to the data.
1130  */
1131 INLINE void GeomVertexWriter::
1132 add_data3(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) {
1133 #ifndef STDFLOAT_DOUBLE
1134  add_data3f(x, y, z);
1135 #else
1136  add_data3d(x, y, z);
1137 #endif
1138 }
1139 
1140 /**
1141  * Sets the write row to a particular 3-component value, and advances the
1142  * write row.
1143  *
1144  * If the write row advances past the end of data, implicitly adds a new row
1145  * to the data.
1146  */
1147 INLINE void GeomVertexWriter::
1148 add_data3(const LVecBase3 &data) {
1149 #ifndef STDFLOAT_DOUBLE
1150  add_data3f(data);
1151 #else
1152  add_data3d(data);
1153 #endif
1154 }
1155 
1156 /**
1157  * Sets the write row to a particular 4-component value, and advances the
1158  * write row.
1159  *
1160  * If the write row advances past the end of data, implicitly adds a new row
1161  * to the data.
1162  */
1163 INLINE void GeomVertexWriter::
1164 add_data4(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat w) {
1165 #ifndef STDFLOAT_DOUBLE
1166  add_data4f(x, y, z, w);
1167 #else
1168  add_data4d(x, y, z, w);
1169 #endif
1170 }
1171 
1172 /**
1173  * Sets the write row to a particular 4-component value, and advances the
1174  * write row.
1175  *
1176  * If the write row advances past the end of data, implicitly adds a new row
1177  * to the data.
1178  */
1179 INLINE void GeomVertexWriter::
1180 add_data4(const LVecBase4 &data) {
1181 #ifndef STDFLOAT_DOUBLE
1182  add_data4f(data);
1183 #else
1184  add_data4d(data);
1185 #endif
1186 }
1187 
1188 /**
1189  * Sets the write row to a 3-by-3 matrix, and advances the write row. This is
1190  * a special method that can only be used on matrix columns.
1191  *
1192  * If the write row advances past the end of data, implicitly adds a new row
1193  * to the data.
1194  */
1195 INLINE void GeomVertexWriter::
1196 add_matrix3(const LMatrix3 &mat) {
1197 #ifndef STDFLOAT_DOUBLE
1198  add_matrix3f(mat);
1199 #else
1200  add_matrix3d(mat);
1201 #endif
1202 }
1203 
1204 /**
1205  * Sets the write row to a 4-by-4 matrix, and advances the write row. This is
1206  * a special method that can only be used on matrix columns.
1207  *
1208  * If the write row advances past the end of data, implicitly adds a new row
1209  * to the data.
1210  */
1211 INLINE void GeomVertexWriter::
1212 add_matrix4(const LMatrix4 &mat) {
1213 #ifndef STDFLOAT_DOUBLE
1214  add_matrix4f(mat);
1215 #else
1216  add_matrix4d(mat);
1217 #endif
1218 }
1219 
1220 /**
1221  * Sets the write row to a particular 1-component value, and advances the
1222  * write row.
1223  *
1224  * If the write row advances past the end of data, implicitly adds a new row
1225  * to the data.
1226  */
1227 INLINE void GeomVertexWriter::
1228 add_data1i(int data) {
1229  nassertv(has_column());
1230  _packer->set_data1i(inc_add_pointer(), data);
1231 }
1232 
1233 /**
1234  * Sets the write row to a particular 2-component value, and advances the
1235  * write row.
1236  *
1237  * If the write row advances past the end of data, implicitly adds a new row
1238  * to the data.
1239  */
1240 INLINE void GeomVertexWriter::
1241 add_data2i(int a, int b) {
1242  add_data2i(LVecBase2i(a, b));
1243 }
1244 
1245 /**
1246  * Sets the write row to a particular 2-component value, and advances the
1247  * write row.
1248  *
1249  * If the write row advances past the end of data, implicitly adds a new row
1250  * to the data.
1251  */
1252 INLINE void GeomVertexWriter::
1253 add_data2i(const LVecBase2i &data) {
1254  nassertv(has_column());
1255  _packer->set_data2i(inc_add_pointer(), data);
1256 }
1257 
1258 /**
1259  * Sets the write row to a particular 3-component value, and advances the
1260  * write row.
1261  *
1262  * If the write row advances past the end of data, implicitly adds a new row
1263  * to the data.
1264  */
1265 INLINE void GeomVertexWriter::
1266 add_data3i(int a, int b, int c) {
1267  add_data3i(LVecBase3i(a, b, c));
1268 }
1269 
1270 /**
1271  * Sets the write row to a particular 3-component value, and advances the
1272  * write row.
1273  *
1274  * If the write row advances past the end of data, implicitly adds a new row
1275  * to the data.
1276  */
1277 INLINE void GeomVertexWriter::
1278 add_data3i(const LVecBase3i &data) {
1279  nassertv(has_column());
1280  _packer->set_data3i(inc_add_pointer(), data);
1281 }
1282 
1283 /**
1284  * Sets the write row to a particular 4-component value, and advances the
1285  * write row.
1286  *
1287  * If the write row advances past the end of data, implicitly adds a new row
1288  * to the data.
1289  */
1290 INLINE void GeomVertexWriter::
1291 add_data4i(int a, int b, int c, int d) {
1292  add_data4i(LVecBase4i(a, b, c, d));
1293 }
1294 
1295 /**
1296  * Sets the write row to a particular 4-component value, and advances the
1297  * write row.
1298  *
1299  * If the write row advances past the end of data, implicitly adds a new row
1300  * to the data.
1301  */
1302 INLINE void GeomVertexWriter::
1303 add_data4i(const LVecBase4i &data) {
1304  nassertv(has_column());
1305  _packer->set_data4i(inc_add_pointer(), data);
1306 }
1307 
1308 /**
1309  * Returns the writer's Packer object.
1310  */
1311 INLINE GeomVertexColumn::Packer *GeomVertexWriter::
1312 get_packer() const {
1313  return _packer;
1314 }
1315 
1316 /**
1317  * Sets up the array pointers freshly from the source object (in case they
1318  * have been reallocated recently), and sets the internal pointer to the
1319  * indicated row.
1320  */
1321 INLINE void GeomVertexWriter::
1322 set_pointer(int row) {
1323  _pointer_begin = _handle->get_write_pointer();
1324  _pointer_end = _pointer_begin + _handle->get_data_size_bytes();
1325  quick_set_pointer(row);
1326 }
1327 
1328 /**
1329  * Sets up the internal pointer to the indicated row, without first verifying
1330  * that arrays haven't been reallocated.
1331  */
1332 INLINE void GeomVertexWriter::
1333 quick_set_pointer(int row) {
1334  nassertv(has_column());
1335 
1336 #if defined(_DEBUG)
1337  // Make sure we still have the same pointer as stored in the array.
1338  nassertv(_pointer_begin == _handle->get_write_pointer());
1339 #endif
1340 
1341  _pointer = _pointer_begin + _packer->_column->get_start() + _stride * row;
1342 
1343 #if defined(_DEBUG)
1344  // We have to allow the pointer to exceed the end by up to one row's width,
1345  // because the next call might be to add_data_*().
1346  nassertv(_pointer_begin == _pointer_end || (_pointer - _packer->_column->get_start()) <= _pointer_end);
1347 #endif
1348 }
1349 
1350 /**
1351  * Increments to the next row, and returns the data pointer as it was before
1352  * incrementing.
1353  */
1354 INLINE unsigned char *GeomVertexWriter::
1355 inc_pointer() {
1356 #if defined(_DEBUG)
1357  nassertr(_pointer < _pointer_end, empty_buffer);
1358  // Make sure we still have the same pointer as stored in the array.
1359  nassertr(_pointer_begin == _handle->get_write_pointer(), empty_buffer);
1360  nassertr(_pointer < _pointer_begin + _handle->get_data_size_bytes(), empty_buffer);
1361 #endif
1362 
1363  unsigned char *orig_pointer = _pointer;
1364  _pointer += _stride;
1365  return orig_pointer;
1366 }
1367 
1368 /**
1369  * Increments to the next row, and returns the data pointer as it was before
1370  * incrementing. If we are at or past the end of data, implicitly adds more
1371  * rows first.
1372  */
1373 INLINE unsigned char *GeomVertexWriter::
1374 inc_add_pointer() {
1375  if (_pointer >= _pointer_end) {
1376  // Reset the data pointer.
1377  int write_row = get_write_row();
1378 
1379  if (_vertex_data != nullptr) {
1380  // If we have a whole GeomVertexData, we must set the length of all its
1381  // arrays at once.
1382  _handle = nullptr;
1383  GeomVertexDataPipelineWriter writer(_vertex_data, true, _current_thread);
1384  writer.check_array_writers();
1385  writer.set_num_rows(std::max(write_row + 1, writer.get_num_rows()));
1386  _handle = writer.get_array_writer(_array);
1387 
1388  } else {
1389  // Otherwise, we can get away with modifying only the one array we're
1390  // using.
1391  _handle->set_num_rows(std::max(write_row + 1, _handle->get_num_rows()));
1392  }
1393 
1394  set_pointer(write_row);
1395  }
1396  return inc_pointer();
1397 }
void add_data4f(float x, float y, float z, float w)
Sets the write row to a particular 4-component value, and advances the write row.
void add_data1d(double data)
Sets the write row to a particular 1-component value, and advances the write row.
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
void set_matrix3f(const LMatrix3f &mat)
Sets the write row to a 3-by-3 matrix, and advances the write row.
void set_data2i(int a, int b)
Sets the write row to a particular 2-component value, and advances the write row.
void set_matrix4f(const LMatrix4f &mat)
Sets the write row to a 4-by-4 matrix, and advances the write row.
This is a const pointer to an InternalName, and should be used in lieu of a CPT(InternalName) in func...
Definition: internalName.h:193
void add_data2i(int a, int b)
Sets the write row to a particular 2-component value, and advances the write row.
void set_data3i(int a, int b, int c)
Sets the write row to a particular 3-component value, and advances the write row.
void add_data1i(int data)
Sets the write row to a particular 1-component value, and advances the write row.
void set_data3(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Sets the write row to a particular 3-component value, and advances the write row.
void add_data2f(float x, float y)
Sets the write row to a particular 2-component value, and advances the write row.
void set_data4i(int a, int b, int c, int d)
Sets the write row to a particular 4-component value, and advances the write row.
void clear()
Resets the GeomVertexWriter to the initial state.
int get_array() const
Returns the array index containing the data type that the writer is working on.
void add_data2(PN_stdfloat x, PN_stdfloat y)
Sets the write row to a particular 2-component value, and advances the write row.
void set_data1i(int data)
Sets the write row to a particular 1-component value, and advances the write row.
void set_matrix3(const LMatrix3 &mat)
Sets the write row to a 3-by-3 matrix, and advances the write row.
void add_data3i(int a, int b, int c)
Sets the write row to a particular 3-component value, and advances the write row.
This data object is returned by GeomVertexArrayData::get_handle() or modify_handle().
void add_data4(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat w)
Sets the write row to a particular 4-component value, and advances the write row.
void set_data2d(double x, double y)
Sets the write row to a particular 2-component value, and advances the write row.
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.
void add_data2d(double x, double y)
Sets the write row to a particular 2-component value, and advances the write row.
void set_data2(PN_stdfloat x, PN_stdfloat y)
Sets the write row to a particular 2-component value, and advances the write row.
void add_data1f(float data)
Sets the write row to a particular 1-component value, and advances the write row.
GeomVertexArrayDataHandle * get_array_handle() const
Returns the write handle to the array object that the writer is currently processing.
void set_data3f(float x, float y, float z)
Sets the write row to a particular 3-component value, and advances the write row.
bool is_at_end() const
Returns true if the writer is currently at the end of the list of vertices, false otherwise.
void set_data3d(double x, double y, double z)
Sets the write row to a particular 3-component value, and advances the write row.
void set_data1f(float data)
Sets the write row to a particular 1-component value, and advances the write row.
void set_data4d(double x, double y, double z, double w)
Sets the write row to a particular 4-component value, and advances the write row.
void add_data4d(double x, double y, double z, double w)
Sets the write row to a particular 4-component value, and advances the write row.
void set_data4f(float x, float y, float z, float w)
Sets the write row to a particular 4-component value, and advances the write row.
size_t get_stride() const
Returns the per-row stride (bytes between consecutive rows) of the underlying vertex array.
get_column
Returns the ith column of the specification, across all arrays.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
void set_data1(PN_stdfloat data)
Sets the write row to a particular 1-component value, and advances the write row.
void add_data3(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Sets the write row to a particular 3-component value, and advances the write row.
void set_data4(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat w)
Sets the write row to a particular 4-component value, and advances the write row.
int get_array_with(size_t i) const
Returns the index number of the array with the ith column.
void add_matrix4(const LMatrix4 &mat)
Sets the write row to a 4-by-4 matrix, and advances the write row.
void add_data3d(double x, double y, double z)
Sets the write row to a particular 3-component value, and advances the write row.
Encodes a string name in a hash table, mapping it to a pointer.
Definition: internalName.h:38
void add_matrix4f(const LMatrix4f &mat)
Sets the write row to a 4-by-4 matrix, and advances the write row.
void add_data3f(float x, float y, float z)
Sets the write row to a particular 3-component value, and advances the write row.
This class defines the physical layout of the vertex data stored within a Geom.
void add_matrix3(const LMatrix3 &mat)
Sets the write row to a 3-by-3 matrix, and advances the write row.
void add_data1(PN_stdfloat data)
Sets the write row to a particular 1-component value, and advances the write row.
void add_matrix3d(const LMatrix3d &mat)
Sets the write row to a 3-by-3 matrix, and advances the write row.
bool has_column() const
Returns true if a valid data type has been successfully set, or false if the data type does not exist...
void set_matrix3d(const LMatrix3d &mat)
Sets the write row to a 3-by-3 matrix, and advances the write row.
A thread; that is, a lightweight process.
Definition: thread.h:46
Thread * get_current_thread() const
Returns the Thread pointer of the currently-executing thread, as passed to the constructor of this ob...
void set_matrix4(const LMatrix4 &mat)
Sets the write row to a 4-by-4 matrix, and advances the write row.
void set_matrix4d(const LMatrix4d &mat)
Sets the write row to a 4-by-4 matrix, and advances the write row.
GeomVertexArrayData * get_array_data() const
Returns the particular array object that the writer is currently processing.
void set_data2f(float x, float y)
Sets the write row to a particular 2-component value, and advances the write row.
void add_matrix3f(const LMatrix3f &mat)
Sets the write row to a 3-by-3 matrix, and advances the write row.
bool set_column(int column)
Sets up the writer to use the nth data type of the GeomVertexFormat, numbering from 0.
void set_row(int row)
Sets the start row to the indicated value.
GeomVertexData * get_vertex_data() const
Returns the vertex data object that the writer is processing.
void add_matrix4d(const LMatrix4d &mat)
Sets the write row to a 4-by-4 matrix, and advances the write row.
void set_data1d(double data)
Sets the write row to a particular 1-component value, and advances the write row.
GeomVertexWriter(Thread *current_thread=Thread::get_current_thread())
Constructs an invalid GeomVertexWriter.
int get_write_row() const
Returns the row index to which the data will be written at the next call to set_data*() or add_data*(...
int get_start_row() const
Returns the row index at which the writer started.
This is the data for one array of a GeomVertexData structure.
void set_row_unsafe(int row)
Sets the start row to the indicated value, without internal checks.
const GeomVertexColumn * get_column() const
Returns the description of the data type that the writer is working on.
void add_data4i(int a, int b, int c, int d)
Sets the write row to a particular 4-component value, and advances the write row.