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