Panda3D
|
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::reserve_num_rows 00148 // Access: Published 00149 // Description: This ensures that enough memory space for n rows is 00150 // allocated, so that you may increase the number of 00151 // rows to n without causing a new memory allocation. 00152 // This is a performance optimization only; it is 00153 // especially useful when you know ahead of time that 00154 // you will be adding n rows to the data. 00155 //////////////////////////////////////////////////////////////////// 00156 INLINE bool GeomVertexData:: 00157 reserve_num_rows(int n) { 00158 GeomVertexDataPipelineWriter writer(this, true, Thread::get_current_thread()); 00159 writer.check_array_writers(); 00160 return writer.reserve_num_rows(n); 00161 } 00162 00163 //////////////////////////////////////////////////////////////////// 00164 // Function: GeomVertexData::get_num_arrays 00165 // Access: Published 00166 // Description: Returns the number of individual arrays stored within 00167 // the data. This must match 00168 // get_format()->get_num_arrays(). 00169 //////////////////////////////////////////////////////////////////// 00170 INLINE int GeomVertexData:: 00171 get_num_arrays() const { 00172 CDReader cdata(_cycler); 00173 return cdata->_arrays.size(); 00174 } 00175 00176 //////////////////////////////////////////////////////////////////// 00177 // Function: GeomVertexData::get_array 00178 // Access: Published 00179 // Description: Returns a const pointer to the vertex data for the 00180 // indicated array, for application code to directly 00181 // examine (but not modify) the underlying vertex data. 00182 //////////////////////////////////////////////////////////////////// 00183 INLINE CPT(GeomVertexArrayData) GeomVertexData:: 00184 get_array(int i) const { 00185 CDReader cdata(_cycler); 00186 nassertr(i >= 0 && i < (int)cdata->_arrays.size(), NULL); 00187 return cdata->_arrays[i].get_read_pointer(); 00188 } 00189 00190 //////////////////////////////////////////////////////////////////// 00191 // Function: GeomVertexData::modify_array 00192 // Access: Published 00193 // Description: Returns a modifiable pointer to the indicated vertex 00194 // array, so that application code may directly 00195 // manipulate the data. You should avoid changing 00196 // the length of this array, since all of the arrays 00197 // should be kept in sync--use set_num_rows() 00198 // instead. 00199 // 00200 // Don't call this in a downstream thread unless you 00201 // don't mind it blowing away other changes you might 00202 // have recently made in an upstream thread. 00203 //////////////////////////////////////////////////////////////////// 00204 INLINE PT(GeomVertexArrayData) GeomVertexData:: 00205 modify_array(int i) { 00206 GeomVertexDataPipelineWriter writer(this, true, Thread::get_current_thread()); 00207 return writer.modify_array(i); 00208 } 00209 00210 //////////////////////////////////////////////////////////////////// 00211 // Function: GeomVertexData::set_array 00212 // Access: Published 00213 // Description: Replaces the indicated vertex data array with 00214 // a completely new array. You should be careful that 00215 // the new array has the same length and format as the 00216 // old one, unless you know what you are doing. 00217 // 00218 // Don't call this in a downstream thread unless you 00219 // don't mind it blowing away other changes you might 00220 // have recently made in an upstream thread. 00221 //////////////////////////////////////////////////////////////////// 00222 INLINE void GeomVertexData:: 00223 set_array(int i, const GeomVertexArrayData *array) { 00224 GeomVertexDataPipelineWriter writer(this, true, Thread::get_current_thread()); 00225 writer.set_array(i, array); 00226 } 00227 00228 //////////////////////////////////////////////////////////////////// 00229 // Function: GeomVertexData::get_transform_table 00230 // Access: Published 00231 // Description: Returns a const pointer to the TransformTable 00232 // assigned to this data. Vertices within the table 00233 // will index into this table to indicate their 00234 // dynamic skinning information; this table is used when 00235 // the vertex animation is to be performed by the 00236 // graphics hardware (but also see 00237 // get_transform_blend_table()). 00238 // 00239 // This will return NULL if the vertex data does not 00240 // have a TransformTable assigned (which implies the 00241 // vertices will not be animated by the graphics 00242 // hardware). 00243 //////////////////////////////////////////////////////////////////// 00244 INLINE const TransformTable *GeomVertexData:: 00245 get_transform_table() const { 00246 CDReader cdata(_cycler); 00247 return cdata->_transform_table; 00248 } 00249 00250 //////////////////////////////////////////////////////////////////// 00251 // Function: GeomVertexData::clear_transform_table 00252 // Access: Published 00253 // Description: Sets the TransformTable pointer to NULL, 00254 // removing the table from the vertex data. This 00255 // disables hardware-driven vertex animation. 00256 //////////////////////////////////////////////////////////////////// 00257 INLINE void GeomVertexData:: 00258 clear_transform_table() { 00259 set_transform_table(NULL); 00260 } 00261 00262 //////////////////////////////////////////////////////////////////// 00263 // Function: GeomVertexData::get_transform_blend_table 00264 // Access: Published 00265 // Description: Returns a const pointer to the TransformBlendTable 00266 // assigned to this data. Vertices within the table 00267 // will index into this table to indicate their 00268 // dynamic skinning information; this table is used when 00269 // the vertex animation is to be performed by the CPU 00270 // (but also see get_transform_table()). 00271 // 00272 // This will return NULL if the vertex data does not 00273 // have a TransformBlendTable assigned (which implies 00274 // the vertices will not be animated by the CPU). 00275 //////////////////////////////////////////////////////////////////// 00276 INLINE CPT(TransformBlendTable) GeomVertexData:: 00277 get_transform_blend_table() const { 00278 CDReader cdata(_cycler); 00279 return cdata->_transform_blend_table.get_read_pointer(); 00280 } 00281 00282 //////////////////////////////////////////////////////////////////// 00283 // Function: GeomVertexData::clear_transform_blend_table 00284 // Access: Published 00285 // Description: Sets the TransformBlendTable pointer to NULL, 00286 // removing the table from the vertex data. This 00287 // disables CPU-driven vertex animation. 00288 //////////////////////////////////////////////////////////////////// 00289 INLINE void GeomVertexData:: 00290 clear_transform_blend_table() { 00291 set_transform_blend_table(NULL); 00292 } 00293 00294 //////////////////////////////////////////////////////////////////// 00295 // Function: GeomVertexData::get_slider_table 00296 // Access: Published 00297 // Description: Returns a const pointer to the SliderTable 00298 // assigned to this data. Vertices within the vertex 00299 // data will look up their morph offsets, if any, within 00300 // this table. 00301 // 00302 // This will return NULL if the vertex data does not 00303 // have a SliderTable assigned. 00304 //////////////////////////////////////////////////////////////////// 00305 INLINE const SliderTable *GeomVertexData:: 00306 get_slider_table() const { 00307 CDReader cdata(_cycler); 00308 return cdata->_slider_table; 00309 } 00310 00311 //////////////////////////////////////////////////////////////////// 00312 // Function: GeomVertexData::clear_slider_table 00313 // Access: Published 00314 // Description: Sets the SliderTable pointer to NULL, 00315 // removing the table from the vertex data. This 00316 // disables morph (blend shape) animation. 00317 //////////////////////////////////////////////////////////////////// 00318 INLINE void GeomVertexData:: 00319 clear_slider_table() { 00320 set_slider_table(NULL); 00321 } 00322 00323 //////////////////////////////////////////////////////////////////// 00324 // Function: GeomVertexData::get_num_bytes 00325 // Access: Published 00326 // Description: Returns the total number of bytes consumed by the 00327 // different arrays of the vertex data. 00328 //////////////////////////////////////////////////////////////////// 00329 INLINE int GeomVertexData:: 00330 get_num_bytes() const { 00331 GeomVertexDataPipelineReader reader(this, Thread::get_current_thread()); 00332 return reader.get_num_bytes(); 00333 } 00334 00335 //////////////////////////////////////////////////////////////////// 00336 // Function: GeomVertexData::get_modified 00337 // Access: Published 00338 // Description: Returns a sequence number which is guaranteed to 00339 // change at least every time the vertex data is 00340 // modified. 00341 //////////////////////////////////////////////////////////////////// 00342 INLINE UpdateSeq GeomVertexData:: 00343 get_modified(Thread *current_thread) const { 00344 CDReader cdata(_cycler, current_thread); 00345 return cdata->_modified; 00346 } 00347 00348 //////////////////////////////////////////////////////////////////// 00349 // Function: GeomVertexData::pack_abcd 00350 // Access: Public, Static 00351 // Description: Packs four values in a DirectX-style NT_packed_abcd 00352 // value. 00353 //////////////////////////////////////////////////////////////////// 00354 INLINE PN_uint32 GeomVertexData:: 00355 pack_abcd(unsigned int a, unsigned int b, 00356 unsigned int c, unsigned int d) { 00357 return (((a & 0xff) << 24) | 00358 ((b & 0xff) << 16) | 00359 ((c & 0xff) << 8) | 00360 (d & 0xff)); 00361 } 00362 00363 //////////////////////////////////////////////////////////////////// 00364 // Function: GeomVertexData::unpack_abcd_a 00365 // Access: Public, Static 00366 // Description: Returns the first packed value from a DirectX-style 00367 // NT_packed_abcd. 00368 //////////////////////////////////////////////////////////////////// 00369 INLINE unsigned int GeomVertexData:: 00370 unpack_abcd_a(PN_uint32 data) { 00371 return (data >> 24) & 0xff; 00372 } 00373 00374 //////////////////////////////////////////////////////////////////// 00375 // Function: GeomVertexData::unpack_abcd_b 00376 // Access: Public, Static 00377 // Description: Returns the second packed value from a DirectX-style 00378 // NT_packed_abcd. 00379 //////////////////////////////////////////////////////////////////// 00380 INLINE unsigned int GeomVertexData:: 00381 unpack_abcd_b(PN_uint32 data) { 00382 return (data >> 16) & 0xff; 00383 } 00384 00385 //////////////////////////////////////////////////////////////////// 00386 // Function: GeomVertexData::unpack_abcd_c 00387 // Access: Public, Static 00388 // Description: Returns the third packed value from a DirectX-style 00389 // NT_packed_abcd. 00390 //////////////////////////////////////////////////////////////////// 00391 INLINE unsigned int GeomVertexData:: 00392 unpack_abcd_c(PN_uint32 data) { 00393 return (data >> 8) & 0xff; 00394 } 00395 00396 //////////////////////////////////////////////////////////////////// 00397 // Function: GeomVertexData::unpack_abcd_d 00398 // Access: Public, Static 00399 // Description: Returns the fourth packed value from a DirectX-style 00400 // NT_packed_abcd. 00401 //////////////////////////////////////////////////////////////////// 00402 INLINE unsigned int GeomVertexData:: 00403 unpack_abcd_d(PN_uint32 data) { 00404 return data & 0xff; 00405 } 00406 00407 //////////////////////////////////////////////////////////////////// 00408 // Function: GeomVertexData::add_transform 00409 // Access: Private, Static 00410 // Description: Adds the indicated transform to the table, if it is 00411 // not already there, and returns its index number. 00412 //////////////////////////////////////////////////////////////////// 00413 INLINE int GeomVertexData:: 00414 add_transform(TransformTable *table, const VertexTransform *transform, 00415 TransformMap &already_added) { 00416 pair<TransformMap::iterator, bool> result = already_added.insert(TransformMap::value_type(transform, table->get_num_transforms())); 00417 00418 if (result.second) { 00419 table->add_transform(transform); 00420 } 00421 00422 return (*(result.first)).second; 00423 } 00424 00425 //////////////////////////////////////////////////////////////////// 00426 // Function: GeomVertexData::CDataCache::Constructor 00427 // Access: Public 00428 // Description: 00429 //////////////////////////////////////////////////////////////////// 00430 INLINE GeomVertexData::CDataCache:: 00431 CDataCache() { 00432 } 00433 00434 //////////////////////////////////////////////////////////////////// 00435 // Function: GeomVertexData::CDataCache::Copy Constructor 00436 // Access: Public 00437 // Description: 00438 //////////////////////////////////////////////////////////////////// 00439 INLINE GeomVertexData::CDataCache:: 00440 CDataCache(const GeomVertexData::CDataCache ©) : 00441 _result(copy._result) 00442 { 00443 } 00444 00445 //////////////////////////////////////////////////////////////////// 00446 // Function: GeomVertexData::CacheKey::Constructor 00447 // Access: Public 00448 // Description: 00449 //////////////////////////////////////////////////////////////////// 00450 INLINE GeomVertexData::CacheKey:: 00451 CacheKey(const GeomVertexFormat *modifier) : 00452 _modifier(modifier) 00453 { 00454 } 00455 00456 //////////////////////////////////////////////////////////////////// 00457 // Function: GeomVertexData::CacheKey::operator < 00458 // Access: Public 00459 // Description: Provides a unique ordering within the set. 00460 //////////////////////////////////////////////////////////////////// 00461 INLINE bool GeomVertexData::CacheKey:: 00462 operator < (const CacheKey &other) const { 00463 return _modifier < other._modifier; 00464 } 00465 00466 //////////////////////////////////////////////////////////////////// 00467 // Function: GeomVertexData::CacheEntry::Constructor 00468 // Access: Public 00469 // Description: 00470 //////////////////////////////////////////////////////////////////// 00471 INLINE GeomVertexData::CacheEntry:: 00472 CacheEntry(GeomVertexData *source, const GeomVertexFormat *modifier) : 00473 _source(source), 00474 _key(modifier) 00475 { 00476 } 00477 00478 //////////////////////////////////////////////////////////////////// 00479 // Function: GeomVertexData::CData::Constructor 00480 // Access: Public 00481 // Description: 00482 //////////////////////////////////////////////////////////////////// 00483 INLINE GeomVertexData::CData:: 00484 CData() : 00485 _usage_hint(UH_unspecified) 00486 { 00487 } 00488 00489 //////////////////////////////////////////////////////////////////// 00490 // Function: GeomVertexData::CData::Copy Constructor 00491 // Access: Public 00492 // Description: 00493 //////////////////////////////////////////////////////////////////// 00494 INLINE GeomVertexData::CData:: 00495 CData(const GeomVertexData::CData ©) : 00496 _usage_hint(copy._usage_hint), 00497 _format(copy._format), 00498 _arrays(copy._arrays), 00499 _transform_table(copy._transform_table), 00500 _transform_blend_table(copy._transform_blend_table), 00501 _slider_table(copy._slider_table), 00502 _animated_vertices(copy._animated_vertices), 00503 _animated_vertices_modified(copy._animated_vertices_modified), 00504 _modified(copy._modified) 00505 { 00506 } 00507 00508 //////////////////////////////////////////////////////////////////// 00509 // Function: GeomVertexDataPipelineBase::Constructor 00510 // Access: Public 00511 // Description: 00512 //////////////////////////////////////////////////////////////////// 00513 INLINE GeomVertexDataPipelineBase:: 00514 GeomVertexDataPipelineBase(GeomVertexData *object, 00515 Thread *current_thread, 00516 GeomVertexData::CData *cdata) : 00517 _object(object), 00518 _current_thread(current_thread), 00519 _cdata(cdata) 00520 { 00521 #ifdef _DEBUG 00522 nassertv(_object->test_ref_count_nonzero()); 00523 #endif // _DEBUG 00524 #ifdef DO_PIPELINING 00525 _cdata->ref(); 00526 #endif // DO_PIPELINING 00527 } 00528 00529 //////////////////////////////////////////////////////////////////// 00530 // Function: GeomVertexDataPipelineBase::Destructor 00531 // Access: Public 00532 // Description: 00533 //////////////////////////////////////////////////////////////////// 00534 INLINE GeomVertexDataPipelineBase:: 00535 ~GeomVertexDataPipelineBase() { 00536 #ifdef _DEBUG 00537 nassertv(_object->test_ref_count_nonzero()); 00538 #endif // _DEBUG 00539 00540 #ifdef DO_PIPELINING 00541 unref_delete((CycleData *)_cdata); 00542 #endif // DO_PIPELINING 00543 00544 #ifdef _DEBUG 00545 _object = NULL; 00546 _cdata = NULL; 00547 #endif // _DEBUG 00548 } 00549 00550 //////////////////////////////////////////////////////////////////// 00551 // Function: GeomVertexDataPipelineBase::get_current_thread 00552 // Access: Public 00553 // Description: 00554 //////////////////////////////////////////////////////////////////// 00555 INLINE Thread *GeomVertexDataPipelineBase:: 00556 get_current_thread() const { 00557 return _current_thread; 00558 } 00559 00560 //////////////////////////////////////////////////////////////////// 00561 // Function: GeomVertexDataPipelineBase::get_usage_hint 00562 // Access: Public 00563 // Description: 00564 //////////////////////////////////////////////////////////////////// 00565 INLINE GeomVertexDataPipelineBase::UsageHint GeomVertexDataPipelineBase:: 00566 get_usage_hint() const { 00567 return _cdata->_usage_hint; 00568 } 00569 00570 //////////////////////////////////////////////////////////////////// 00571 // Function: GeomVertexDataPipelineBase::get_format 00572 // Access: Public 00573 // Description: 00574 //////////////////////////////////////////////////////////////////// 00575 INLINE const GeomVertexFormat *GeomVertexDataPipelineBase:: 00576 get_format() const { 00577 return _cdata->_format; 00578 } 00579 00580 //////////////////////////////////////////////////////////////////// 00581 // Function: GeomVertexDataPipelineBase::has_column 00582 // Access: Public 00583 // Description: 00584 //////////////////////////////////////////////////////////////////// 00585 INLINE bool GeomVertexDataPipelineBase:: 00586 has_column(const InternalName *name) const { 00587 return _cdata->_format->has_column(name); 00588 } 00589 00590 //////////////////////////////////////////////////////////////////// 00591 // Function: GeomVertexDataPipelineBase::get_num_arrays 00592 // Access: Public 00593 // Description: 00594 //////////////////////////////////////////////////////////////////// 00595 INLINE int GeomVertexDataPipelineBase:: 00596 get_num_arrays() const { 00597 return _cdata->_arrays.size(); 00598 } 00599 00600 //////////////////////////////////////////////////////////////////// 00601 // Function: GeomVertexDataPipelineBase::get_array 00602 // Access: Public 00603 // Description: 00604 //////////////////////////////////////////////////////////////////// 00605 INLINE CPT(GeomVertexArrayData) GeomVertexDataPipelineBase:: 00606 get_array(int i) const { 00607 nassertr(i >= 0 && i < (int)_cdata->_arrays.size(), NULL); 00608 return _cdata->_arrays[i].get_read_pointer(); 00609 } 00610 00611 //////////////////////////////////////////////////////////////////// 00612 // Function: GeomVertexDataPipelineBase::get_transform_table 00613 // Access: Public 00614 // Description: 00615 //////////////////////////////////////////////////////////////////// 00616 INLINE const TransformTable *GeomVertexDataPipelineBase:: 00617 get_transform_table() const { 00618 return _cdata->_transform_table; 00619 } 00620 00621 //////////////////////////////////////////////////////////////////// 00622 // Function: GeomVertexDataPipelineBase::get_transform_blend_table 00623 // Access: Public 00624 // Description: 00625 //////////////////////////////////////////////////////////////////// 00626 INLINE CPT(TransformBlendTable) GeomVertexDataPipelineBase:: 00627 get_transform_blend_table() const { 00628 return _cdata->_transform_blend_table.get_read_pointer(); 00629 } 00630 00631 //////////////////////////////////////////////////////////////////// 00632 // Function: GeomVertexDataPipelineBase::get_slider_table 00633 // Access: Public 00634 // Description: 00635 //////////////////////////////////////////////////////////////////// 00636 INLINE const SliderTable *GeomVertexDataPipelineBase:: 00637 get_slider_table() const { 00638 return _cdata->_slider_table; 00639 } 00640 00641 //////////////////////////////////////////////////////////////////// 00642 // Function: GeomVertexDataPipelineBase::get_modified 00643 // Access: Public 00644 // Description: 00645 //////////////////////////////////////////////////////////////////// 00646 INLINE UpdateSeq GeomVertexDataPipelineBase:: 00647 get_modified() const { 00648 return _cdata->_modified; 00649 } 00650 00651 //////////////////////////////////////////////////////////////////// 00652 // Function: GeomVertexDataPipelineReader::Constructor 00653 // Access: Public 00654 // Description: 00655 //////////////////////////////////////////////////////////////////// 00656 INLINE GeomVertexDataPipelineReader:: 00657 GeomVertexDataPipelineReader(const GeomVertexData *object, 00658 Thread *current_thread) : 00659 GeomVertexDataPipelineBase((GeomVertexData *)object, current_thread, 00660 (GeomVertexData::CData *)object->_cycler.read_unlocked(current_thread)), 00661 _got_array_readers(false) 00662 { 00663 } 00664 00665 //////////////////////////////////////////////////////////////////// 00666 // Function: GeomVertexDataPipelineReader::Copy Constructor 00667 // Access: Private 00668 // Description: Don't attempt to copy these objects. 00669 //////////////////////////////////////////////////////////////////// 00670 INLINE GeomVertexDataPipelineReader:: 00671 GeomVertexDataPipelineReader(const GeomVertexDataPipelineReader ©) : 00672 GeomVertexDataPipelineBase(copy) 00673 { 00674 nassertv(false); 00675 } 00676 00677 //////////////////////////////////////////////////////////////////// 00678 // Function: GeomVertexDataPipelineReader::Copy Assignment Operator 00679 // Access: Private 00680 // Description: Don't attempt to copy these objects. 00681 //////////////////////////////////////////////////////////////////// 00682 INLINE void GeomVertexDataPipelineReader:: 00683 operator = (const GeomVertexDataPipelineReader &) { 00684 nassertv(false); 00685 } 00686 00687 //////////////////////////////////////////////////////////////////// 00688 // Function: GeomVertexDataPipelineReader::Destructor 00689 // Access: Public 00690 // Description: 00691 //////////////////////////////////////////////////////////////////// 00692 INLINE GeomVertexDataPipelineReader:: 00693 ~GeomVertexDataPipelineReader() { 00694 if (_got_array_readers) { 00695 delete_array_readers(); 00696 } 00697 // _object->_cycler.release_read(_cdata); 00698 } 00699 00700 //////////////////////////////////////////////////////////////////// 00701 // Function: GeomVertexDataPipelineReader::get_object 00702 // Access: Public 00703 // Description: 00704 //////////////////////////////////////////////////////////////////// 00705 INLINE const GeomVertexData *GeomVertexDataPipelineReader:: 00706 get_object() const { 00707 return _object; 00708 } 00709 00710 //////////////////////////////////////////////////////////////////// 00711 // Function: GeomVertexDataPipelineReader::check_array_readers 00712 // Access: Public 00713 // Description: 00714 //////////////////////////////////////////////////////////////////// 00715 INLINE void GeomVertexDataPipelineReader:: 00716 check_array_readers() const { 00717 if (!_got_array_readers) { 00718 ((GeomVertexDataPipelineReader *)this)->make_array_readers(); 00719 } 00720 } 00721 00722 //////////////////////////////////////////////////////////////////// 00723 // Function: GeomVertexDataPipelineReader::get_array_reader 00724 // Access: Public 00725 // Description: 00726 //////////////////////////////////////////////////////////////////// 00727 INLINE const GeomVertexArrayDataHandle *GeomVertexDataPipelineReader:: 00728 get_array_reader(int i) const { 00729 nassertr(_got_array_readers, NULL); 00730 nassertr(i >= 0 && i < (int)_array_readers.size(), NULL); 00731 return _array_readers[i]; 00732 } 00733 00734 //////////////////////////////////////////////////////////////////// 00735 // Function: GeomVertexDataPipelineReader::has_vertex 00736 // Access: Public 00737 // Description: 00738 //////////////////////////////////////////////////////////////////// 00739 INLINE bool GeomVertexDataPipelineReader:: 00740 has_vertex() const { 00741 return (_cdata->_format->get_vertex_column() != (GeomVertexColumn *)NULL); 00742 } 00743 00744 //////////////////////////////////////////////////////////////////// 00745 // Function: GeomVertexDataPipelineReader::is_vertex_transformed 00746 // Access: Public 00747 // Description: 00748 //////////////////////////////////////////////////////////////////// 00749 INLINE bool GeomVertexDataPipelineReader:: 00750 is_vertex_transformed() const { 00751 const GeomVertexColumn *column = _cdata->_format->get_vertex_column(); 00752 if (column != (GeomVertexColumn *)NULL) { 00753 return column->get_contents() == C_clip_point; 00754 } 00755 00756 return false; 00757 } 00758 00759 //////////////////////////////////////////////////////////////////// 00760 // Function: GeomVertexDataPipelineReader::has_normal 00761 // Access: Public 00762 // Description: 00763 //////////////////////////////////////////////////////////////////// 00764 INLINE bool GeomVertexDataPipelineReader:: 00765 has_normal() const { 00766 return (_cdata->_format->get_normal_column() != (GeomVertexColumn *)NULL); 00767 } 00768 00769 //////////////////////////////////////////////////////////////////// 00770 // Function: GeomVertexDataPipelineReader::has_color 00771 // Access: Public 00772 // Description: 00773 //////////////////////////////////////////////////////////////////// 00774 INLINE bool GeomVertexDataPipelineReader:: 00775 has_color() const { 00776 return (_cdata->_format->get_color_column() != (GeomVertexColumn *)NULL); 00777 } 00778 00779 //////////////////////////////////////////////////////////////////// 00780 // Function: GeomVertexDataPipelineWriter::Constructor 00781 // Access: Public 00782 // Description: 00783 //////////////////////////////////////////////////////////////////// 00784 INLINE GeomVertexDataPipelineWriter:: 00785 GeomVertexDataPipelineWriter(GeomVertexData *object, bool force_to_0, 00786 Thread *current_thread) : 00787 GeomVertexDataPipelineBase(object, current_thread, 00788 object->_cycler.write_upstream(force_to_0, current_thread)), 00789 _force_to_0(force_to_0), 00790 _got_array_writers(false) 00791 { 00792 #ifdef _DEBUG 00793 nassertv(_object->test_ref_count_nonzero()); 00794 #ifdef DO_PIPELINING 00795 nassertv(_cdata->test_ref_count_nonzero()); 00796 #endif // DO_PIPELINING 00797 #endif // _DEBUG 00798 } 00799 00800 //////////////////////////////////////////////////////////////////// 00801 // Function: GeomVertexDataPipelineWriter::Copy Constructor 00802 // Access: Private 00803 // Description: Don't attempt to copy these objects. 00804 //////////////////////////////////////////////////////////////////// 00805 INLINE GeomVertexDataPipelineWriter:: 00806 GeomVertexDataPipelineWriter(const GeomVertexDataPipelineWriter ©) : 00807 GeomVertexDataPipelineBase(copy) 00808 { 00809 nassertv(false); 00810 } 00811 00812 //////////////////////////////////////////////////////////////////// 00813 // Function: GeomVertexDataPipelineWriter::Copy Assignment Operator 00814 // Access: Private 00815 // Description: Don't attempt to copy these objects. 00816 //////////////////////////////////////////////////////////////////// 00817 INLINE void GeomVertexDataPipelineWriter:: 00818 operator = (const GeomVertexDataPipelineWriter &) { 00819 nassertv(false); 00820 } 00821 00822 //////////////////////////////////////////////////////////////////// 00823 // Function: GeomVertexDataPipelineWriter::Destructor 00824 // Access: Public 00825 // Description: 00826 //////////////////////////////////////////////////////////////////// 00827 INLINE GeomVertexDataPipelineWriter:: 00828 ~GeomVertexDataPipelineWriter() { 00829 if (_got_array_writers) { 00830 delete_array_writers(); 00831 } 00832 _object->_cycler.release_write(_cdata); 00833 } 00834 00835 //////////////////////////////////////////////////////////////////// 00836 // Function: GeomVertexDataPipelineWriter::get_object 00837 // Access: Public 00838 // Description: 00839 //////////////////////////////////////////////////////////////////// 00840 INLINE GeomVertexData *GeomVertexDataPipelineWriter:: 00841 get_object() const { 00842 return _object; 00843 } 00844 00845 //////////////////////////////////////////////////////////////////// 00846 // Function: GeomVertexDataPipelineWriter::check_array_writers 00847 // Access: Public 00848 // Description: 00849 //////////////////////////////////////////////////////////////////// 00850 INLINE void GeomVertexDataPipelineWriter:: 00851 check_array_writers() const { 00852 if (!_got_array_writers) { 00853 ((GeomVertexDataPipelineWriter *)this)->make_array_writers(); 00854 } 00855 } 00856 00857 //////////////////////////////////////////////////////////////////// 00858 // Function: GeomVertexDataPipelineWriter::get_array_writer 00859 // Access: Public 00860 // Description: 00861 //////////////////////////////////////////////////////////////////// 00862 INLINE GeomVertexArrayDataHandle *GeomVertexDataPipelineWriter:: 00863 get_array_writer(int i) const { 00864 nassertr(_got_array_writers, NULL); 00865 nassertr(i >= 0 && i < (int)_array_writers.size(), NULL); 00866 return _array_writers[i]; 00867 } 00868 00869 INLINE ostream & 00870 operator << (ostream &out, const GeomVertexData &obj) { 00871 obj.output(out); 00872 return out; 00873 }