Panda3D
|
00001 // Filename: geomPrimitive.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: GeomPrimitive::get_shade_model 00018 // Access: Published 00019 // Description: Returns the ShadeModel hint for this primitive. 00020 // This is intended as a hint to the renderer to tell it 00021 // how the per-vertex colors and normals are applied. 00022 //////////////////////////////////////////////////////////////////// 00023 INLINE GeomPrimitive::ShadeModel GeomPrimitive:: 00024 get_shade_model() const { 00025 CDReader cdata(_cycler); 00026 return cdata->_shade_model; 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function: GeomPrimitive::set_shade_model 00031 // Access: Published 00032 // Description: Changes the ShadeModel hint for this primitive. 00033 // This is different from the ShadeModelAttrib that 00034 // might also be applied from the scene graph. This 00035 // does not affect the shade model that is in effect 00036 // when rendering, but rather serves as a hint to the 00037 // renderer to tell it how the per-vertex colors and 00038 // normals on this primitive are applied. 00039 // 00040 // Don't call this in a downstream thread unless you 00041 // don't mind it blowing away other changes you might 00042 // have recently made in an upstream thread. 00043 //////////////////////////////////////////////////////////////////// 00044 INLINE void GeomPrimitive:: 00045 set_shade_model(GeomPrimitive::ShadeModel shade_model) { 00046 CDWriter cdata(_cycler, true); 00047 cdata->_shade_model = shade_model; 00048 } 00049 00050 //////////////////////////////////////////////////////////////////// 00051 // Function: GeomPrimitive::get_usage_hint 00052 // Access: Published 00053 // Description: Returns the usage hint for this primitive. See 00054 // geomEnums.h. This has nothing to do with the usage 00055 // hint associated with the primitive's vertices; this 00056 // only specifies how often the vertex indices that 00057 // define the primitive will be modified. 00058 // 00059 // It is perfectly legal (and, in fact, common) for a 00060 // GeomPrimitive to have UH_static on itself, while 00061 // referencing vertex data with UH_dynamic. This means 00062 // that the vertices themselves will be animated, but 00063 // the primitive will always reference the same set of 00064 // vertices from the pool. 00065 //////////////////////////////////////////////////////////////////// 00066 INLINE GeomPrimitive::UsageHint GeomPrimitive:: 00067 get_usage_hint() const { 00068 CDReader cdata(_cycler); 00069 return cdata->_usage_hint; 00070 } 00071 00072 //////////////////////////////////////////////////////////////////// 00073 // Function: GeomPrimitive::get_index_type 00074 // Access: Public 00075 // Description: Returns the numeric type of the index column. 00076 // Normally, this will be either NT_uint16 or NT_uint32. 00077 //////////////////////////////////////////////////////////////////// 00078 INLINE GeomPrimitive::NumericType GeomPrimitive:: 00079 get_index_type() const { 00080 CDReader cdata(_cycler); 00081 return cdata->_index_type; 00082 } 00083 00084 //////////////////////////////////////////////////////////////////// 00085 // Function: GeomPrimitive::is_composite 00086 // Access: Published 00087 // Description: Returns true if the primitive is a composite 00088 // primitive such as a tristrip or trifan, or false if 00089 // it is a fundamental primitive such as a collection of 00090 // triangles. 00091 //////////////////////////////////////////////////////////////////// 00092 INLINE bool GeomPrimitive:: 00093 is_composite() const { 00094 return (get_num_vertices_per_primitive() == 0); 00095 } 00096 00097 //////////////////////////////////////////////////////////////////// 00098 // Function: GeomPrimitive::is_indexed 00099 // Access: Published 00100 // Description: Returns true if the primitive is indexed, false 00101 // otherwise. An indexed primitive stores a table of 00102 // index numbers into its GeomVertexData, so that it can 00103 // reference the vertices in any order. A nonindexed 00104 // primitive, on the other hand, stores only the first 00105 // vertex number and number of vertices used, so that it 00106 // can only reference the vertices consecutively. 00107 //////////////////////////////////////////////////////////////////// 00108 INLINE bool GeomPrimitive:: 00109 is_indexed() const { 00110 GeomPrimitivePipelineReader reader(this, Thread::get_current_thread()); 00111 return reader.is_indexed(); 00112 } 00113 00114 //////////////////////////////////////////////////////////////////// 00115 // Function: GeomPrimitive::get_first_vertex 00116 // Access: Published 00117 // Description: Returns the first vertex number referenced by the 00118 // primitive. This is particularly important in the 00119 // case of a nonindexed primitive, in which case 00120 // get_first_vertex() and get_num_vertices() completely 00121 // define the extent of the vertex range. 00122 //////////////////////////////////////////////////////////////////// 00123 INLINE int GeomPrimitive:: 00124 get_first_vertex() const { 00125 GeomPrimitivePipelineReader reader(this, Thread::get_current_thread()); 00126 return reader.get_first_vertex(); 00127 } 00128 00129 //////////////////////////////////////////////////////////////////// 00130 // Function: GeomPrimitive::get_num_vertices 00131 // Access: Published 00132 // Description: Returns the number of vertices used by all the 00133 // primitives in this object. 00134 //////////////////////////////////////////////////////////////////// 00135 INLINE int GeomPrimitive:: 00136 get_num_vertices() const { 00137 GeomPrimitivePipelineReader reader(this, Thread::get_current_thread()); 00138 return reader.get_num_vertices(); 00139 } 00140 00141 //////////////////////////////////////////////////////////////////// 00142 // Function: GeomPrimitive::get_vertex 00143 // Access: Published 00144 // Description: Returns the ith vertex index in the table. 00145 //////////////////////////////////////////////////////////////////// 00146 INLINE int GeomPrimitive:: 00147 get_vertex(int i) const { 00148 GeomPrimitivePipelineReader reader(this, Thread::get_current_thread()); 00149 return reader.get_vertex(i); 00150 } 00151 00152 //////////////////////////////////////////////////////////////////// 00153 // Function: GeomPrimitive::get_num_primitives 00154 // Access: Published 00155 // Description: Returns the number of individual primitives stored 00156 // within this object. All primitives are the same 00157 // type. 00158 //////////////////////////////////////////////////////////////////// 00159 INLINE int GeomPrimitive:: 00160 get_num_primitives() const { 00161 GeomPrimitivePipelineReader reader(this, Thread::get_current_thread()); 00162 return reader.get_num_primitives(); 00163 } 00164 00165 //////////////////////////////////////////////////////////////////// 00166 // Function: GeomPrimitive::get_num_faces 00167 // Access: Published 00168 // Description: Returns the number of triangles or other fundamental 00169 // type (such as line segments) represented by all the 00170 // primitives in this object. 00171 //////////////////////////////////////////////////////////////////// 00172 INLINE int GeomPrimitive:: 00173 get_num_faces() const { 00174 int num_vertices_per_primitive = get_num_vertices_per_primitive(); 00175 00176 if (num_vertices_per_primitive == 0) { 00177 int num_primitives = get_num_primitives(); 00178 int num_vertices = get_num_vertices(); 00179 int min_num_vertices_per_primitive = get_min_num_vertices_per_primitive(); 00180 int num_unused_vertices_per_primitive = get_num_unused_vertices_per_primitive(); 00181 return num_vertices - (num_primitives * (min_num_vertices_per_primitive - 1)) - ((num_primitives - 1) * num_unused_vertices_per_primitive); 00182 } else { 00183 return get_num_primitives(); 00184 } 00185 } 00186 00187 //////////////////////////////////////////////////////////////////// 00188 // Function: GeomPrimitive::get_primitive_num_faces 00189 // Access: Published 00190 // Description: Returns the number of triangles or other fundamental 00191 // type (such as line segments) represented by the nth 00192 // primitive in this object. 00193 //////////////////////////////////////////////////////////////////// 00194 INLINE int GeomPrimitive:: 00195 get_primitive_num_faces(int n) const { 00196 int num_vertices_per_primitive = get_num_vertices_per_primitive(); 00197 00198 if (num_vertices_per_primitive == 0) { 00199 return get_primitive_num_vertices(n) - get_min_num_vertices_per_primitive() + 1; 00200 } else { 00201 return 1; 00202 } 00203 } 00204 00205 //////////////////////////////////////////////////////////////////// 00206 // Function: GeomPrimitive::get_min_vertex 00207 // Access: Published 00208 // Description: Returns the minimum vertex index number used by all 00209 // the primitives in this object. 00210 //////////////////////////////////////////////////////////////////// 00211 INLINE int GeomPrimitive:: 00212 get_min_vertex() const { 00213 GeomPrimitivePipelineReader reader(this, Thread::get_current_thread()); 00214 reader.check_minmax(); 00215 return reader.get_min_vertex(); 00216 } 00217 00218 //////////////////////////////////////////////////////////////////// 00219 // Function: GeomPrimitive::get_max_vertex 00220 // Access: Published 00221 // Description: Returns the maximum vertex index number used by all 00222 // the primitives in this object. 00223 //////////////////////////////////////////////////////////////////// 00224 INLINE int GeomPrimitive:: 00225 get_max_vertex() const { 00226 GeomPrimitivePipelineReader reader(this, Thread::get_current_thread()); 00227 reader.check_minmax(); 00228 return reader.get_max_vertex(); 00229 } 00230 00231 //////////////////////////////////////////////////////////////////// 00232 // Function: GeomPrimitive::get_data_size_bytes 00233 // Access: Published 00234 // Description: Returns the number of bytes stored in the vertices 00235 // array. 00236 //////////////////////////////////////////////////////////////////// 00237 INLINE int GeomPrimitive:: 00238 get_data_size_bytes() const { 00239 CDReader cdata(_cycler); 00240 nassertr(!cdata->_vertices.is_null(), 0); 00241 return cdata->_vertices.get_read_pointer()->get_data_size_bytes(); 00242 } 00243 00244 //////////////////////////////////////////////////////////////////// 00245 // Function: GeomPrimitive::get_modified 00246 // Access: Published 00247 // Description: Returns a sequence number which is guaranteed to 00248 // change at least every time the vertex index array is 00249 // modified. 00250 //////////////////////////////////////////////////////////////////// 00251 INLINE UpdateSeq GeomPrimitive:: 00252 get_modified() const { 00253 CDReader cdata(_cycler); 00254 return cdata->_modified; 00255 } 00256 00257 //////////////////////////////////////////////////////////////////// 00258 // Function: GeomPrimitive::check_valid 00259 // Access: Published 00260 // Description: Verifies that the primitive only references vertices 00261 // that actually exist within the indicated 00262 // GeomVertexData. Returns true if the primitive 00263 // appears to be valid, false otherwise. 00264 //////////////////////////////////////////////////////////////////// 00265 INLINE bool GeomPrimitive:: 00266 check_valid(const GeomVertexData *vertex_data) const { 00267 Thread *current_thread = Thread::get_current_thread(); 00268 GeomPrimitivePipelineReader reader(this, current_thread); 00269 reader.check_minmax(); 00270 GeomVertexDataPipelineReader data_reader(vertex_data, current_thread); 00271 data_reader.check_array_readers(); 00272 return reader.check_valid(&data_reader); 00273 } 00274 00275 //////////////////////////////////////////////////////////////////// 00276 // Function: GeomPrimitive::get_vertices 00277 // Access: Published 00278 // Description: Returns a const pointer to the vertex index array so 00279 // application code can read it directly. This might 00280 // return NULL if the primitive is nonindexed. Do not 00281 // attempt to modify the returned array; use 00282 // modify_vertices() or set_vertices() for this. 00283 // 00284 // This method is intended for low-level usage only. 00285 // There are higher-level methods for more common usage. 00286 // We recommend you do not use this method directly. If 00287 // you do, be sure you know what you are doing! 00288 //////////////////////////////////////////////////////////////////// 00289 INLINE CPT(GeomVertexArrayData) GeomPrimitive:: 00290 get_vertices() const { 00291 CDReader cdata(_cycler); 00292 return cdata->_vertices.get_read_pointer(); 00293 } 00294 00295 //////////////////////////////////////////////////////////////////// 00296 // Function: GeomPrimitive::get_index_stride 00297 // Access: Published 00298 // Description: A convenience function to return the gap between 00299 // successive index numbers, in bytes, of the index 00300 // data. 00301 // 00302 // This method is intended for low-level usage only. 00303 // There are higher-level methods for more common usage. 00304 // We recommend you do not use this method directly. If 00305 // you do, be sure you know what you are doing! 00306 //////////////////////////////////////////////////////////////////// 00307 INLINE int GeomPrimitive:: 00308 get_index_stride() const { 00309 GeomPrimitivePipelineReader reader(this, Thread::get_current_thread()); 00310 return reader.get_index_stride(); 00311 } 00312 00313 //////////////////////////////////////////////////////////////////// 00314 // Function: GeomPrimitive::get_ends 00315 // Access: Published 00316 // Description: Returns a const pointer to the primitive ends 00317 // array so application code can read it directly. Do 00318 // not attempt to modify the returned array; use 00319 // modify_ends() or set_ends() for this. 00320 // 00321 // Note that simple primitive types, like triangles, do 00322 // not have a ends array: since all the primitives 00323 // have the same number of vertices, it is not needed. 00324 // 00325 // This method is intended for low-level usage only. 00326 // There are higher-level methods for more common usage. 00327 // We recommend you do not use this method directly. If 00328 // you do, be sure you know what you are doing! 00329 //////////////////////////////////////////////////////////////////// 00330 INLINE CPTA_int GeomPrimitive:: 00331 get_ends() const { 00332 CDReader cdata(_cycler); 00333 return cdata->_ends; 00334 } 00335 00336 //////////////////////////////////////////////////////////////////// 00337 // Function: GeomPrimitive::get_mins 00338 // Access: Published 00339 // Description: Returns a const pointer to the primitive mins 00340 // array so application code can read it directly. Do 00341 // not attempt to modify the returned array; use 00342 // set_minmax() for this. 00343 // 00344 // Note that simple primitive types, like triangles, do 00345 // not have a mins array. 00346 // 00347 // This method is intended for low-level usage only. 00348 // There are higher-level methods for more common usage. 00349 // We recommend you do not use this method directly. If 00350 // you do, be sure you know what you are doing! 00351 //////////////////////////////////////////////////////////////////// 00352 INLINE CPT(GeomVertexArrayData) GeomPrimitive:: 00353 get_mins() const { 00354 GeomPrimitivePipelineReader reader(this, Thread::get_current_thread()); 00355 reader.check_minmax(); 00356 return reader.get_mins(); 00357 } 00358 00359 //////////////////////////////////////////////////////////////////// 00360 // Function: GeomPrimitive::get_maxs 00361 // Access: Published 00362 // Description: Returns a const pointer to the primitive maxs 00363 // array so application code can read it directly. Do 00364 // not attempt to modify the returned array; use 00365 // set_minmax(). 00366 // 00367 // Note that simple primitive types, like triangles, do 00368 // not have a maxs array. 00369 // 00370 // This method is intended for low-level usage only. 00371 // There are higher-level methods for more common usage. 00372 // We recommend you do not use this method directly. If 00373 // you do, be sure you know what you are doing! 00374 //////////////////////////////////////////////////////////////////// 00375 INLINE CPT(GeomVertexArrayData) GeomPrimitive:: 00376 get_maxs() const { 00377 GeomPrimitivePipelineReader reader(this, Thread::get_current_thread()); 00378 reader.check_minmax(); 00379 return reader.get_maxs(); 00380 } 00381 00382 //////////////////////////////////////////////////////////////////// 00383 // Function: GeomPrimitive::add_vertices 00384 // Access: Public 00385 // Description: Adds several vertices in a row. 00386 //////////////////////////////////////////////////////////////////// 00387 INLINE void GeomPrimitive:: 00388 add_vertices(int v1, int v2) { 00389 add_vertex(v1); 00390 add_vertex(v2); 00391 } 00392 00393 //////////////////////////////////////////////////////////////////// 00394 // Function: GeomPrimitive::add_vertices 00395 // Access: Public 00396 // Description: Adds several vertices in a row. 00397 //////////////////////////////////////////////////////////////////// 00398 INLINE void GeomPrimitive:: 00399 add_vertices(int v1, int v2, int v3) { 00400 add_vertex(v1); 00401 add_vertex(v2); 00402 add_vertex(v3); 00403 } 00404 00405 //////////////////////////////////////////////////////////////////// 00406 // Function: GeomPrimitive::add_vertices 00407 // Access: Public 00408 // Description: Adds several vertices in a row. 00409 //////////////////////////////////////////////////////////////////// 00410 INLINE void GeomPrimitive:: 00411 add_vertices(int v1, int v2, int v3, int v4) { 00412 add_vertex(v1); 00413 add_vertex(v2); 00414 add_vertex(v3); 00415 add_vertex(v4); 00416 } 00417 00418 //////////////////////////////////////////////////////////////////// 00419 // Function: GeomPrimitive::make_index_data 00420 // Access: Public 00421 // Description: Creates and returns a new, empty index table. 00422 //////////////////////////////////////////////////////////////////// 00423 INLINE PT(GeomVertexArrayData) GeomPrimitive:: 00424 make_index_data() const { 00425 return new GeomVertexArrayData(get_index_format(), get_usage_hint()); 00426 } 00427 00428 //////////////////////////////////////////////////////////////////// 00429 // Function: GeomPrimitive::CData::Constructor 00430 // Access: Public 00431 // Description: 00432 //////////////////////////////////////////////////////////////////// 00433 INLINE GeomPrimitive::CData:: 00434 CData() : 00435 _shade_model(SM_smooth), 00436 _first_vertex(0), 00437 _num_vertices(0), 00438 _index_type(NT_uint16), 00439 _usage_hint(UH_unspecified), 00440 _got_minmax(true), 00441 _min_vertex(0), 00442 _max_vertex(0) 00443 { 00444 } 00445 00446 //////////////////////////////////////////////////////////////////// 00447 // Function: GeomPrimitive::CData::Copy Constructor 00448 // Access: Public 00449 // Description: 00450 //////////////////////////////////////////////////////////////////// 00451 INLINE GeomPrimitive::CData:: 00452 CData(const GeomPrimitive::CData ©) : 00453 _shade_model(copy._shade_model), 00454 _first_vertex(copy._first_vertex), 00455 _num_vertices(copy._num_vertices), 00456 _index_type(copy._index_type), 00457 _usage_hint(copy._usage_hint), 00458 _vertices(copy._vertices), 00459 _ends(copy._ends), 00460 _mins(copy._mins), 00461 _maxs(copy._maxs), 00462 _modified(copy._modified), 00463 _got_minmax(copy._got_minmax), 00464 _min_vertex(copy._min_vertex), 00465 _max_vertex(copy._max_vertex) 00466 { 00467 } 00468 //////////////////////////////////////////////////////////////////// 00469 // Function: GeomPrimitivePipelineReader::Constructor 00470 // Access: Public 00471 // Description: 00472 //////////////////////////////////////////////////////////////////// 00473 INLINE GeomPrimitivePipelineReader:: 00474 GeomPrimitivePipelineReader(const GeomPrimitive *object, 00475 Thread *current_thread) : 00476 _object(object), 00477 _current_thread(current_thread), 00478 _cdata(object->_cycler.read_unlocked(current_thread)), 00479 _vertices_reader(NULL) 00480 { 00481 nassertv(_object->test_ref_count_nonzero()); 00482 #ifdef DO_PIPELINING 00483 _cdata->ref(); 00484 #endif // DO_PIPELINING 00485 if (!_cdata->_vertices.is_null()) { 00486 _vertices_reader = _cdata->_vertices.get_read_pointer()->get_handle(); 00487 } 00488 } 00489 00490 //////////////////////////////////////////////////////////////////// 00491 // Function: GeomPrimitivePipelineReader::Copy Constructor 00492 // Access: Private 00493 // Description: Don't attempt to copy these objects. 00494 //////////////////////////////////////////////////////////////////// 00495 INLINE GeomPrimitivePipelineReader:: 00496 GeomPrimitivePipelineReader(const GeomPrimitivePipelineReader &) { 00497 nassertv(false); 00498 } 00499 00500 //////////////////////////////////////////////////////////////////// 00501 // Function: GeomPrimitivePipelineReader::Copy Assignment Operator 00502 // Access: Private 00503 // Description: Don't attempt to copy these objects. 00504 //////////////////////////////////////////////////////////////////// 00505 INLINE void GeomPrimitivePipelineReader:: 00506 operator = (const GeomPrimitivePipelineReader &) { 00507 nassertv(false); 00508 } 00509 00510 //////////////////////////////////////////////////////////////////// 00511 // Function: GeomPrimitivePipelineReader::Destructor 00512 // Access: Public 00513 // Description: 00514 //////////////////////////////////////////////////////////////////// 00515 INLINE GeomPrimitivePipelineReader:: 00516 ~GeomPrimitivePipelineReader() { 00517 #ifdef _DEBUG 00518 nassertv(_object->test_ref_count_nonzero()); 00519 #endif // _DEBUG 00520 // _object->_cycler.release_read(_cdata); 00521 00522 #ifdef DO_PIPELINING 00523 unref_delete((CycleData *)_cdata); 00524 #endif // DO_PIPELINING 00525 00526 #ifdef _DEBUG 00527 _vertices_reader = NULL; 00528 _object = NULL; 00529 _cdata = NULL; 00530 #endif // _DEBUG 00531 } 00532 00533 //////////////////////////////////////////////////////////////////// 00534 // Function: GeomPrimitivePipelineReader::get_object 00535 // Access: Public 00536 // Description: 00537 //////////////////////////////////////////////////////////////////// 00538 INLINE const GeomPrimitive *GeomPrimitivePipelineReader:: 00539 get_object() const { 00540 return _object; 00541 } 00542 00543 //////////////////////////////////////////////////////////////////// 00544 // Function: GeomPrimitivePipelineReader::get_current_thread 00545 // Access: Public 00546 // Description: 00547 //////////////////////////////////////////////////////////////////// 00548 INLINE Thread *GeomPrimitivePipelineReader:: 00549 get_current_thread() const { 00550 return _current_thread; 00551 } 00552 00553 //////////////////////////////////////////////////////////////////// 00554 // Function: GeomPrimitivePipelineReader::get_shade_model 00555 // Access: Public 00556 // Description: 00557 //////////////////////////////////////////////////////////////////// 00558 INLINE GeomPrimitivePipelineReader::ShadeModel GeomPrimitivePipelineReader:: 00559 get_shade_model() const { 00560 return _cdata->_shade_model; 00561 } 00562 00563 //////////////////////////////////////////////////////////////////// 00564 // Function: GeomPrimitivePipelineReader::get_usage_hint 00565 // Access: Public 00566 // Description: 00567 //////////////////////////////////////////////////////////////////// 00568 INLINE GeomPrimitivePipelineReader::UsageHint GeomPrimitivePipelineReader:: 00569 get_usage_hint() const { 00570 return _cdata->_usage_hint; 00571 } 00572 00573 //////////////////////////////////////////////////////////////////// 00574 // Function: GeomPrimitivePipelineReader::get_index_type 00575 // Access: Public 00576 // Description: 00577 //////////////////////////////////////////////////////////////////// 00578 INLINE GeomPrimitivePipelineReader::NumericType GeomPrimitivePipelineReader:: 00579 get_index_type() const { 00580 return _cdata->_index_type; 00581 } 00582 00583 //////////////////////////////////////////////////////////////////// 00584 // Function: GeomPrimitivePipelineReader::is_indexed 00585 // Access: Public 00586 // Description: 00587 //////////////////////////////////////////////////////////////////// 00588 INLINE bool GeomPrimitivePipelineReader:: 00589 is_indexed() const { 00590 return (!_cdata->_vertices.is_null()); 00591 } 00592 00593 //////////////////////////////////////////////////////////////////// 00594 // Function: GeomPrimitivePipelineReader::get_num_vertices 00595 // Access: Public 00596 // Description: 00597 //////////////////////////////////////////////////////////////////// 00598 INLINE int GeomPrimitivePipelineReader:: 00599 get_num_vertices() const { 00600 if (_cdata->_num_vertices != -1) { 00601 return _cdata->_num_vertices; 00602 } else { 00603 nassertr(!_cdata->_vertices.is_null(), 0); 00604 return _vertices_reader->get_num_rows(); 00605 } 00606 } 00607 00608 //////////////////////////////////////////////////////////////////// 00609 // Function: GeomPrimitivePipelineReader::get_min_vertex 00610 // Access: Public 00611 // Description: 00612 //////////////////////////////////////////////////////////////////// 00613 INLINE int GeomPrimitivePipelineReader:: 00614 get_min_vertex() const { 00615 nassertr(_cdata->_got_minmax, 0); 00616 return _cdata->_min_vertex; 00617 } 00618 00619 //////////////////////////////////////////////////////////////////// 00620 // Function: GeomPrimitivePipelineReader::get_max_vertex 00621 // Access: Public 00622 // Description: 00623 //////////////////////////////////////////////////////////////////// 00624 INLINE int GeomPrimitivePipelineReader:: 00625 get_max_vertex() const { 00626 nassertr(_cdata->_got_minmax, 0); 00627 return _cdata->_max_vertex; 00628 } 00629 00630 //////////////////////////////////////////////////////////////////// 00631 // Function: GeomPrimitivePipelineReader::get_data_size_bytes 00632 // Access: Published 00633 // Description: Returns the number of bytes stored in the vertices 00634 // array. 00635 //////////////////////////////////////////////////////////////////// 00636 INLINE int GeomPrimitivePipelineReader:: 00637 get_data_size_bytes() const { 00638 return _vertices_reader->get_data_size_bytes(); 00639 } 00640 00641 //////////////////////////////////////////////////////////////////// 00642 // Function: GeomPrimitivePipelineReader::get_modified 00643 // Access: Public 00644 // Description: 00645 //////////////////////////////////////////////////////////////////// 00646 INLINE UpdateSeq GeomPrimitivePipelineReader:: 00647 get_modified() const { 00648 return _cdata->_modified; 00649 } 00650 00651 //////////////////////////////////////////////////////////////////// 00652 // Function: GeomPrimitivePipelineReader::get_index_stride 00653 // Access: Public 00654 // Description: 00655 //////////////////////////////////////////////////////////////////// 00656 INLINE int GeomPrimitivePipelineReader:: 00657 get_index_stride() const { 00658 nassertr(is_indexed(), 0); 00659 return _cdata->_vertices.get_read_pointer()->get_array_format()->get_stride(); 00660 } 00661 00662 //////////////////////////////////////////////////////////////////// 00663 // Function: GeomPrimitivePipelineReader::get_vertices_reader 00664 // Access: Public 00665 // Description: 00666 //////////////////////////////////////////////////////////////////// 00667 INLINE const GeomVertexArrayDataHandle *GeomPrimitivePipelineReader:: 00668 get_vertices_reader() const { 00669 return _vertices_reader; 00670 } 00671 00672 //////////////////////////////////////////////////////////////////// 00673 // Function: GeomPrimitivePipelineReader::get_read_pointer 00674 // Access: Public 00675 // Description: 00676 //////////////////////////////////////////////////////////////////// 00677 INLINE const unsigned char *GeomPrimitivePipelineReader:: 00678 get_read_pointer(bool force) const { 00679 return _vertices_reader->get_read_pointer(force); 00680 } 00681 00682 //////////////////////////////////////////////////////////////////// 00683 // Function: GeomPrimitivePipelineReader::get_ends 00684 // Access: Public 00685 // Description: 00686 //////////////////////////////////////////////////////////////////// 00687 INLINE CPTA_int GeomPrimitivePipelineReader:: 00688 get_ends() const { 00689 return _cdata->_ends; 00690 } 00691 00692 //////////////////////////////////////////////////////////////////// 00693 // Function: GeomPrimitivePipelineReader::get_mins 00694 // Access: Public 00695 // Description: 00696 //////////////////////////////////////////////////////////////////// 00697 INLINE CPT(GeomVertexArrayData) GeomPrimitivePipelineReader:: 00698 get_mins() const { 00699 nassertr(is_indexed(), NULL); 00700 nassertr(_cdata->_got_minmax, NULL); 00701 return _cdata->_mins.get_read_pointer(); 00702 } 00703 00704 //////////////////////////////////////////////////////////////////// 00705 // Function: GeomPrimitivePipelineReader::get_maxs 00706 // Access: Public 00707 // Description: 00708 //////////////////////////////////////////////////////////////////// 00709 INLINE CPT(GeomVertexArrayData) GeomPrimitivePipelineReader:: 00710 get_maxs() const { 00711 nassertr(is_indexed(), NULL); 00712 nassertr(_cdata->_got_minmax, NULL); 00713 return _cdata->_maxs.get_read_pointer(); 00714 } 00715 00716 INLINE ostream & 00717 operator << (ostream &out, const GeomPrimitive &obj) { 00718 obj.output(out); 00719 return out; 00720 }