|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Public Types | |
| MaxChunkSize = 8 * 1024 * 1024 | |
| Maximum size chunk we support reading/writing. | |
| enum | { MaxChunkSize = 8 * 1024 * 1024 } |
Public Member Functions | |
| AtlasChunk () | |
| virtual | ~AtlasChunk () |
| virtual void | write (Stream *s) |
| Serialize this chunk to a stream. | |
| virtual void | read (Stream *s) |
| Deserialize from a stream. | |
| virtual void | process () |
| Once the chunk has been loaded (in another thread), this is called in the main thread to prepare any complex resources. | |
| virtual void | generate (AtlasChunk *children[4]) |
| Given four children, (re)generate the data for this one. | |
Sentinel Interface | |
To make sure we don't have read/write mismatches, we write a sentinel value before and after the chunk. This is unique for each type to ensure we don't mis-read a chunk. Chunk sentinel functionality is implemented by writeToFile and readFromStream. | |
| virtual U32 | getHeadSentinel () |
| virtual U32 | getTailSentinel () |
Static Public Member Functions | |
Static IO Interface | |
These helper functions allow us to read and write AtlasChunks in a standardized way. They deal with reading headers, comparing sentinels, filling in ADIOs, and so forth.
Most of the time these functions are used for chunk IO, rather than a chunk's read/write. | |
| static U32 | writeToStream (AtlasChunk *ac, Stream *s) |
| This is not currently used; consider prepareDeferredWrite(). | |
| static bool | readFromStream (AtlasChunk *ac, Stream *s) |
| static AtlasDeferredIO * | prepareDeferredWrite (AtlasChunk *ac) |
| Allocate and prepare a new ADIO which contains a serialized version of this chunk. | |
Public Attributes | |
| U32 | mChunkSize |
| Size in bytes of this chunk. | |
| U32 | mPreviousChunk |
| Offset in file to previous chunk, if any. | |
| AtlasTOC * | mOwningTOC |
| The TOC to which we belong. | |
| anonymous enum |
| AtlasChunk::AtlasChunk | ( | ) | [inline] |
| virtual AtlasChunk::~AtlasChunk | ( | ) | [virtual] |
| static U32 AtlasChunk::writeToStream | ( | AtlasChunk * | ac, | |
| Stream * | s | |||
| ) | [static] |
This is not currently used; consider prepareDeferredWrite().
| static bool AtlasChunk::readFromStream | ( | AtlasChunk * | ac, | |
| Stream * | s | |||
| ) | [static] |
| static AtlasDeferredIO* AtlasChunk::prepareDeferredWrite | ( | AtlasChunk * | ac | ) | [static] |
Allocate and prepare a new ADIO which contains a serialized version of this chunk.
Serialize this chunk to a stream.
Reimplemented in AtlasConfigChunk, AtlasGeomChunk, and AtlasTexChunk.
Deserialize from a stream.
Reimplemented in AtlasConfigChunk, AtlasGeomChunk, and AtlasTexChunk.
| virtual void AtlasChunk::process | ( | ) | [virtual] |
Once the chunk has been loaded (in another thread), this is called in the main thread to prepare any complex resources.
(For instance, a texture or VB, that depend on access to GFX to initialize.)
Reimplemented in AtlasConfigChunk, AtlasGeomChunk, and AtlasTexChunk.
| virtual void AtlasChunk::generate | ( | AtlasChunk * | children[4] | ) | [virtual] |
Given four children, (re)generate the data for this one.
Their order starts at topleft, clockwise, 0123.
Reimplemented in AtlasConfigChunk, AtlasGeomChunk, and AtlasTexChunk.
| virtual U32 AtlasChunk::getHeadSentinel | ( | ) | [virtual] |
Reimplemented in AtlasConfigChunk, AtlasGeomChunk, and AtlasTexChunk.
| virtual U32 AtlasChunk::getTailSentinel | ( | ) | [virtual] |
Reimplemented in AtlasConfigChunk, AtlasGeomChunk, and AtlasTexChunk.
Size in bytes of this chunk.
First word written, so we can rapidly load the chunk from disk in a single block, then process from memory.
Offset in file to previous chunk, if any.
Used to backtrack for undo, history analysis, etc.
The TOC to which we belong.