Panda3D
panda
src
gobj
vertexDataBlock.I
1
// Filename: vertexDataBlock.I
2
// Created by: drose (04Jun07)
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: VertexDataBlock::Constructor
18
// Access: Published
19
// Description:
20
////////////////////////////////////////////////////////////////////
21
INLINE VertexDataBlock::
22
VertexDataBlock(
VertexDataPage
*page,
size_t
start,
size_t
size) :
23
SimpleAllocatorBlock
(page, start, size)
24
{
25
}
26
27
////////////////////////////////////////////////////////////////////
28
// Function: VertexDataBlock::get_page
29
// Access: Published
30
// Description: Returns the page from which this buffer was
31
// allocated.
32
////////////////////////////////////////////////////////////////////
33
INLINE
VertexDataPage
*
VertexDataBlock::
34
get_page
()
const
{
35
return
(
VertexDataPage
*)
get_allocator
();
36
}
37
38
////////////////////////////////////////////////////////////////////
39
// Function: VertexDataBlock::get_pointer
40
// Access: Public
41
// Description: Returns a pointer to the start of the allocated
42
// memory for this buffer, or NULL if the data is not
43
// currently resident. If the data is not currently
44
// resident, this will implicitly request it to become
45
// resident soon.
46
//
47
// If force is true, this method will never return NULL,
48
// but may block until the data is available.
49
////////////////////////////////////////////////////////////////////
50
INLINE
unsigned
char
*
VertexDataBlock::
51
get_pointer
(
bool
force)
const
{
52
nassertr(
get_page
() != (
VertexDataPage
*)NULL, NULL);
53
unsigned
char
*page_data =
get_page
()->
get_page_data
(force);
54
if
(page_data == (
unsigned
char
*)NULL) {
55
return
NULL;
56
}
else
{
57
return
page_data +
get_start
();
58
}
59
}
60
61
////////////////////////////////////////////////////////////////////
62
// Function: VertexDataBlock::get_next_block
63
// Access: Published
64
// Description: Returns a pointer to the next allocated block in the
65
// chain, or NULL if there are no more allocated blocks.
66
////////////////////////////////////////////////////////////////////
67
INLINE
VertexDataBlock
*
VertexDataBlock::
68
get_next_block
()
const
{
69
return
(
VertexDataBlock
*)
SimpleAllocatorBlock::get_next_block
();
70
}
VertexDataPage
A block of bytes that holds one or more VertexDataBlocks.
Definition:
vertexDataPage.h:40
VertexDataBlock::get_pointer
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...
Definition:
vertexDataBlock.I:51
VertexDataBlock::get_next_block
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...
Definition:
vertexDataBlock.I:68
VertexDataBlock
A block of bytes that stores the actual raw vertex data referenced by a GeomVertexArrayData object...
Definition:
vertexDataBlock.h:31
SimpleAllocatorBlock
A single block as returned from SimpleAllocator::alloc().
Definition:
simpleAllocator.h:95
SimpleAllocatorBlock::get_next_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...
Definition:
simpleAllocator.I:282
VertexDataBlock::get_page
VertexDataPage * get_page() const
Returns the page from which this buffer was allocated.
Definition:
vertexDataBlock.I:34
SimpleAllocatorBlock::get_start
size_t get_start() const
Returns the starting point of this block.
Definition:
simpleAllocator.I:220
VertexDataPage::get_page_data
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.
Definition:
vertexDataPage.I:210
SimpleAllocatorBlock::get_allocator
SimpleAllocator * get_allocator() const
Returns the SimpleAllocator object that owns this block.
Definition:
simpleAllocator.I:209
Generated on Wed May 17 2017 23:43:02 for Panda3D by
1.8.13