00001 // Filename: vertexDataBook.I 00002 // Created by: drose (16May07) 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: VertexDataBook::alloc 00018 // Access: Published 00019 // Description: Allocates and returns a new VertexDataBuffer of the 00020 // requested size. 00021 //////////////////////////////////////////////////////////////////// 00022 INLINE VertexDataBlock *VertexDataBook:: 00023 alloc(size_t size) { 00024 MutexHolder holder(_lock); 00025 return do_alloc(size); 00026 } 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Function: VertexDataBook::get_num_pages 00030 // Access: Published 00031 // Description: Returns the number of pages created for the book. 00032 //////////////////////////////////////////////////////////////////// 00033 INLINE int VertexDataBook:: 00034 get_num_pages() const { 00035 return _pages.size(); 00036 } 00037 00038 //////////////////////////////////////////////////////////////////// 00039 // Function: VertexDataBook::create_new_page 00040 // Access: Private 00041 // Description: Creates a new page of sufficient size to hold the 00042 // requested block. The page is not added to the _pages 00043 // list. 00044 //////////////////////////////////////////////////////////////////// 00045 INLINE VertexDataPage *VertexDataBook:: 00046 create_new_page(size_t size) { 00047 size_t page_size = ((size + _block_size - 1) / _block_size) * _block_size; 00048 return new VertexDataPage(this, page_size, _block_size); 00049 }