Panda3D
Loading...
Searching...
No Matches
vertexDataBlock.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 vertexDataBlock.I
10 * @author drose
11 * @date 2007-06-04
12 */
13
14/**
15 *
16 */
17INLINE VertexDataBlock::
18VertexDataBlock(VertexDataPage *page, size_t start, size_t size) :
19 SimpleAllocatorBlock(page, start, size)
20{
21}
22
23/**
24 * Returns the page from which this buffer was allocated.
25 */
30
31/**
32 * Returns a pointer to the start of the allocated memory for this buffer, or
33 * NULL if the data is not currently resident. If the data is not currently
34 * resident, this will implicitly request it to become resident soon.
35 *
36 * If force is true, this method will never return NULL, but may block until
37 * the data is available.
38 */
39INLINE unsigned char *VertexDataBlock::
40get_pointer(bool force) const {
41 nassertr(get_page() != nullptr, nullptr);
42 unsigned char *page_data = get_page()->get_page_data(force);
43 if (page_data == nullptr) {
44 return nullptr;
45 } else {
46 return page_data + get_start();
47 }
48}
49
50/**
51 * Returns a pointer to the next allocated block in the chain, or NULL if
52 * there are no more allocated blocks.
53 */
A single block as returned from SimpleAllocator::alloc().
SimpleAllocator * get_allocator() const
Returns the SimpleAllocator object that owns this block.
SimpleAllocatorBlock * get_next_block() const
Returns a pointer to the next allocated block in the chain, or NULL if there are no more allocated bl...
size_t get_start() const
Returns the starting point of this block.
A block of bytes that stores the actual raw vertex data referenced by a GeomVertexArrayData object.
VertexDataPage * get_page() const
Returns the page from which this buffer was allocated.
VertexDataBlock * get_next_block() const
Returns a pointer to the next allocated block in the chain, or NULL if there are no more allocated bl...
unsigned char * get_pointer(bool force) const
Returns a pointer to the start of the allocated memory for this buffer, or NULL if the data is not cu...
A block of bytes that holds one or more VertexDataBlocks.
unsigned char * get_page_data(bool force)
Returns a pointer to the page's data area, or NULL if the page is not currently resident.