Panda3D
|
00001 // Filename: geom.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: Geom::get_primitive_type 00018 // Access: Published 00019 // Description: Returns the fundamental primitive type that is common 00020 // to all GeomPrimitives added within the Geom. All 00021 // nested primitives within a particular Geom must be 00022 // the same type (that is, you can mix triangles and 00023 // tristrips, because they are both the same fundamental 00024 // type PT_polygons, but you cannot mix triangles and 00025 // points withn the same Geom). 00026 //////////////////////////////////////////////////////////////////// 00027 INLINE Geom::PrimitiveType Geom:: 00028 get_primitive_type() const { 00029 CDReader cdata(_cycler); 00030 return cdata->_primitive_type; 00031 } 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function: Geom::get_shade_model 00035 // Access: Published 00036 // Description: Returns the shade model common to all of the 00037 // individual GeomPrimitives that have been added to the 00038 // geom. 00039 //////////////////////////////////////////////////////////////////// 00040 INLINE Geom::ShadeModel Geom:: 00041 get_shade_model() const { 00042 CDReader cdata(_cycler); 00043 return cdata->_shade_model; 00044 } 00045 00046 //////////////////////////////////////////////////////////////////// 00047 // Function: Geom::get_geom_rendering 00048 // Access: Published 00049 // Description: Returns the set of GeomRendering bits that represent 00050 // the rendering properties required to properly render 00051 // this Geom. 00052 //////////////////////////////////////////////////////////////////// 00053 INLINE int Geom:: 00054 get_geom_rendering() const { 00055 CDReader cdata(_cycler); 00056 return cdata->_geom_rendering; 00057 } 00058 00059 //////////////////////////////////////////////////////////////////// 00060 // Function: Geom::get_usage_hint 00061 // Access: Published 00062 // Description: Returns the minimum (i.e. most dynamic) usage_hint 00063 // among all of the individual GeomPrimitives that have 00064 // been added to the geom. 00065 //////////////////////////////////////////////////////////////////// 00066 INLINE Geom::UsageHint Geom:: 00067 get_usage_hint() const { 00068 CDLockedReader cdata(_cycler); 00069 if (!cdata->_got_usage_hint) { 00070 CDWriter cdataw(((Geom *)this)->_cycler, cdata, false); 00071 ((Geom *)this)->reset_usage_hint(cdataw); 00072 return cdataw->_usage_hint; 00073 } 00074 return cdata->_usage_hint; 00075 } 00076 00077 //////////////////////////////////////////////////////////////////// 00078 // Function: Geom::get_vertex_data 00079 // Access: Published 00080 // Description: Returns a const pointer to the GeomVertexData, 00081 // for application code to directly examine (but not 00082 // modify) the geom's underlying data. 00083 //////////////////////////////////////////////////////////////////// 00084 INLINE CPT(GeomVertexData) Geom:: 00085 get_vertex_data(Thread *current_thread) const { 00086 CDReader cdata(_cycler, current_thread); 00087 return cdata->_data.get_read_pointer(); 00088 } 00089 00090 //////////////////////////////////////////////////////////////////// 00091 // Function: Geom::is_empty 00092 // Access: Published 00093 // Description: Returns true if there appear to be no vertices to be 00094 // rendered by this Geom, false if has some actual data. 00095 //////////////////////////////////////////////////////////////////// 00096 INLINE bool Geom:: 00097 is_empty() const { 00098 CDReader cdata(_cycler); 00099 return cdata->_primitives.empty(); 00100 } 00101 00102 //////////////////////////////////////////////////////////////////// 00103 // Function: Geom::get_num_primitives 00104 // Access: Published 00105 // Description: Returns the number of GeomPrimitive objects stored 00106 // within the Geom, each of which represents a number of 00107 // primitives of a particular type. 00108 //////////////////////////////////////////////////////////////////// 00109 INLINE int Geom:: 00110 get_num_primitives() const { 00111 CDReader cdata(_cycler); 00112 return cdata->_primitives.size(); 00113 } 00114 00115 //////////////////////////////////////////////////////////////////// 00116 // Function: Geom::get_primitive 00117 // Access: Published 00118 // Description: Returns a const pointer to the ith GeomPrimitive 00119 // object stored within the Geom. Use this call only to 00120 // inspect the ith object; use modify_primitive() or 00121 // set_primitive() if you want to modify it. 00122 //////////////////////////////////////////////////////////////////// 00123 INLINE CPT(GeomPrimitive) Geom:: 00124 get_primitive(int i) const { 00125 CDReader cdata(_cycler); 00126 nassertr(i >= 0 && i < (int)cdata->_primitives.size(), NULL); 00127 return cdata->_primitives[i].get_read_pointer(); 00128 } 00129 00130 //////////////////////////////////////////////////////////////////// 00131 // Function: Geom::modify_primitive 00132 // Access: Published 00133 // Description: Returns a modifiable pointer to the ith GeomPrimitive 00134 // object stored within the Geom, so application code 00135 // can directly manipulate the properties of this 00136 // primitive. 00137 // 00138 // Don't call this in a downstream thread unless you 00139 // don't mind it blowing away other changes you might 00140 // have recently made in an upstream thread. 00141 //////////////////////////////////////////////////////////////////// 00142 INLINE PT(GeomPrimitive) Geom:: 00143 modify_primitive(int i) { 00144 Thread *current_thread = Thread::get_current_thread(); 00145 CDWriter cdata(_cycler, true, current_thread); 00146 nassertr(i >= 0 && i < (int)cdata->_primitives.size(), NULL); 00147 cdata->_got_usage_hint = false; 00148 cdata->_modified = Geom::get_next_modified(); 00149 clear_cache_stage(current_thread); 00150 return cdata->_primitives[i].get_write_pointer(); 00151 } 00152 00153 //////////////////////////////////////////////////////////////////// 00154 // Function: Geom::decompose 00155 // Access: Published 00156 // Description: Decomposes all of the primitives within this Geom, 00157 // returning the result. See 00158 // GeomPrimitive::decompose(). 00159 //////////////////////////////////////////////////////////////////// 00160 INLINE PT(Geom) Geom:: 00161 decompose() const { 00162 PT(Geom) new_geom = make_copy(); 00163 new_geom->decompose_in_place(); 00164 return new_geom; 00165 } 00166 00167 //////////////////////////////////////////////////////////////////// 00168 // Function: Geom::doubleside 00169 // Access: Published 00170 // Description: Doublesides all of the primitives within this Geom, 00171 // returning the result. See 00172 // GeomPrimitive::doubleside(). 00173 //////////////////////////////////////////////////////////////////// 00174 INLINE PT(Geom) Geom:: 00175 doubleside() const { 00176 PT(Geom) new_geom = make_copy(); 00177 new_geom->doubleside_in_place(); 00178 return new_geom; 00179 } 00180 00181 //////////////////////////////////////////////////////////////////// 00182 // Function: Geom::reverse 00183 // Access: Published 00184 // Description: Reverses all of the primitives within this Geom, 00185 // returning the result. See 00186 // GeomPrimitive::reverse(). 00187 //////////////////////////////////////////////////////////////////// 00188 INLINE PT(Geom) Geom:: 00189 reverse() const { 00190 PT(Geom) new_geom = make_copy(); 00191 new_geom->reverse_in_place(); 00192 return new_geom; 00193 } 00194 00195 //////////////////////////////////////////////////////////////////// 00196 // Function: Geom::rotate 00197 // Access: Published 00198 // Description: Rotates all of the primitives within this Geom, 00199 // returning the result. See 00200 // GeomPrimitive::rotate(). 00201 //////////////////////////////////////////////////////////////////// 00202 INLINE PT(Geom) Geom:: 00203 rotate() const { 00204 PT(Geom) new_geom = make_copy(); 00205 new_geom->rotate_in_place(); 00206 return new_geom; 00207 } 00208 00209 //////////////////////////////////////////////////////////////////// 00210 // Function: Geom::unify 00211 // Access: Published 00212 // Description: Unifies all of the primitives contained within this 00213 // Geom into a single (or as few as possible, within the 00214 // constraints of max_indices) primitive objects. This 00215 // may require decomposing the primitives if, for 00216 // instance, the Geom contains both triangle strips and 00217 // triangle fans. 00218 // 00219 // max_indices represents the maximum number of indices 00220 // that will be put in any one GeomPrimitive. If 00221 // preserve_order is true, then the primitives will not 00222 // be reordered during the operation, even if this 00223 // results in a suboptimal result. 00224 //////////////////////////////////////////////////////////////////// 00225 INLINE PT(Geom) Geom:: 00226 unify(int max_indices, bool preserve_order) const { 00227 PT(Geom) new_geom = make_copy(); 00228 new_geom->unify_in_place(max_indices, preserve_order); 00229 return new_geom; 00230 } 00231 00232 //////////////////////////////////////////////////////////////////// 00233 // Function: Geom::make_points 00234 // Access: Published 00235 // Description: Returns a new Geom with points at all the vertices. 00236 // See GeomPrimitive::make_points(). 00237 //////////////////////////////////////////////////////////////////// 00238 INLINE PT(Geom) Geom:: 00239 make_points() const { 00240 PT(Geom) new_geom = make_copy(); 00241 new_geom->make_points_in_place(); 00242 return new_geom; 00243 } 00244 00245 //////////////////////////////////////////////////////////////////// 00246 // Function: Geom::get_modified 00247 // Access: Published 00248 // Description: Returns a sequence number which is guaranteed to 00249 // change at least every time any of the primitives in 00250 // the Geom is modified, or the set of primitives is 00251 // modified. However, this does not include 00252 // modifications to the vertex data, which should be 00253 // tested separately. 00254 //////////////////////////////////////////////////////////////////// 00255 INLINE UpdateSeq Geom:: 00256 get_modified(Thread *current_thread) const { 00257 CDReader cdata(_cycler, current_thread); 00258 return cdata->_modified; 00259 } 00260 00261 //////////////////////////////////////////////////////////////////// 00262 // Function: Geom::mark_bounds_stale 00263 // Access: Published 00264 // Description: Marks the bounding volume of the Geom as stale so 00265 // that it should be recomputed. Usually it is not 00266 // necessary to call this explicitly. 00267 //////////////////////////////////////////////////////////////////// 00268 INLINE void Geom:: 00269 mark_bounds_stale() const { 00270 CDWriter cdata(((Geom *)this)->_cycler, false); 00271 ((Geom *)this)->mark_internal_bounds_stale(cdata); 00272 } 00273 00274 //////////////////////////////////////////////////////////////////// 00275 // Function: Geom::set_bounds_type 00276 // Access: Published 00277 // Description: Specifies the desired type of bounding volume that 00278 // will be created for this Geom. This is normally 00279 // BoundingVolume::BT_default, which means to set the 00280 // type according to the config variable "bounds-type". 00281 // 00282 // If this is BT_sphere or BT_box, a BoundingSphere or 00283 // BoundingBox is explicitly created. If it is BT_best, 00284 // a BoundingBox is created. 00285 // 00286 // This affects the implicit bounding volume only. If 00287 // an explicit bounding volume is set on the Geom with 00288 // set_bounds(), that bounding volume type is used. 00289 // (This is different behavior from the similar method 00290 // on PandaNode.) 00291 //////////////////////////////////////////////////////////////////// 00292 INLINE void Geom:: 00293 set_bounds_type(BoundingVolume::BoundsType bounds_type) { 00294 CDWriter cdata(_cycler, true); 00295 cdata->_bounds_type = bounds_type; 00296 mark_internal_bounds_stale(cdata); 00297 } 00298 00299 //////////////////////////////////////////////////////////////////// 00300 // Function: Geom::get_bounds_type 00301 // Access: Published 00302 // Description: Returns the bounding volume type set with 00303 // set_bounds_type(). 00304 //////////////////////////////////////////////////////////////////// 00305 INLINE BoundingVolume::BoundsType Geom:: 00306 get_bounds_type() const { 00307 CDReader cdata(_cycler); 00308 return cdata->_bounds_type; 00309 } 00310 00311 //////////////////////////////////////////////////////////////////// 00312 // Function: Geom::set_bounds 00313 // Access: Published 00314 // Description: Resets the bounding volume so that it is the 00315 // indicated volume. When it is explicitly set, the 00316 // bounding volume will no longer be automatically 00317 // computed; call clear_bounds() if you would like to 00318 // return the bounding volume to its default behavior. 00319 // 00320 // Don't call this in a downstream thread unless you 00321 // don't mind it blowing away other changes you might 00322 // have recently made in an upstream thread. 00323 //////////////////////////////////////////////////////////////////// 00324 INLINE void Geom:: 00325 set_bounds(const BoundingVolume *volume) { 00326 CDWriter cdata(_cycler, true); 00327 if (volume == NULL) { 00328 cdata->_user_bounds = NULL; 00329 } else { 00330 cdata->_user_bounds = volume->make_copy(); 00331 } 00332 } 00333 00334 //////////////////////////////////////////////////////////////////// 00335 // Function: Geom::clear_bounds 00336 // Access: Published 00337 // Description: Reverses the effect of a previous call to 00338 // set_bounds(), and allows the bounding volume to be 00339 // automatically computed once more based on the 00340 // vertices. 00341 // 00342 // Don't call this in a downstream thread unless you 00343 // don't mind it blowing away other changes you might 00344 // have recently made in an upstream thread. 00345 //////////////////////////////////////////////////////////////////// 00346 INLINE void Geom:: 00347 clear_bounds() { 00348 CDWriter cdata(_cycler, true); 00349 cdata->_user_bounds = NULL; 00350 mark_internal_bounds_stale(cdata); 00351 } 00352 00353 //////////////////////////////////////////////////////////////////// 00354 // Function: Geom::calc_tight_bounds 00355 // Access: Public 00356 // Description: Expands min_point and max_point to include all of the 00357 // vertices in the Geom, if any. found_any is set true 00358 // if any points are found. It is the caller's 00359 // responsibility to initialize min_point, max_point, 00360 // and found_any before calling this function. 00361 // 00362 // This version of the method allows the Geom to specify 00363 // an alternate vertex data table (for instance, if the 00364 // vertex data has already been munged), and also allows 00365 // the result to be computed in any coordinate space by 00366 // specifying a transform matrix. 00367 //////////////////////////////////////////////////////////////////// 00368 INLINE void Geom:: 00369 calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point, 00370 bool &found_any, 00371 const GeomVertexData *vertex_data, 00372 bool got_mat, const LMatrix4 &mat, 00373 Thread *current_thread) const { 00374 CDReader cdata(_cycler, current_thread); 00375 00376 do_calc_tight_bounds(min_point, max_point, found_any, 00377 vertex_data, got_mat, mat, 00378 InternalName::get_vertex(), 00379 cdata, current_thread); 00380 } 00381 00382 //////////////////////////////////////////////////////////////////// 00383 // Function: Geom::calc_tight_bounds 00384 // Access: Public, Virtual 00385 // Description: Expands min_point and max_point to include all of the 00386 // vertices in the Geom, if any. found_any is set true 00387 // if any points are found. It is the caller's 00388 // responsibility to initialize min_point, max_point, 00389 // and found_any before calling this function. 00390 // 00391 // This version of the method assumes the Geom will use 00392 // its own vertex data, and the results are computed in 00393 // the Geom's own coordinate space. 00394 //////////////////////////////////////////////////////////////////// 00395 INLINE void Geom:: 00396 calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point, 00397 bool &found_any, Thread *current_thread) const { 00398 calc_tight_bounds(min_point, max_point, found_any, 00399 get_vertex_data(current_thread), false, 00400 LMatrix4::ident_mat(), 00401 current_thread); 00402 } 00403 00404 //////////////////////////////////////////////////////////////////// 00405 // Function: Geom::calc_tight_bounds 00406 // Access: Public 00407 // Description: Similar to calc_tight_bounds(), for UV coordinates or 00408 // other named columns. 00409 //////////////////////////////////////////////////////////////////// 00410 INLINE void Geom:: 00411 calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point, 00412 bool &found_any, 00413 const GeomVertexData *vertex_data, 00414 bool got_mat, const LMatrix4 &mat, 00415 const InternalName *column_name, 00416 Thread *current_thread) const { 00417 CDReader cdata(_cycler, current_thread); 00418 00419 do_calc_tight_bounds(min_point, max_point, found_any, 00420 vertex_data, got_mat, mat, 00421 column_name, cdata, current_thread); 00422 } 00423 00424 //////////////////////////////////////////////////////////////////// 00425 // Function: Geom::mark_internal_bounds_stale 00426 // Access: Private 00427 // Description: Should be called to mark the internal bounding 00428 // volume stale, so that recompute_internal_bounds() 00429 // will be called when the bounding volume is next 00430 // requested. 00431 //////////////////////////////////////////////////////////////////// 00432 INLINE void Geom:: 00433 mark_internal_bounds_stale(CData *cdata) { 00434 cdata->_internal_bounds_stale = true; 00435 } 00436 00437 //////////////////////////////////////////////////////////////////// 00438 // Function: Geom::CDataCache::Constructor 00439 // Access: Public 00440 // Description: 00441 //////////////////////////////////////////////////////////////////// 00442 INLINE Geom::CDataCache:: 00443 CDataCache() : 00444 _source(NULL), 00445 _geom_result(NULL), 00446 _data_result(NULL) 00447 { 00448 } 00449 00450 //////////////////////////////////////////////////////////////////// 00451 // Function: Geom::CDataCache::Copy Constructor 00452 // Access: Public 00453 // Description: 00454 //////////////////////////////////////////////////////////////////// 00455 INLINE Geom::CDataCache:: 00456 CDataCache(const Geom::CDataCache ©) : 00457 _source(copy._source), 00458 _geom_result(copy._geom_result), 00459 _data_result(copy._data_result) 00460 { 00461 if (_geom_result != _source && _geom_result != (Geom *)NULL) { 00462 _geom_result->ref(); 00463 } 00464 } 00465 00466 //////////////////////////////////////////////////////////////////// 00467 // Function: Geom::CDataCache::set_result 00468 // Access: Public 00469 // Description: Stores the geom_result and data_result on the cache, 00470 // upping and/or dropping the reference count 00471 // appropriately. 00472 //////////////////////////////////////////////////////////////////// 00473 INLINE void Geom::CDataCache:: 00474 set_result(const Geom *geom_result, const GeomVertexData *data_result) { 00475 if (geom_result != _geom_result) { 00476 if (_geom_result != _source && _geom_result != (Geom *)NULL) { 00477 unref_delete(_geom_result); 00478 } 00479 _geom_result = geom_result; 00480 if (_geom_result != _source && _geom_result != (Geom *)NULL) { 00481 _geom_result->ref(); 00482 } 00483 } 00484 _data_result = data_result; 00485 } 00486 00487 //////////////////////////////////////////////////////////////////// 00488 // Function: Geom::CacheKey::Constructor 00489 // Access: Public 00490 // Description: 00491 //////////////////////////////////////////////////////////////////// 00492 INLINE Geom::CacheKey:: 00493 CacheKey(const GeomVertexData *source_data, const GeomMunger *modifier) : 00494 _source_data(source_data), 00495 _modifier(modifier) 00496 { 00497 } 00498 00499 //////////////////////////////////////////////////////////////////// 00500 // Function: Geom::CacheKey::operator < 00501 // Access: Public 00502 // Description: Provides a unique ordering within the map. 00503 //////////////////////////////////////////////////////////////////// 00504 INLINE bool Geom::CacheKey:: 00505 operator < (const CacheKey &other) const { 00506 if (_modifier != other._modifier) { 00507 int compare = _modifier->geom_compare_to(*other._modifier); 00508 if (compare != 0) { 00509 return (compare < 0); 00510 } 00511 } 00512 if (_source_data != other._source_data) { 00513 return (_source_data < other._source_data); 00514 } 00515 return 0; 00516 } 00517 00518 //////////////////////////////////////////////////////////////////// 00519 // Function: Geom::CacheEntry::Constructor 00520 // Access: Public 00521 // Description: 00522 //////////////////////////////////////////////////////////////////// 00523 INLINE Geom::CacheEntry:: 00524 CacheEntry(Geom *source, const GeomVertexData *source_data, 00525 const GeomMunger *modifier) : 00526 _source(source), 00527 _key(source_data, modifier) 00528 { 00529 } 00530 00531 00532 //////////////////////////////////////////////////////////////////// 00533 // Function: Geom::CData::Constructor 00534 // Access: Public 00535 // Description: 00536 //////////////////////////////////////////////////////////////////// 00537 INLINE Geom::CData:: 00538 CData() : 00539 _primitive_type(PT_none), 00540 _shade_model(SM_uniform), 00541 _geom_rendering(0), 00542 _usage_hint(UH_unspecified), 00543 _got_usage_hint(false), 00544 _nested_vertices(0), 00545 _internal_bounds_stale(true), 00546 _bounds_type(BoundingVolume::BT_default) 00547 { 00548 } 00549 00550 //////////////////////////////////////////////////////////////////// 00551 // Function: Geom::CData::Copy Constructor 00552 // Access: Public 00553 // Description: 00554 //////////////////////////////////////////////////////////////////// 00555 INLINE Geom::CData:: 00556 CData(const Geom::CData ©) : 00557 _data(copy._data), 00558 _primitives(copy._primitives), 00559 _primitive_type(copy._primitive_type), 00560 _shade_model(copy._shade_model), 00561 _geom_rendering(copy._geom_rendering), 00562 _usage_hint(copy._usage_hint), 00563 _got_usage_hint(copy._got_usage_hint), 00564 _modified(copy._modified), 00565 _internal_bounds(copy._internal_bounds), 00566 _nested_vertices(copy._nested_vertices), 00567 _internal_bounds_stale(copy._internal_bounds_stale), 00568 _bounds_type(copy._bounds_type), 00569 _user_bounds(copy._user_bounds) 00570 { 00571 } 00572 00573 //////////////////////////////////////////////////////////////////// 00574 // Function: GeomPipelineReader::Constructor 00575 // Access: Public 00576 // Description: 00577 //////////////////////////////////////////////////////////////////// 00578 INLINE GeomPipelineReader:: 00579 GeomPipelineReader(const Geom *object, Thread *current_thread) : 00580 _object(object), 00581 _current_thread(current_thread), 00582 _cdata(object->_cycler.read_unlocked(current_thread)) 00583 { 00584 #ifdef _DEBUG 00585 nassertv(_object->test_ref_count_nonzero()); 00586 #endif // _DEBUG 00587 #ifdef DO_PIPELINING 00588 _cdata->ref(); 00589 #endif // DO_PIPELINING 00590 } 00591 00592 //////////////////////////////////////////////////////////////////// 00593 // Function: GeomPipelineReader::Copy Constructor 00594 // Access: Private 00595 // Description: Don't attempt to copy these objects. 00596 //////////////////////////////////////////////////////////////////// 00597 INLINE GeomPipelineReader:: 00598 GeomPipelineReader(const GeomPipelineReader &) { 00599 nassertv(false); 00600 } 00601 00602 //////////////////////////////////////////////////////////////////// 00603 // Function: GeomPipelineReader::Copy Assignment Operator 00604 // Access: Private 00605 // Description: Don't attempt to copy these objects. 00606 //////////////////////////////////////////////////////////////////// 00607 INLINE void GeomPipelineReader:: 00608 operator = (const GeomPipelineReader &) { 00609 nassertv(false); 00610 } 00611 00612 //////////////////////////////////////////////////////////////////// 00613 // Function: GeomPipelineReader::Destructor 00614 // Access: Public 00615 // Description: 00616 //////////////////////////////////////////////////////////////////// 00617 INLINE GeomPipelineReader:: 00618 ~GeomPipelineReader() { 00619 #ifdef _DEBUG 00620 nassertv(_object->test_ref_count_nonzero()); 00621 #endif // _DEBUG 00622 // _object->_cycler.release_read(_cdata); 00623 00624 #ifdef DO_PIPELINING 00625 unref_delete((CycleData *)_cdata); 00626 #endif // DO_PIPELINING 00627 00628 #ifdef _DEBUG 00629 _object = NULL; 00630 _cdata = NULL; 00631 #endif // _DEBUG 00632 } 00633 00634 //////////////////////////////////////////////////////////////////// 00635 // Function: GeomPipelineReader::get_object 00636 // Access: Public 00637 // Description: 00638 //////////////////////////////////////////////////////////////////// 00639 INLINE const Geom *GeomPipelineReader:: 00640 get_object() const { 00641 return _object; 00642 } 00643 00644 //////////////////////////////////////////////////////////////////// 00645 // Function: GeomPipelineReader::get_current_thread 00646 // Access: Public 00647 // Description: 00648 //////////////////////////////////////////////////////////////////// 00649 INLINE Thread *GeomPipelineReader:: 00650 get_current_thread() const { 00651 return _current_thread; 00652 } 00653 00654 //////////////////////////////////////////////////////////////////// 00655 // Function: GeomPipelineReader::get_primitive_type 00656 // Access: Public 00657 // Description: 00658 //////////////////////////////////////////////////////////////////// 00659 INLINE GeomPipelineReader::PrimitiveType GeomPipelineReader:: 00660 get_primitive_type() const { 00661 return _cdata->_primitive_type; 00662 } 00663 00664 //////////////////////////////////////////////////////////////////// 00665 // Function: GeomPipelineReader::get_shade_model 00666 // Access: Public 00667 // Description: 00668 //////////////////////////////////////////////////////////////////// 00669 INLINE GeomPipelineReader::ShadeModel GeomPipelineReader:: 00670 get_shade_model() const { 00671 return _cdata->_shade_model; 00672 } 00673 00674 //////////////////////////////////////////////////////////////////// 00675 // Function: GeomPipelineReader::get_geom_rendering 00676 // Access: Public 00677 // Description: 00678 //////////////////////////////////////////////////////////////////// 00679 INLINE int GeomPipelineReader:: 00680 get_geom_rendering() const { 00681 return _cdata->_geom_rendering; 00682 } 00683 00684 //////////////////////////////////////////////////////////////////// 00685 // Function: GeomPipelineReader::get_usage_hint 00686 // Access: Public 00687 // Description: 00688 //////////////////////////////////////////////////////////////////// 00689 INLINE GeomPipelineReader::UsageHint GeomPipelineReader:: 00690 get_usage_hint() const { 00691 nassertr(_cdata->_got_usage_hint, UH_static); 00692 return _cdata->_usage_hint; 00693 } 00694 00695 //////////////////////////////////////////////////////////////////// 00696 // Function: GeomPipelineReader::get_vertex_data 00697 // Access: Public 00698 // Description: 00699 //////////////////////////////////////////////////////////////////// 00700 INLINE CPT(GeomVertexData) GeomPipelineReader:: 00701 get_vertex_data() const { 00702 return _cdata->_data.get_read_pointer(); 00703 } 00704 00705 //////////////////////////////////////////////////////////////////// 00706 // Function: GeomPipelineReader::get_num_primitives 00707 // Access: Public 00708 // Description: 00709 //////////////////////////////////////////////////////////////////// 00710 INLINE int GeomPipelineReader:: 00711 get_num_primitives() const { 00712 return _cdata->_primitives.size(); 00713 } 00714 00715 //////////////////////////////////////////////////////////////////// 00716 // Function: GeomPipelineReader::get_primitive 00717 // Access: Public 00718 // Description: 00719 //////////////////////////////////////////////////////////////////// 00720 INLINE CPT(GeomPrimitive) GeomPipelineReader:: 00721 get_primitive(int i) const { 00722 nassertr(i >= 0 && i < (int)_cdata->_primitives.size(), NULL); 00723 return _cdata->_primitives[i].get_read_pointer(); 00724 } 00725 00726 //////////////////////////////////////////////////////////////////// 00727 // Function: GeomPipelineReader::get_modified 00728 // Access: Public 00729 // Description: 00730 //////////////////////////////////////////////////////////////////// 00731 INLINE UpdateSeq GeomPipelineReader:: 00732 get_modified() const { 00733 return _cdata->_modified; 00734 } 00735 00736 INLINE ostream & 00737 operator << (ostream &out, const Geom &obj) { 00738 obj.output(out); 00739 return out; 00740 }