Panda3D

geomVertexData.I

00001 // Filename: geomVertexData.I
00002 // Created by:  drose (06Mar05)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: GeomVertexData::get_name
00018 //       Access: Published
00019 //  Description: Returns the name passed to the constructor, if any.
00020 //               This name is reported on the PStats graph for vertex
00021 //               computations.
00022 ////////////////////////////////////////////////////////////////////
00023 INLINE const string &GeomVertexData::
00024 get_name() const {
00025   return _name;
00026 }
00027 
00028 ////////////////////////////////////////////////////////////////////
00029 //     Function: GeomVertexData::get_usage_hint
00030 //       Access: Published
00031 //  Description: Returns the usage hint that was passed to the
00032 //               constructor, and which will be passed to each array
00033 //               data object created initially, and arrays created as
00034 //               the result of a convert_to() operation.  See
00035 //               geomEnums.h.
00036 //
00037 //               However, each individual array may be replaced with a
00038 //               different array object with an independent usage hint
00039 //               specified, so there is no guarantee that the
00040 //               individual arrays all have the same usage_hint.
00041 ////////////////////////////////////////////////////////////////////
00042 INLINE GeomVertexData::UsageHint GeomVertexData::
00043 get_usage_hint() const {
00044   CDReader cdata(_cycler);
00045   return cdata->_usage_hint;
00046 }
00047 
00048 ////////////////////////////////////////////////////////////////////
00049 //     Function: GeomVertexData::get_format
00050 //       Access: Published
00051 //  Description: Returns a pointer to the GeomVertexFormat structure
00052 //               that defines this data.
00053 ////////////////////////////////////////////////////////////////////
00054 INLINE const GeomVertexFormat *GeomVertexData::
00055 get_format() const {
00056   CDReader cdata(_cycler);
00057   return cdata->_format;
00058 }
00059 
00060 ////////////////////////////////////////////////////////////////////
00061 //     Function: GeomVertexData::has_column
00062 //       Access: Published
00063 //  Description: Returns true if the data has the named column,
00064 //               false otherwise.  This is really just a shortcut for
00065 //               asking the same thing from the format.
00066 ////////////////////////////////////////////////////////////////////
00067 INLINE bool GeomVertexData::
00068 has_column(const InternalName *name) const {
00069   CDReader cdata(_cycler);
00070   return cdata->_format->has_column(name);
00071 }
00072 
00073 ////////////////////////////////////////////////////////////////////
00074 //     Function: GeomVertexData::get_num_rows
00075 //       Access: Published
00076 //  Description: Returns the number of rows stored within all the
00077 //               arrays.  All arrays store data for the same n
00078 //               rows.
00079 ////////////////////////////////////////////////////////////////////
00080 INLINE int GeomVertexData::
00081 get_num_rows() const {
00082   GeomVertexDataPipelineReader reader(this, Thread::get_current_thread());
00083   reader.check_array_readers();
00084   return reader.get_num_rows();
00085 }
00086 
00087 ////////////////////////////////////////////////////////////////////
00088 //     Function: GeomVertexData::set_num_rows
00089 //       Access: Published
00090 //  Description: Sets the length of the array to n rows in all of
00091 //               the various arrays (presumably by adding rows).
00092 //
00093 //               The new vertex data is initialized to 0, except for
00094 //               the "color" column, which is initialized to (1, 1, 1,
00095 //               1).
00096 //
00097 //               The return value is true if the number of rows
00098 //               was changed, false if the object already contained n
00099 //               rows (or if there was some error).
00100 //
00101 //               Although this method is Published, application code
00102 //               only very rarely has any need to call it.  Instead,
00103 //               you should use the GeomVertexWriter to build up the
00104 //               rows in a GeomVertexData object automatically,
00105 //               without need to explicitly set the number of
00106 //               rows.
00107 //
00108 //               Don't call this in a downstream thread unless you
00109 //               don't mind it blowing away other changes you might
00110 //               have recently made in an upstream thread.
00111 ////////////////////////////////////////////////////////////////////
00112 INLINE bool GeomVertexData::
00113 set_num_rows(int n) {
00114   GeomVertexDataPipelineWriter writer(this, true, Thread::get_current_thread());
00115   writer.check_array_writers();
00116   return writer.set_num_rows(n);
00117 }
00118 
00119 ////////////////////////////////////////////////////////////////////
00120 //     Function: GeomVertexData::unclean_set_num_rows
00121 //       Access: Published
00122 //  Description: This method behaves like set_num_rows(), except the
00123 //               new data is not initialized.  Furthermore, after this
00124 //               call, *any* of the data in the GeomVertexData may be
00125 //               uninitialized, including the earlier rows.
00126 //
00127 //               This is intended for applications that are about to
00128 //               completely fill the GeomVertexData with new data
00129 //               anyway; it provides a tiny performance boost over
00130 //               set_num_rows().
00131 //
00132 //               Although this method is Published, application code
00133 //               only very rarely has any need to call it.  Instead,
00134 //               you should use the GeomVertexWriter to build up the
00135 //               rows in a GeomVertexData object automatically,
00136 //               without need to explicitly set the number of
00137 //               rows.
00138 ////////////////////////////////////////////////////////////////////
00139 INLINE bool GeomVertexData::
00140 unclean_set_num_rows(int n) {
00141   GeomVertexDataPipelineWriter writer(this, true, Thread::get_current_thread());
00142   writer.check_array_writers();
00143   return writer.unclean_set_num_rows(n);
00144 }
00145 
00146 ////////////////////////////////////////////////////////////////////
00147 //     Function: GeomVertexData::get_num_arrays
00148 //       Access: Published
00149 //  Description: Returns the number of individual arrays stored within
00150 //               the data.  This must match
00151 //               get_format()->get_num_arrays().
00152 ////////////////////////////////////////////////////////////////////
00153 INLINE int GeomVertexData::
00154 get_num_arrays() const {
00155   CDReader cdata(_cycler);
00156   return cdata->_arrays.size();
00157 }
00158 
00159 ////////////////////////////////////////////////////////////////////
00160 //     Function: GeomVertexData::get_array
00161 //       Access: Published
00162 //  Description: Returns a const pointer to the vertex data for the
00163 //               indicated array, for application code to directly
00164 //               examine (but not modify) the underlying vertex data.
00165 ////////////////////////////////////////////////////////////////////
00166 INLINE CPT(GeomVertexArrayData) GeomVertexData::
00167 get_array(int i) const {
00168   CDReader cdata(_cycler);
00169   nassertr(i >= 0 && i < (int)cdata->_arrays.size(), NULL);
00170   return cdata->_arrays[i].get_read_pointer();
00171 }
00172 
00173 ////////////////////////////////////////////////////////////////////
00174 //     Function: GeomVertexData::modify_array
00175 //       Access: Published
00176 //  Description: Returns a modifiable pointer to the indicated vertex
00177 //               array, so that application code may directly
00178 //               manipulate the data.  You should avoid changing
00179 //               the length of this array, since all of the arrays
00180 //               should be kept in sync--use set_num_rows()
00181 //               instead.
00182 //
00183 //               Don't call this in a downstream thread unless you
00184 //               don't mind it blowing away other changes you might
00185 //               have recently made in an upstream thread.
00186 ////////////////////////////////////////////////////////////////////
00187 INLINE PT(GeomVertexArrayData) GeomVertexData::
00188 modify_array(int i) {
00189   GeomVertexDataPipelineWriter writer(this, true, Thread::get_current_thread());
00190   return writer.modify_array(i);
00191 }
00192 
00193 ////////////////////////////////////////////////////////////////////
00194 //     Function: GeomVertexData::set_array
00195 //       Access: Published
00196 //  Description: Replaces the indicated vertex data array with
00197 //               a completely new array.  You should be careful that
00198 //               the new array has the same length and format as the
00199 //               old one, unless you know what you are doing.
00200 //
00201 //               Don't call this in a downstream thread unless you
00202 //               don't mind it blowing away other changes you might
00203 //               have recently made in an upstream thread.
00204 ////////////////////////////////////////////////////////////////////
00205 INLINE void GeomVertexData::
00206 set_array(int i, const GeomVertexArrayData *array) {
00207   GeomVertexDataPipelineWriter writer(this, true, Thread::get_current_thread());
00208   writer.set_array(i, array);
00209 }
00210 
00211 ////////////////////////////////////////////////////////////////////
00212 //     Function: GeomVertexData::get_transform_table
00213 //       Access: Published
00214 //  Description: Returns a const pointer to the TransformTable
00215 //               assigned to this data.  Vertices within the table
00216 //               will index into this table to indicate their
00217 //               dynamic skinning information; this table is used when
00218 //               the vertex animation is to be performed by the
00219 //               graphics hardware (but also see
00220 //               get_transform_blend_table()).
00221 //
00222 //               This will return NULL if the vertex data does not
00223 //               have a TransformTable assigned (which implies the
00224 //               vertices will not be animated by the graphics
00225 //               hardware).
00226 ////////////////////////////////////////////////////////////////////
00227 INLINE const TransformTable *GeomVertexData::
00228 get_transform_table() const {
00229   CDReader cdata(_cycler);
00230   return cdata->_transform_table;
00231 }
00232 
00233 ////////////////////////////////////////////////////////////////////
00234 //     Function: GeomVertexData::clear_transform_table
00235 //       Access: Published
00236 //  Description: Sets the TransformTable pointer to NULL,
00237 //               removing the table from the vertex data.  This
00238 //               disables hardware-driven vertex animation.
00239 ////////////////////////////////////////////////////////////////////
00240 INLINE void GeomVertexData::
00241 clear_transform_table() {
00242   set_transform_table(NULL);
00243 }
00244 
00245 ////////////////////////////////////////////////////////////////////
00246 //     Function: GeomVertexData::get_transform_blend_table
00247 //       Access: Published
00248 //  Description: Returns a const pointer to the TransformBlendTable
00249 //               assigned to this data.  Vertices within the table
00250 //               will index into this table to indicate their
00251 //               dynamic skinning information; this table is used when
00252 //               the vertex animation is to be performed by the CPU
00253 //               (but also see get_transform_table()).
00254 //
00255 //               This will return NULL if the vertex data does not
00256 //               have a TransformBlendTable assigned (which implies
00257 //               the vertices will not be animated by the CPU).
00258 ////////////////////////////////////////////////////////////////////
00259 INLINE CPT(TransformBlendTable) GeomVertexData::
00260 get_transform_blend_table() const {
00261   CDReader cdata(_cycler);
00262   return cdata->_transform_blend_table.get_read_pointer();
00263 }
00264 
00265 ////////////////////////////////////////////////////////////////////
00266 //     Function: GeomVertexData::clear_transform_blend_table
00267 //       Access: Published
00268 //  Description: Sets the TransformBlendTable pointer to NULL,
00269 //               removing the table from the vertex data.  This
00270 //               disables CPU-driven vertex animation.
00271 ////////////////////////////////////////////////////////////////////
00272 INLINE void GeomVertexData::
00273 clear_transform_blend_table() {
00274   set_transform_blend_table(NULL);
00275 }
00276 
00277 ////////////////////////////////////////////////////////////////////
00278 //     Function: GeomVertexData::get_slider_table
00279 //       Access: Published
00280 //  Description: Returns a const pointer to the SliderTable
00281 //               assigned to this data.  Vertices within the vertex
00282 //               data will look up their morph offsets, if any, within
00283 //               this table.
00284 //
00285 //               This will return NULL if the vertex data does not
00286 //               have a SliderTable assigned.
00287 ////////////////////////////////////////////////////////////////////
00288 INLINE const SliderTable *GeomVertexData::
00289 get_slider_table() const {
00290   CDReader cdata(_cycler);
00291   return cdata->_slider_table;
00292 }
00293 
00294 ////////////////////////////////////////////////////////////////////
00295 //     Function: GeomVertexData::clear_slider_table
00296 //       Access: Published
00297 //  Description: Sets the SliderTable pointer to NULL,
00298 //               removing the table from the vertex data.  This
00299 //               disables morph (blend shape) animation.
00300 ////////////////////////////////////////////////////////////////////
00301 INLINE void GeomVertexData::
00302 clear_slider_table() {
00303   set_slider_table(NULL);
00304 }
00305 
00306 ////////////////////////////////////////////////////////////////////
00307 //     Function: GeomVertexData::get_num_bytes
00308 //       Access: Published
00309 //  Description: Returns the total number of bytes consumed by the
00310 //               different arrays of the vertex data.
00311 ////////////////////////////////////////////////////////////////////
00312 INLINE int GeomVertexData::
00313 get_num_bytes() const {
00314   GeomVertexDataPipelineReader reader(this, Thread::get_current_thread());
00315   return reader.get_num_bytes();
00316 }
00317 
00318 ////////////////////////////////////////////////////////////////////
00319 //     Function: GeomVertexData::get_modified
00320 //       Access: Published
00321 //  Description: Returns a sequence number which is guaranteed to
00322 //               change at least every time the vertex data is
00323 //               modified.
00324 ////////////////////////////////////////////////////////////////////
00325 INLINE UpdateSeq GeomVertexData::
00326 get_modified(Thread *current_thread) const {
00327   CDReader cdata(_cycler, current_thread);
00328   return cdata->_modified;
00329 }
00330 
00331 ////////////////////////////////////////////////////////////////////
00332 //     Function: GeomVertexData::pack_abcd
00333 //       Access: Public, Static
00334 //  Description: Packs four values in a DirectX-style NT_packed_abcd
00335 //               value.
00336 ////////////////////////////////////////////////////////////////////
00337 INLINE PN_uint32 GeomVertexData::
00338 pack_abcd(unsigned int a, unsigned int b,
00339           unsigned int c, unsigned int d) {
00340   return (((a & 0xff) << 24) |
00341           ((b & 0xff) << 16) |
00342           ((c & 0xff) << 8) |
00343           (d & 0xff));
00344 }
00345 
00346 ////////////////////////////////////////////////////////////////////
00347 //     Function: GeomVertexData::unpack_abcd_a
00348 //       Access: Public, Static
00349 //  Description: Returns the first packed value from a DirectX-style
00350 //               NT_packed_abcd.
00351 ////////////////////////////////////////////////////////////////////
00352 INLINE unsigned int GeomVertexData::
00353 unpack_abcd_a(PN_uint32 data) {
00354   return (data >> 24) & 0xff;
00355 }
00356 
00357 ////////////////////////////////////////////////////////////////////
00358 //     Function: GeomVertexData::unpack_abcd_b
00359 //       Access: Public, Static
00360 //  Description: Returns the second packed value from a DirectX-style
00361 //               NT_packed_abcd.
00362 ////////////////////////////////////////////////////////////////////
00363 INLINE unsigned int GeomVertexData::
00364 unpack_abcd_b(PN_uint32 data) {
00365   return (data >> 16) & 0xff;
00366 }
00367 
00368 ////////////////////////////////////////////////////////////////////
00369 //     Function: GeomVertexData::unpack_abcd_c
00370 //       Access: Public, Static
00371 //  Description: Returns the third packed value from a DirectX-style
00372 //               NT_packed_abcd.
00373 ////////////////////////////////////////////////////////////////////
00374 INLINE unsigned int GeomVertexData::
00375 unpack_abcd_c(PN_uint32 data) {
00376   return (data >> 8) & 0xff;
00377 }
00378 
00379 ////////////////////////////////////////////////////////////////////
00380 //     Function: GeomVertexData::unpack_abcd_d
00381 //       Access: Public, Static
00382 //  Description: Returns the fourth packed value from a DirectX-style
00383 //               NT_packed_abcd.
00384 ////////////////////////////////////////////////////////////////////
00385 INLINE unsigned int GeomVertexData::
00386 unpack_abcd_d(PN_uint32 data) {
00387   return data & 0xff;
00388 }
00389 
00390 ////////////////////////////////////////////////////////////////////
00391 //     Function: GeomVertexData::add_transform
00392 //       Access: Private, Static
00393 //  Description: Adds the indicated transform to the table, if it is
00394 //               not already there, and returns its index number.
00395 ////////////////////////////////////////////////////////////////////
00396 INLINE int GeomVertexData::
00397 add_transform(TransformTable *table, const VertexTransform *transform,
00398               TransformMap &already_added) {
00399   pair<TransformMap::iterator, bool> result = already_added.insert(TransformMap::value_type(transform, table->get_num_transforms()));
00400   
00401   if (result.second) {
00402     table->add_transform(transform);
00403   }
00404 
00405   return (*(result.first)).second;
00406 }
00407 
00408 ////////////////////////////////////////////////////////////////////
00409 //     Function: GeomVertexData::CDataCache::Constructor
00410 //       Access: Public
00411 //  Description: 
00412 ////////////////////////////////////////////////////////////////////
00413 INLINE GeomVertexData::CDataCache::
00414 CDataCache() {
00415 }
00416 
00417 ////////////////////////////////////////////////////////////////////
00418 //     Function: GeomVertexData::CDataCache::Copy Constructor
00419 //       Access: Public
00420 //  Description: 
00421 ////////////////////////////////////////////////////////////////////
00422 INLINE GeomVertexData::CDataCache::
00423 CDataCache(const GeomVertexData::CDataCache &copy) :
00424   _result(copy._result)
00425 {
00426 }
00427 
00428 ////////////////////////////////////////////////////////////////////
00429 //     Function: GeomVertexData::CacheKey::Constructor
00430 //       Access: Public
00431 //  Description: 
00432 ////////////////////////////////////////////////////////////////////
00433 INLINE GeomVertexData::CacheKey::
00434 CacheKey(const GeomVertexFormat *modifier) :
00435   _modifier(modifier)
00436 {
00437 }
00438 
00439 ////////////////////////////////////////////////////////////////////
00440 //     Function: GeomVertexData::CacheKey::operator <
00441 //       Access: Public
00442 //  Description: Provides a unique ordering within the set.
00443 ////////////////////////////////////////////////////////////////////
00444 INLINE bool GeomVertexData::CacheKey::
00445 operator < (const CacheKey &other) const {
00446   return _modifier < other._modifier;
00447 }
00448 
00449 ////////////////////////////////////////////////////////////////////
00450 //     Function: GeomVertexData::CacheEntry::Constructor
00451 //       Access: Public
00452 //  Description: 
00453 ////////////////////////////////////////////////////////////////////
00454 INLINE GeomVertexData::CacheEntry::
00455 CacheEntry(GeomVertexData *source, const GeomVertexFormat *modifier) :
00456   _source(source),
00457   _key(modifier)
00458 {
00459 }
00460 
00461 ////////////////////////////////////////////////////////////////////
00462 //     Function: GeomVertexData::CData::Constructor
00463 //       Access: Public
00464 //  Description:
00465 ////////////////////////////////////////////////////////////////////
00466 INLINE GeomVertexData::CData::
00467 CData() :
00468   _usage_hint(UH_unspecified)
00469 {
00470 }
00471 
00472 ////////////////////////////////////////////////////////////////////
00473 //     Function: GeomVertexData::CData::Copy Constructor
00474 //       Access: Public
00475 //  Description:
00476 ////////////////////////////////////////////////////////////////////
00477 INLINE GeomVertexData::CData::
00478 CData(const GeomVertexData::CData &copy) :
00479   _usage_hint(copy._usage_hint),
00480   _format(copy._format),
00481   _arrays(copy._arrays),
00482   _transform_table(copy._transform_table),
00483   _transform_blend_table(copy._transform_blend_table),
00484   _slider_table(copy._slider_table),
00485   _animated_vertices(copy._animated_vertices),
00486   _animated_vertices_modified(copy._animated_vertices_modified),
00487   _modified(copy._modified)
00488 {
00489 }
00490 
00491 ////////////////////////////////////////////////////////////////////
00492 //     Function: GeomVertexDataPipelineBase::Constructor
00493 //       Access: Public
00494 //  Description:
00495 ////////////////////////////////////////////////////////////////////
00496 INLINE GeomVertexDataPipelineBase::
00497 GeomVertexDataPipelineBase(GeomVertexData *object, 
00498                            Thread *current_thread,
00499                            GeomVertexData::CData *cdata) :
00500   _object(object),
00501   _current_thread(current_thread),
00502   _cdata(cdata)
00503 {
00504 #ifdef _DEBUG
00505   nassertv(_object->test_ref_count_nonzero());
00506 #endif // _DEBUG
00507 #ifdef DO_PIPELINING
00508   _cdata->ref();
00509 #endif  // DO_PIPELINING
00510 }
00511 
00512 ////////////////////////////////////////////////////////////////////
00513 //     Function: GeomVertexDataPipelineBase::Destructor
00514 //       Access: Public
00515 //  Description:
00516 ////////////////////////////////////////////////////////////////////
00517 INLINE GeomVertexDataPipelineBase::
00518 ~GeomVertexDataPipelineBase() {
00519 #ifdef _DEBUG
00520   nassertv(_object->test_ref_count_nonzero());
00521 #endif // _DEBUG
00522 
00523 #ifdef DO_PIPELINING
00524   unref_delete((CycleData *)_cdata);
00525 #endif  // DO_PIPELINING
00526 
00527 #ifdef _DEBUG
00528   _object = NULL;
00529   _cdata = NULL;
00530 #endif  // _DEBUG
00531 }
00532 
00533 ////////////////////////////////////////////////////////////////////
00534 //     Function: GeomVertexDataPipelineBase::get_current_thread
00535 //       Access: Public
00536 //  Description:
00537 ////////////////////////////////////////////////////////////////////
00538 INLINE Thread *GeomVertexDataPipelineBase::
00539 get_current_thread() const {
00540   return _current_thread;
00541 }
00542 
00543 ////////////////////////////////////////////////////////////////////
00544 //     Function: GeomVertexDataPipelineBase::get_usage_hint
00545 //       Access: Public
00546 //  Description: 
00547 ////////////////////////////////////////////////////////////////////
00548 INLINE GeomVertexDataPipelineBase::UsageHint GeomVertexDataPipelineBase::
00549 get_usage_hint() const {
00550   return _cdata->_usage_hint;
00551 }
00552 
00553 ////////////////////////////////////////////////////////////////////
00554 //     Function: GeomVertexDataPipelineBase::get_format
00555 //       Access: Public
00556 //  Description: 
00557 ////////////////////////////////////////////////////////////////////
00558 INLINE const GeomVertexFormat *GeomVertexDataPipelineBase::
00559 get_format() const {
00560   return _cdata->_format;
00561 }
00562 
00563 ////////////////////////////////////////////////////////////////////
00564 //     Function: GeomVertexDataPipelineBase::has_column
00565 //       Access: Public
00566 //  Description: 
00567 ////////////////////////////////////////////////////////////////////
00568 INLINE bool GeomVertexDataPipelineBase::
00569 has_column(const InternalName *name) const {
00570   return _cdata->_format->has_column(name);
00571 }
00572 
00573 ////////////////////////////////////////////////////////////////////
00574 //     Function: GeomVertexDataPipelineBase::get_num_arrays
00575 //       Access: Public
00576 //  Description: 
00577 ////////////////////////////////////////////////////////////////////
00578 INLINE int GeomVertexDataPipelineBase::
00579 get_num_arrays() const {
00580   return _cdata->_arrays.size();
00581 }
00582 
00583 ////////////////////////////////////////////////////////////////////
00584 //     Function: GeomVertexDataPipelineBase::get_array
00585 //       Access: Public
00586 //  Description: 
00587 ////////////////////////////////////////////////////////////////////
00588 INLINE CPT(GeomVertexArrayData) GeomVertexDataPipelineBase::
00589 get_array(int i) const {
00590   nassertr(i >= 0 && i < (int)_cdata->_arrays.size(), NULL);
00591   return _cdata->_arrays[i].get_read_pointer();
00592 }
00593 
00594 ////////////////////////////////////////////////////////////////////
00595 //     Function: GeomVertexDataPipelineBase::get_transform_table
00596 //       Access: Public
00597 //  Description: 
00598 ////////////////////////////////////////////////////////////////////
00599 INLINE const TransformTable *GeomVertexDataPipelineBase::
00600 get_transform_table() const {
00601   return _cdata->_transform_table;
00602 }
00603 
00604 ////////////////////////////////////////////////////////////////////
00605 //     Function: GeomVertexDataPipelineBase::get_transform_blend_table
00606 //       Access: Public
00607 //  Description: 
00608 ////////////////////////////////////////////////////////////////////
00609 INLINE CPT(TransformBlendTable) GeomVertexDataPipelineBase::
00610 get_transform_blend_table() const {
00611   return _cdata->_transform_blend_table.get_read_pointer();
00612 }
00613 
00614 ////////////////////////////////////////////////////////////////////
00615 //     Function: GeomVertexDataPipelineBase::get_slider_table
00616 //       Access: Public
00617 //  Description: 
00618 ////////////////////////////////////////////////////////////////////
00619 INLINE const SliderTable *GeomVertexDataPipelineBase::
00620 get_slider_table() const {
00621   return _cdata->_slider_table;
00622 }
00623 
00624 ////////////////////////////////////////////////////////////////////
00625 //     Function: GeomVertexDataPipelineBase::get_modified
00626 //       Access: Public
00627 //  Description: 
00628 ////////////////////////////////////////////////////////////////////
00629 INLINE UpdateSeq GeomVertexDataPipelineBase::
00630 get_modified() const {
00631   return _cdata->_modified;
00632 }
00633 
00634 ////////////////////////////////////////////////////////////////////
00635 //     Function: GeomVertexDataPipelineReader::Constructor
00636 //       Access: Public
00637 //  Description:
00638 ////////////////////////////////////////////////////////////////////
00639 INLINE GeomVertexDataPipelineReader::
00640 GeomVertexDataPipelineReader(const GeomVertexData *object, 
00641                              Thread *current_thread) :
00642   GeomVertexDataPipelineBase((GeomVertexData *)object, current_thread,
00643                              (GeomVertexData::CData *)object->_cycler.read_unlocked(current_thread)),
00644   _got_array_readers(false)
00645 {
00646 }
00647 
00648 ////////////////////////////////////////////////////////////////////
00649 //     Function: GeomVertexDataPipelineReader::Copy Constructor
00650 //       Access: Private
00651 //  Description: Don't attempt to copy these objects.
00652 ////////////////////////////////////////////////////////////////////
00653 INLINE GeomVertexDataPipelineReader::
00654 GeomVertexDataPipelineReader(const GeomVertexDataPipelineReader &copy) : 
00655   GeomVertexDataPipelineBase(copy)
00656 {
00657   nassertv(false);
00658 }
00659 
00660 ////////////////////////////////////////////////////////////////////
00661 //     Function: GeomVertexDataPipelineReader::Copy Assignment Operator
00662 //       Access: Private
00663 //  Description: Don't attempt to copy these objects.
00664 ////////////////////////////////////////////////////////////////////
00665 INLINE void GeomVertexDataPipelineReader::
00666 operator = (const GeomVertexDataPipelineReader &) {
00667   nassertv(false);
00668 }
00669 
00670 ////////////////////////////////////////////////////////////////////
00671 //     Function: GeomVertexDataPipelineReader::Destructor
00672 //       Access: Public
00673 //  Description:
00674 ////////////////////////////////////////////////////////////////////
00675 INLINE GeomVertexDataPipelineReader::
00676 ~GeomVertexDataPipelineReader() {
00677   if (_got_array_readers) {
00678     delete_array_readers();
00679   }
00680   //  _object->_cycler.release_read(_cdata);
00681 }
00682 
00683 ////////////////////////////////////////////////////////////////////
00684 //     Function: GeomVertexDataPipelineReader::get_object
00685 //       Access: Public
00686 //  Description:
00687 ////////////////////////////////////////////////////////////////////
00688 INLINE const GeomVertexData *GeomVertexDataPipelineReader::
00689 get_object() const {
00690   return _object;
00691 }
00692 
00693 ////////////////////////////////////////////////////////////////////
00694 //     Function: GeomVertexDataPipelineReader::check_array_readers
00695 //       Access: Public
00696 //  Description: 
00697 ////////////////////////////////////////////////////////////////////
00698 INLINE void GeomVertexDataPipelineReader::
00699 check_array_readers() const {
00700   if (!_got_array_readers) {
00701     ((GeomVertexDataPipelineReader *)this)->make_array_readers();
00702   }
00703 }
00704 
00705 ////////////////////////////////////////////////////////////////////
00706 //     Function: GeomVertexDataPipelineReader::get_array_reader
00707 //       Access: Public
00708 //  Description: 
00709 ////////////////////////////////////////////////////////////////////
00710 INLINE const GeomVertexArrayDataHandle *GeomVertexDataPipelineReader::
00711 get_array_reader(int i) const {
00712   nassertr(_got_array_readers, NULL);
00713   nassertr(i >= 0 && i < (int)_array_readers.size(), NULL);
00714   return _array_readers[i];
00715 }
00716 
00717 ////////////////////////////////////////////////////////////////////
00718 //     Function: GeomVertexDataPipelineReader::has_vertex
00719 //       Access: Public
00720 //  Description: 
00721 ////////////////////////////////////////////////////////////////////
00722 INLINE bool GeomVertexDataPipelineReader::
00723 has_vertex() const {
00724   return (_cdata->_format->get_vertex_column() != (GeomVertexColumn *)NULL);
00725 }
00726 
00727 ////////////////////////////////////////////////////////////////////
00728 //     Function: GeomVertexDataPipelineReader::is_vertex_transformed
00729 //       Access: Public
00730 //  Description: 
00731 ////////////////////////////////////////////////////////////////////
00732 INLINE bool GeomVertexDataPipelineReader::
00733 is_vertex_transformed() const {
00734   const GeomVertexColumn *column = _cdata->_format->get_vertex_column();
00735   if (column != (GeomVertexColumn *)NULL) {
00736     return column->get_contents() == C_clip_point;
00737   }
00738 
00739   return false;
00740 }
00741 
00742 ////////////////////////////////////////////////////////////////////
00743 //     Function: GeomVertexDataPipelineReader::has_normal
00744 //       Access: Public
00745 //  Description: 
00746 ////////////////////////////////////////////////////////////////////
00747 INLINE bool GeomVertexDataPipelineReader::
00748 has_normal() const {
00749   return (_cdata->_format->get_normal_column() != (GeomVertexColumn *)NULL);
00750 }
00751 
00752 ////////////////////////////////////////////////////////////////////
00753 //     Function: GeomVertexDataPipelineReader::has_color
00754 //       Access: Public
00755 //  Description: 
00756 ////////////////////////////////////////////////////////////////////
00757 INLINE bool GeomVertexDataPipelineReader::
00758 has_color() const {
00759   return (_cdata->_format->get_color_column() != (GeomVertexColumn *)NULL);
00760 }
00761 
00762 ////////////////////////////////////////////////////////////////////
00763 //     Function: GeomVertexDataPipelineWriter::Constructor
00764 //       Access: Public
00765 //  Description:
00766 ////////////////////////////////////////////////////////////////////
00767 INLINE GeomVertexDataPipelineWriter::
00768 GeomVertexDataPipelineWriter(GeomVertexData *object, bool force_to_0, 
00769                              Thread *current_thread) :
00770   GeomVertexDataPipelineBase(object, current_thread,
00771                              object->_cycler.write_upstream(force_to_0, current_thread)),
00772   _force_to_0(force_to_0),
00773   _got_array_writers(false)
00774 {
00775 #ifdef _DEBUG
00776   nassertv(_object->test_ref_count_nonzero());
00777 #ifdef DO_PIPELINING
00778   nassertv(_cdata->test_ref_count_nonzero());
00779 #endif  // DO_PIPELINING
00780 #endif // _DEBUG
00781 }
00782 
00783 ////////////////////////////////////////////////////////////////////
00784 //     Function: GeomVertexDataPipelineWriter::Copy Constructor
00785 //       Access: Private
00786 //  Description: Don't attempt to copy these objects.
00787 ////////////////////////////////////////////////////////////////////
00788 INLINE GeomVertexDataPipelineWriter::
00789 GeomVertexDataPipelineWriter(const GeomVertexDataPipelineWriter &copy) : 
00790   GeomVertexDataPipelineBase(copy)
00791 {
00792   nassertv(false);
00793 }
00794 
00795 ////////////////////////////////////////////////////////////////////
00796 //     Function: GeomVertexDataPipelineWriter::Copy Assignment Operator
00797 //       Access: Private
00798 //  Description: Don't attempt to copy these objects.
00799 ////////////////////////////////////////////////////////////////////
00800 INLINE void GeomVertexDataPipelineWriter::
00801 operator = (const GeomVertexDataPipelineWriter &) {
00802   nassertv(false);
00803 }
00804 
00805 ////////////////////////////////////////////////////////////////////
00806 //     Function: GeomVertexDataPipelineWriter::Destructor
00807 //       Access: Public
00808 //  Description:
00809 ////////////////////////////////////////////////////////////////////
00810 INLINE GeomVertexDataPipelineWriter::
00811 ~GeomVertexDataPipelineWriter() {
00812   if (_got_array_writers) {
00813     delete_array_writers();
00814   }
00815   _object->_cycler.release_write(_cdata);
00816 }
00817 
00818 ////////////////////////////////////////////////////////////////////
00819 //     Function: GeomVertexDataPipelineWriter::get_object
00820 //       Access: Public
00821 //  Description:
00822 ////////////////////////////////////////////////////////////////////
00823 INLINE GeomVertexData *GeomVertexDataPipelineWriter::
00824 get_object() const {
00825   return _object;
00826 }
00827 
00828 ////////////////////////////////////////////////////////////////////
00829 //     Function: GeomVertexDataPipelineWriter::check_array_writers
00830 //       Access: Public
00831 //  Description: 
00832 ////////////////////////////////////////////////////////////////////
00833 INLINE void GeomVertexDataPipelineWriter::
00834 check_array_writers() const {
00835   if (!_got_array_writers) {
00836     ((GeomVertexDataPipelineWriter *)this)->make_array_writers();
00837   }
00838 }
00839 
00840 ////////////////////////////////////////////////////////////////////
00841 //     Function: GeomVertexDataPipelineWriter::get_array_writer
00842 //       Access: Public
00843 //  Description: 
00844 ////////////////////////////////////////////////////////////////////
00845 INLINE GeomVertexArrayDataHandle *GeomVertexDataPipelineWriter::
00846 get_array_writer(int i) const {
00847   nassertr(_got_array_writers, NULL);
00848   nassertr(i >= 0 && i < (int)_array_writers.size(), NULL);
00849   return _array_writers[i];
00850 }
00851 
00852 INLINE ostream &
00853 operator << (ostream &out, const GeomVertexData &obj) {
00854   obj.output(out);
00855   return out;
00856 }
 All Classes Functions Variables Enumerations