Panda3D
vertexDataBook.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file vertexDataBook.I
10  * @author drose
11  * @date 2007-05-16
12  */
13 
14 /**
15  * Allocates and returns a new VertexDataBuffer of the requested size.
16  */
18 alloc(size_t size) {
19  MutexHolder holder(_lock);
20  return do_alloc(size);
21 }
22 
23 /**
24  * Returns the number of pages created for the book.
25  */
26 INLINE size_t VertexDataBook::
27 get_num_pages() const {
28  return _pages.size();
29 }
30 
31 /**
32  * Creates a new page of sufficient size to hold the requested block. The
33  * page is not added to the _pages list.
34  */
35 INLINE VertexDataPage *VertexDataBook::
36 create_new_page(size_t size) {
37  size_t page_size = ((size + _block_size - 1) / _block_size) * _block_size;
38  return new VertexDataPage(this, page_size, _block_size);
39 }
A block of bytes that holds one or more VertexDataBlocks.
A lightweight C++ object whose constructor calls acquire() and whose destructor calls release() on a ...
Definition: mutexHolder.h:25
A block of bytes that stores the actual raw vertex data referenced by a GeomVertexArrayData object.
size_t get_num_pages() const
Returns the number of pages created for the book.
VertexDataBlock * alloc(size_t size)
Allocates and returns a new VertexDataBuffer of the requested size.