Ptex: PtexReader Class Reference

Ptex

Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
PtexReader Class Reference

`#include <PtexReader.h>`

Inheritance diagram for PtexReader:

## Classes
class | ConstantFace
class | ConstDataPtr
class | DefaultInputHandler
class | ErrorFace
class | FaceData
struct | FaceEdit
class | Level
class | MetaData
struct | MetaEdit
class | PackedFace
class | ReductionKey
class | TiledFace
class | TiledFaceBase
class | TiledReducedFace

## Public Member Functions
| PtexReader (bool premultiply, PtexInputHandler *inputHandler, PtexErrorHandler *errorHandler)
virtual | ~PtexReader ()
virtual void | release ()
| Release resources held by this pointer (pointer becomes invalid). More...
bool | needToOpen () const
bool | open (const char *path, Ptex::String &error)
void | prune ()
void | purge ()
void | setPendingPurge ()
bool | pendingPurge () const
bool | tryClose ()
bool | ok () const
bool | isOpen ()
void | invalidate ()
void | increaseMemUsed (size_t amount)
void | logOpen ()
void | logBlockRead ()
virtual const char * | path ()
| Path that file was opened with. More...
virtual Info | getInfo ()
virtual Ptex::MeshType | meshType ()
| Type of mesh for which texture data is defined. More...
virtual Ptex::DataType | dataType ()
| Type of data stored in file. More...
virtual Ptex::BorderMode | uBorderMode ()
| Mode for filtering texture access beyond mesh border. More...
virtual Ptex::BorderMode | vBorderMode ()
| Mode for filtering texture access beyond mesh border. More...
virtual Ptex::EdgeFilterMode | edgeFilterMode ()
| Mode for filtering textures across edges. More...
virtual int | alphaChannel ()
| Index of alpha channel (if any). More...
virtual int | numChannels ()
| Number of channels stored in file. More...
virtual int | numFaces ()
| Number of faces stored in file. More...
virtual bool | hasEdits ()
| True if the file has edit blocks. More...
virtual bool | hasMipMaps ()
| True if the file has mipmaps. More...
virtual PtexMetaData * | getMetaData ()
| Access meta data. More...
virtual const Ptex::FaceInfo & | getFaceInfo (int faceid)
| Access resolution and adjacency information about a face. More...
virtual void | getData (int faceid, void *buffer, int stride)
| Access texture data for a face at highest-resolution. More...
virtual void | getData (int faceid, void *buffer, int stride, Res res)
virtual PtexFaceData * | getData (int faceid)
| Access texture data for a face at highest-resolution as stored on disk. More...
virtual PtexFaceData * | getData (int faceid, Res res)
virtual void | getPixel (int faceid, int u, int v, float *result, int firstchan, int nchannels)
| Access a single texel from the highest resolution texture . More...
virtual void | getPixel (int faceid, int u, int v, float *result, int firstchan, int nchannels, Ptex::Res res)
| Access a single texel for a face at a particular resolution. More...
DataType | datatype () const
int | nchannels () const
int | pixelsize () const
const Header & | header () const
const ExtHeader & | extheader () const
const LevelInfo & | levelinfo (int level) const
Public Member Functions inherited from PtexTexture
virtual void | getData (int faceid, void *buffer, int stride, Ptex::Res res)=0
| Access texture data for a face at a specific resolution. More...
virtual PtexFaceData * | getData (int faceid, Ptex::Res res)=0
| Access texture data for a face at a specific resolution as stored on disk. More...

## Protected Types
typedef PtexHashMap< ReductionKey, FaceData * > | ReductionMap

## Protected Member Functions
void | setError (const char *error)
FilePos | tell ()
void | seek (FilePos pos)
void | closeFP ()
bool | reopenFP ()
bool | readBlock (void *data, int size, bool reportError=true)
bool | readZipBlock (void *data, int zipsize, int unzipsize)
Level * | getLevel (int levelid)
uint8_t * | getConstData ()
FaceData * | getFace (int levelid, Level *level, int faceid, Res res)
void | readFaceInfo ()
void | readLevelInfo ()
void | readConstData ()
void | readLevel (int levelid, Level *&level)
void | readFace (int levelid, Level *level, int faceid, Res res)
void | readFaceData (FilePos pos, FaceDataHeader fdh, Res res, int levelid, FaceData *&face)
void | readMetaData ()
void | readMetaDataBlock (MetaData *metadata, FilePos pos, int zipsize, int memsize, size_t &metaDataMemUsed)
void | readLargeMetaDataHeaders (MetaData *metadata, FilePos pos, int zipsize, int memsize, size_t &metaDataMemUsed)
void | readEditData ()
void | readEditFaceData ()
void | readEditMetaData ()
FaceData * | errorData (bool deleteOnRelease=false)
void | computeOffsets (FilePos pos, int noffsets, const FaceDataHeader *fdh, FilePos *offsets)
Protected Member Functions inherited from PtexTexture
virtual | ~PtexTexture ()
| Destructor not for public use. Use release() instead. More...

## Protected Attributes
Mutex | readlock
DefaultInputHandler | _defaultIo
PtexInputHandler * | _io
PtexErrorHandler * | _err
bool | _premultiply
bool | _ok
bool | _needToOpen
bool | _pendingPurge
PtexInputHandler::Handle | _fp
FilePos | _pos
std::string | _path
Header | _header
ExtHeader | _extheader
FilePos | _faceinfopos
FilePos | _constdatapos
FilePos | _levelinfopos
FilePos | _leveldatapos
FilePos | _metadatapos
FilePos | _lmdheaderpos
FilePos | _lmddatapos
FilePos | _editdatapos
int | _pixelsize
uint8_t * | _constdata
MetaData * | _metadata
bool | _hasEdits
std::vector< FaceInfo > | _faceinfo
std::vector< uint32_t > | _rfaceids
std::vector< LevelInfo > | _levelinfo
std::vector< FilePos > | _levelpos
std::vector< Level * > | _levels
std::vector< MetaEdit > | _metaedits
std::vector< FaceEdit > | _faceedits
ReductionMap | _reductions
std::vector< char > | _errorPixel
z_stream_s | _zstream
size_t | _baseMemUsed
volatile size_t | _memUsed
volatile size_t | _opens
volatile size_t | _blockReads

## Additional Inherited Members
Static Public Member Functions inherited from PtexTexture
static PtexTexture * | open (const char *path, Ptex::String &error, bool premultiply=0)
| Open a ptex file for reading. More...

## Detailed Description

Definition at line 52 of file PtexReader.h.

## Member Typedef Documentation

## ◆ ReductionMap

typedef PtexHashMap<ReductionKey, FaceData*> PtexReader::ReductionMap
| protected

Definition at line 712 of file PtexReader.h.

## Constructor & Destructor Documentation

## ◆ PtexReader()

PtexReader::PtexReader | ( | bool | premultiply,
|  | PtexInputHandler * | inputHandler,
|  | PtexErrorHandler * | errorHandler
| ) |  |

Definition at line 71 of file PtexReader.cpp.

References _zstream.

## ◆ ~PtexReader()

PtexReader::~PtexReader | ( |  | ) |
| virtual

Definition at line 93 of file PtexReader.cpp.

References _constdata, _levels, _metadata, and closeFP().

## Member Function Documentation

## ◆ alphaChannel()

virtual int PtexReader::alphaChannel | ( |  | ) |
| inlinevirtual

Index of alpha channel (if any).

One channel in the file can be flagged to be the alpha channel. If no channel is acting as the alpha channel, -1 is returned. See PtexWriter for more details.

Implements PtexTexture.

Definition at line 95 of file PtexReader.h.

References _header, and Header::alphachan.

## ◆ closeFP()

void PtexReader::closeFP | ( |  | ) |
| protected

Definition at line 230 of file PtexReader.cpp.

References _fp, _io, _zstream, and PtexInputHandler::close().

Referenced by open(), purge(), tryClose(), and ~PtexReader().

## ◆ computeOffsets()

void PtexReader::computeOffsets | ( | FilePos | pos,
|  | int | noffsets,
|  | const FaceDataHeader * | fdh,
|  | FilePos * | offsets
| ) |  |
| inlineprotected

Definition at line 605 of file PtexReader.h.

References FaceDataHeader::blocksize().

Referenced by readFaceData(), and readLevel().

## ◆ dataType()

virtual Ptex::DataType PtexReader::dataType | ( |  | ) |
| inlinevirtual

Type of data stored in file.

Implements PtexTexture.

Definition at line 91 of file PtexReader.h.

References _header, and Header::datatype.

## ◆ datatype()

DataType PtexReader::datatype | ( |  | ) | const
| inline

Definition at line 113 of file PtexReader.h.

References _header, and Header::datatype.

Referenced by PtexReader::MetaData::addEntry(), PtexReader::MetaData::addLmdEntry(), getPixel(), PtexReader::MetaData::newEntry(), readConstData(), readEditFaceData(), readFaceData(), PtexReader::PackedFace::reduce(), and PtexReader::TiledFaceBase::TiledFaceBase().

## ◆ edgeFilterMode()

virtual Ptex::EdgeFilterMode PtexReader::edgeFilterMode | ( |  | ) |
| inlinevirtual

Mode for filtering textures across edges.

Implements PtexTexture.

Definition at line 94 of file PtexReader.h.

References _extheader, and ExtHeader::edgefiltermode.

## ◆ errorData()

FaceData* PtexReader::errorData | ( | bool | deleteOnRelease = `false` | ) |
| inlineprotected

Definition at line 600 of file PtexReader.h.

References _errorPixel, and _pixelsize.

Referenced by getData(), and readFaceData().

## ◆ extheader()

const ExtHeader& PtexReader::extheader | ( |  | ) | const
| inline

Definition at line 117 of file PtexReader.h.

References _extheader.

## ◆ getConstData()

uint8_t* PtexReader::getConstData | ( |  | ) |
| inlineprotected

Definition at line 579 of file PtexReader.h.

References _constdata.

Referenced by getData().

## ◆ getData() [1/4]

PtexFaceData * PtexReader::getData | ( | int | faceid | ) |
| virtual

Access texture data for a face at highest-resolution as stored on disk.

Implements PtexTexture.

Definition at line 767 of file PtexReader.cpp.

References _faceinfo, _header, _ok, _pixelsize, errorData(), getConstData(), getFace(), getLevel(), and Header::nfaces.

## ◆ getData() [2/4]

PtexFaceData * PtexReader::getData | ( | int | faceid,
|  | Res | res
| ) |  |
| virtual

Definition at line 785 of file PtexReader.cpp.

References _faceinfo, _header, _levels, _ok, _pixelsize, _reductions, _rfaceids, errorData(), PtexReader::Level::faces, PtexPtr< T >::get(), PtexHashMap< Key, Value >::get(), getConstData(), getData(), getFace(), getLevel(), increaseMemUsed(), Header::meshtype, Ptex::mt_triangle, Header::nfaces, PtexReader::FaceData::reduce(), PtexUtils::reduceTri(), PtexUtils::reduceu(), PtexUtils::reducev(), and PtexHashMap< Key, Value >::tryInsert().

## ◆ getData() [3/4]

void PtexReader::getData | ( | int | faceid,
|  | void * | buffer,
|  | int | stride
| ) |  |
| virtual

Access texture data for a face at highest-resolution.

The texture data is copied into the user-supplied buffer. The buffer must be at least this size (in bytes): DataSize(dataType()) * numChannels() * getFaceInfo(faceid).res.size().

If a stride is given, then (stride-row_length) bytes will be skipped after each row. If stride is zero, then no bytes will be skipped. Note: the image can be flipped vertically by using an appropriate negative stride value.

Parameters

  faceid | Face index [0..numFaces-1]
  buffer | User-supplied buffer
  stride | Size of each row in user buffer (in bytes)

Implements PtexTexture.

Definition at line 711 of file PtexReader.cpp.

References getFaceInfo().

Referenced by PtexMainWriter::finish(), getData(), getPixel(), PtexReader::TiledReducedFace::getTile(), and PtexReader::TiledFaceBase::reduce().

## ◆ getData() [4/4]

void PtexReader::getData | ( | int | faceid,
|  | void * | buffer,
|  | int | stride,
|  | Res | res
| ) |  |
| virtual

Definition at line 718 of file PtexReader.cpp.

References _errorPixel, _header, _ok, _pixelsize, PtexUtils::copy(), PtexUtils::fill(), getData(), and Header::nfaces.

## ◆ getFace()

FaceData* PtexReader::getFace | ( | int | levelid,
|  | Level * | level,
|  | int | faceid,
|  | Res | res
| ) |  |
| inlineprotected

Definition at line 580 of file PtexReader.h.

References PtexReader::Level::faces, and readFace().

Referenced by getData().

## ◆ getFaceInfo()

const Ptex::FaceInfo & PtexReader::getFaceInfo | ( | int | faceid | ) |
| virtual

Access resolution and adjacency information about a face.

Implements PtexTexture.

Definition at line 267 of file PtexReader.cpp.

References _faceinfo.

Referenced by PtexMainWriter::finish(), and getData().

## ◆ getInfo()

virtual Info PtexReader::getInfo | ( |  | ) |
| inlinevirtual

Implements PtexTexture.

Definition at line 77 of file PtexReader.h.

References _extheader, _header, Header::alphachan, PtexTexture::Info::alphaChannel, Header::datatype, PtexTexture::Info::dataType, ExtHeader::edgefiltermode, PtexTexture::Info::edgeFilterMode, Header::meshtype, PtexTexture::Info::meshType, Header::nchannels, Header::nfaces, PtexTexture::Info::numChannels, PtexTexture::Info::numFaces, ExtHeader::ubordermode, PtexTexture::Info::uBorderMode, ExtHeader::vbordermode, and PtexTexture::Info::vBorderMode.

## ◆ getLevel()

Level* PtexReader::getLevel | ( | int | levelid | ) |
| inlineprotected

Definition at line 572 of file PtexReader.h.

References _levels, and readLevel().

Referenced by getData().

## ◆ getMetaData()

PtexMetaData * PtexReader::getMetaData | ( |  | ) |
| virtual

Access meta data.

Implements PtexTexture.

Definition at line 335 of file PtexReader.cpp.

References _metadata, and readMetaData().

Referenced by PtexMainWriter::PtexMainWriter().

## ◆ getPixel() [1/2]

void PtexReader::getPixel | ( | int | faceid,
|  | int | u,
|  | int | v,
|  | float * | result,
|  | int | firstchan,
|  | int | nchannels
| ) |  |
| virtual

Access a single texel from the highest resolution texture .

The texel data is converted to floating point (integer types are normalized 0.0 to 1.0). A subset of the available channels may be accessed.

Parameters

  faceid | Face index [0..numFaces-1]
  u | U coordinate [0..ures-1]
  v | V coordinate [0..vres-1]
  result | Result data
  firstchan | First channel to access [0..numChannels-1]
  nchannels | Number of channels to access.

Implements PtexTexture.

Definition at line 893 of file PtexReader.cpp.

References _header, _pixelsize, ConvertToFloat(), Ptex::DataSize(), datatype(), Ptex::dt_float, getData(), PtexUtils::min(), and Header::nchannels.

## ◆ getPixel() [2/2]

void PtexReader::getPixel | ( | int | faceid,
|  | int | u,
|  | int | v,
|  | float * | result,
|  | int | firstchan,
|  | int | nchannels,
|  | Ptex::Res | res
| ) |  |
| virtual

Access a single texel for a face at a particular resolution.

The specified resolution may be lower (but not higher) than the full resolution for the face. If it is lower, then the texture data is accessed from the stored mip-maps. If the requested resolution doesn't match a stored resolution, the desired resolution will be generated from the nearest available resolution.

See previous getPixel() method for details.

Implements PtexTexture.

Definition at line 920 of file PtexReader.cpp.

References _header, _pixelsize, ConvertToFloat(), Ptex::DataSize(), datatype(), Ptex::dt_float, getData(), PtexUtils::min(), and Header::nchannels.

## ◆ hasEdits()

virtual bool PtexReader::hasEdits | ( |  | ) |
| inlinevirtual

True if the file has edit blocks.

See PtexWriter for more details.

Implements PtexTexture.

Definition at line 98 of file PtexReader.h.

References _hasEdits.

Referenced by PtexMainWriter::PtexMainWriter().

## ◆ hasMipMaps()

virtual bool PtexReader::hasMipMaps | ( |  | ) |
| inlinevirtual

True if the file has mipmaps.

See PtexWriter for more details.

Implements PtexTexture.

Definition at line 99 of file PtexReader.h.

References _header, and Header::nlevels.

## ◆ header()

const Header& PtexReader::header | ( |  | ) | const
| inline

Definition at line 116 of file PtexReader.h.

References _header.

## ◆ increaseMemUsed()

void PtexReader::increaseMemUsed | ( | size_t | amount | ) |
| inline

Definition at line 71 of file PtexReader.h.

References _memUsed, and AtomicAdd().

Referenced by getData(), PtexReader::MetaData::getEntry(), readConstData(), readEditData(), readFaceData(), readFaceInfo(), readLevel(), readLevelInfo(), and readMetaData().

## ◆ invalidate()

void PtexReader::invalidate | ( |  | ) |
| inline

Definition at line 66 of file PtexReader.h.

References _needToOpen, and _ok.

Referenced by PtexReaderCache::get().

## ◆ isOpen()

bool PtexReader::isOpen | ( |  | ) |
| inline

Definition at line 65 of file PtexReader.h.

References _fp.

## ◆ levelinfo()

const LevelInfo& PtexReader::levelinfo | ( | int | level | ) | const
| inline

Definition at line 118 of file PtexReader.h.

References _levelinfo.

## ◆ logBlockRead()

void PtexReader::logBlockRead | ( |  | ) |
| inline

Definition at line 73 of file PtexReader.h.

References _blockReads, and AtomicIncrement().

Referenced by seek().

## ◆ logOpen()

void PtexReader::logOpen | ( |  | ) |
| inline

Definition at line 72 of file PtexReader.h.

References _opens, and AtomicIncrement().

Referenced by PtexReaderCache::get(), and reopenFP().

## ◆ meshType()

virtual Ptex::MeshType PtexReader::meshType | ( |  | ) |
| inlinevirtual

Type of mesh for which texture data is defined.

Implements PtexTexture.

Definition at line 90 of file PtexReader.h.

References _header, and Header::meshtype.

## ◆ nchannels()

int PtexReader::nchannels | ( |  | ) | const
| inline

Definition at line 114 of file PtexReader.h.

References _header, and Header::nchannels.

Referenced by PtexReader::PackedFace::reduce(), and PtexReader::TiledFaceBase::TiledFaceBase().

## ◆ needToOpen()

bool PtexReader::needToOpen | ( |  | ) | const
| inline

Definition at line 57 of file PtexReader.h.

References _needToOpen.

Referenced by PtexReaderCache::get(), and open().

## ◆ numChannels()

virtual int PtexReader::numChannels | ( |  | ) |
| inlinevirtual

Number of channels stored in file.

Implements PtexTexture.

Definition at line 96 of file PtexReader.h.

References _header, and Header::nchannels.

## ◆ numFaces()

virtual int PtexReader::numFaces | ( |  | ) |
| inlinevirtual

Number of faces stored in file.

Implements PtexTexture.

Definition at line 97 of file PtexReader.h.

References _header, and Header::nfaces.

## ◆ ok()

bool PtexReader::ok | ( |  | ) | const
| inline

Definition at line 64 of file PtexReader.h.

References _ok.

Referenced by PtexReader::DefaultInputHandler::close(), and PtexReaderCache::get().

## ◆ open()

bool PtexReader::open | ( | const char * | path,
|  | Ptex::String & | error
| ) |  |

Definition at line 137 of file PtexReader.cpp.

References _baseMemUsed, _constdatapos, _editdatapos, _err, _errorPixel, _extheader, _faceinfopos, _fp, _header, _io, _leveldatapos, _levelinfopos, _lmddatapos, _lmdheaderpos, _memUsed, _metadatapos, _needToOpen, _ok, _path, _pixelsize, AtomicStore(), Ptex::String::c_str(), closeFP(), Header::constdatasize, ExtHeader::editdatapos, Header::extheadersize, ExtHeaderSize, Header::faceinfosize, HeaderSize, PtexInputHandler::lastError(), Header::leveldatasize, Header::levelinfosize, LittleEndian(), ExtHeader::lmddatasize, ExtHeader::lmdheaderzipsize, Header::magic, Magic, PtexUtils::max(), Header::metadatazipsize, PtexUtils::min(), needToOpen(), PtexInputHandler::open(), Header::pixelSize(), readBlock(), readConstData(), readEditData(), readFaceInfo(), readLevelInfo(), readlock, and Header::version.

Referenced by PtexReaderCache::get(), and PtexTexture::open().

## ◆ path()

virtual const char* PtexReader::path | ( |  | ) |
| inlinevirtual

Path that file was opened with.

If the file was opened using a search path (via PtexCache), the the path will be the path as found in the search path. Otherwise, the path will be the path as supplied to open.

Implements PtexTexture.

Definition at line 75 of file PtexReader.h.

References _path.

Referenced by PtexReader::DefaultInputHandler::open().

## ◆ pendingPurge()

bool PtexReader::pendingPurge | ( |  | ) | const
| inline

Definition at line 62 of file PtexReader.h.

References _pendingPurge.

Referenced by PtexReaderCache::get().

## ◆ pixelsize()

int PtexReader::pixelsize | ( |  | ) | const
| inline

Definition at line 115 of file PtexReader.h.

References _pixelsize.

Referenced by PtexReader::ErrorFace::ErrorFace().

## ◆ prune()

void PtexReader::prune | ( |  | ) |

Definition at line 104 of file PtexReader.cpp.

References _baseMemUsed, _levels, _memUsed, _metadata, _reductions, and PtexHashMap< Key, Value >::clear().

Referenced by purge(), and PtexCachedReader::tryPrune().

## ◆ purge()

void PtexReader::purge | ( |  | ) |

Definition at line 115 of file PtexReader.cpp.

References _baseMemUsed, _constdata, _faceedits, _faceinfo, _levelinfo, _levelpos, _levels, _memUsed, _metaedits, _needToOpen, _ok, _pendingPurge, _rfaceids, closeFP(), and prune().

Referenced by PtexCachedReader::tryPurge().

## ◆ readBlock()

bool PtexReader::readBlock | ( | void * | data,
|  | int | size,
|  | bool | reportError = `true`
| ) |  |
| protected

Definition at line 548 of file PtexReader.cpp.

References _fp, _io, _pos, PtexInputHandler::read(), and setError().

Referenced by open(), readEditData(), readEditFaceData(), readEditMetaData(), readFaceData(), readLevelInfo(), readZipBlock(), and reopenFP().

## ◆ readConstData()

void PtexReader::readConstData | ( |  | ) |
| protected

Definition at line 319 of file PtexReader.cpp.

References _constdata, _constdatapos, _header, _pixelsize, _premultiply, Header::alphachan, Header::constdatasize, datatype(), Header::hasAlpha(), increaseMemUsed(), PtexUtils::multalpha(), Header::nchannels, Header::nfaces, readZipBlock(), and seek().

Referenced by open().

## ◆ readEditData()

void PtexReader::readEditData | ( |  | ) |
| protected

Definition at line 468 of file PtexReader.cpp.

References _editdatapos, _extheader, _faceedits, _hasEdits, _metaedits, ExtHeader::editdatapos, ExtHeader::editdatasize, et_editfacedata, et_editmetadata, increaseMemUsed(), readBlock(), readEditFaceData(), readEditMetaData(), seek(), and tell().

Referenced by open().

## ◆ readEditFaceData()

void PtexReader::readEditFaceData | ( |  | ) |
| protected

Definition at line 502 of file PtexReader.cpp.

References _constdata, _faceedits, _faceinfo, _header, _pixelsize, _premultiply, Header::alphachan, datatype(), EditFaceDataHeaderSize, EditFaceDataHeader::faceid, PtexReader::FaceEdit::faceid, EditFaceDataHeader::faceinfo, EditFaceDataHeader::fdh, PtexReader::FaceEdit::fdh, Header::hasAlpha(), PtexUtils::multalpha(), Header::nchannels, Header::nfaces, PtexReader::FaceEdit::pos, readBlock(), and tell().

Referenced by readEditData().

## ◆ readEditMetaData()

void PtexReader::readEditMetaData | ( |  | ) |
| protected

Definition at line 533 of file PtexReader.cpp.

References _metaedits, EditMetaDataHeaderSize, PtexReader::MetaEdit::memsize, EditMetaDataHeader::metadatamemsize, EditMetaDataHeader::metadatazipsize, PtexReader::MetaEdit::pos, readBlock(), tell(), and PtexReader::MetaEdit::zipsize.

Referenced by readEditData().

## ◆ readFace()

void PtexReader::readFace | ( | int | levelid,
|  | Level * | level,
|  | int | faceid,
|  | Res | res
| ) |  |
| protected

Definition at line 627 of file PtexReader.cpp.

References PtexReader::Level::faces, PtexReader::Level::fdh, PtexReader::Level::offsets, and readFaceData().

Referenced by getFace().

## ◆ readFaceData()

void PtexReader::readFaceData | ( | FilePos | pos,
|  | FaceDataHeader | fdh,
|  | Res | res,
|  | int | levelid,
|  | FaceData *& | face
| ) |  |
| protected

Definition at line 641 of file PtexReader.cpp.

References PtexReader::TiledFace::_fdh, _header, PtexReader::TiledFaceBase::_ntiles, PtexReader::TiledFace::_offsets, _pixelsize, _premultiply, AllocaMax, Header::alphachan, AtomicStore(), FaceDataHeader::blocksize(), computeOffsets(), PtexReader::PackedFace::data(), Ptex::DataSize(), datatype(), PtexUtils::decodeDifference(), enc_constant, enc_diffzipped, enc_tiled, enc_zipped, FaceDataHeader::encoding(), errorData(), FaceDataHeaderSize, Header::hasAlpha(), increaseMemUsed(), PtexUtils::interleave(), PtexReader::TiledFace::memUsed(), PtexUtils::multalpha(), Header::nchannels, readBlock(), readlock, readZipBlock(), seek(), and tell().

Referenced by readFace().

## ◆ readFaceInfo()

void PtexReader::readFaceInfo | ( |  | ) |
| protected

Definition at line 277 of file PtexReader.cpp.

References _faceinfo, _faceinfopos, _header, _rfaceids, Header::faceinfosize, PtexUtils::genRfaceids(), increaseMemUsed(), Header::nfaces, readZipBlock(), and seek().

Referenced by open().

## ◆ readLargeMetaDataHeaders()

void PtexReader::readLargeMetaDataHeaders | ( | MetaData * | metadata,
|  | FilePos | pos,
|  | int | zipsize,
|  | int | memsize,
|  | size_t & | metaDataMemUsed
| ) |  |
| protected

Definition at line 440 of file PtexReader.cpp.

References PtexReader::MetaData::addLmdEntry(), AllocaMax, readZipBlock(), and seek().

Referenced by readMetaData().

## ◆ readLevel()

void PtexReader::readLevel | ( | int | levelid,
|  | Level *& | level
| ) |  |
| protected

Definition at line 595 of file PtexReader.cpp.

References _faceedits, _levelinfo, _levelpos, AtomicStore(), computeOffsets(), FaceDataHeaderSize, PtexReader::FaceEdit::faceid, PtexReader::Level::fdh, PtexReader::FaceEdit::fdh, increaseMemUsed(), LevelInfo::levelheadersize, PtexReader::Level::memUsed(), LevelInfo::nfaces, PtexReader::Level::offsets, PtexReader::FaceEdit::pos, readlock, readZipBlock(), seek(), and tell().

Referenced by getLevel().

## ◆ readLevelInfo()

void PtexReader::readLevelInfo | ( |  | ) |
| protected

Definition at line 298 of file PtexReader.cpp.

References _header, _leveldatapos, _levelinfo, _levelinfopos, _levelpos, _levels, increaseMemUsed(), LevelInfoSize, Header::nlevels, readBlock(), and seek().

Referenced by open().

## ◆ readMetaData()

void PtexReader::readMetaData | ( |  | ) |
| protected

Definition at line 381 of file PtexReader.cpp.

References _extheader, _header, _lmdheaderpos, _metadata, _metadatapos, _metaedits, AtomicStore(), increaseMemUsed(), ExtHeader::lmdheadermemsize, ExtHeader::lmdheaderzipsize, Header::metadatamemsize, Header::metadatazipsize, readLargeMetaDataHeaders(), readlock, readMetaDataBlock(), and PtexReader::MetaData::selfDataSize().

Referenced by getMetaData().

## ◆ readMetaDataBlock()

void PtexReader::readMetaDataBlock | ( | MetaData * | metadata,
|  | FilePos | pos,
|  | int | zipsize,
|  | int | memsize,
|  | size_t & | metaDataMemUsed
| ) |  |
| protected

Definition at line 414 of file PtexReader.cpp.

References PtexReader::MetaData::addEntry(), AllocaMax, readZipBlock(), and seek().

Referenced by readMetaData().

## ◆ readZipBlock()

bool PtexReader::readZipBlock | ( | void * | data,
|  | int | zipsize,
|  | int | unzipsize
| ) |  |
| protected

Definition at line 563 of file PtexReader.cpp.

References _zstream, BlockSize, readBlock(), and setError().

Referenced by PtexReader::MetaData::getEntry(), readConstData(), readFaceData(), readFaceInfo(), readLargeMetaDataHeaders(), readLevel(), and readMetaDataBlock().

## ◆ release()

virtual void PtexReader::release | ( |  | ) |
| inlinevirtual

Release resources held by this pointer (pointer becomes invalid).

Implements PtexTexture.

Reimplemented in PtexCachedReader.

Definition at line 56 of file PtexReader.h.

Referenced by PtexMainWriter::close(), PtexTexture::open(), PtexReader::TiledFaceBase::reduce(), and PtexMainWriter::~PtexMainWriter().

## ◆ reopenFP()

bool PtexReader::reopenFP | ( |  | ) |
| protected

Definition at line 240 of file PtexReader.cpp.

References _extheader, _fp, _header, _io, _path, _pos, Header::extheadersize, ExtHeaderSize, HeaderSize, logOpen(), PtexUtils::min(), PtexInputHandler::open(), readBlock(), and setError().

Referenced by seek().

## ◆ seek()

void PtexReader::seek | ( | FilePos | pos | ) |
| inlineprotected

Definition at line 558 of file PtexReader.h.

References _fp, _io, _pos, logBlockRead(), reopenFP(), and PtexInputHandler::seek().

Referenced by PtexReader::MetaData::getEntry(), readConstData(), readEditData(), readFaceData(), readFaceInfo(), readLargeMetaDataHeaders(), readLevel(), readLevelInfo(), and readMetaDataBlock().

## ◆ setError()

void PtexReader::setError | ( | const char * | error | ) |
| inlineprotected

Definition at line 546 of file PtexReader.h.

References _err, _ok, _path, and PtexErrorHandler::reportError().

Referenced by readBlock(), readZipBlock(), and reopenFP().

## ◆ setPendingPurge()

void PtexReader::setPendingPurge | ( |  | ) |
| inline

Definition at line 61 of file PtexReader.h.

References _pendingPurge.

Referenced by PtexCachedReader::tryPurge().

## ◆ tell()

FilePos PtexReader::tell | ( |  | ) |
| inlineprotected

Definition at line 557 of file PtexReader.h.

References _pos.

Referenced by readEditData(), readEditFaceData(), readEditMetaData(), readFaceData(), and readLevel().

## ◆ tryClose()

bool PtexReader::tryClose | ( |  | ) |

Definition at line 219 of file PtexReader.cpp.

References _fp, closeFP(), readlock, Mutex::trylock(), and Mutex::unlock().

Referenced by PtexReaderCache::pruneFiles().

## ◆ uBorderMode()

virtual Ptex::BorderMode PtexReader::uBorderMode | ( |  | ) |
| inlinevirtual

Mode for filtering texture access beyond mesh border.

Implements PtexTexture.

Definition at line 92 of file PtexReader.h.

References _extheader, and ExtHeader::ubordermode.

## ◆ vBorderMode()

virtual Ptex::BorderMode PtexReader::vBorderMode | ( |  | ) |
| inlinevirtual

Mode for filtering texture access beyond mesh border.

Implements PtexTexture.

Definition at line 93 of file PtexReader.h.

References _extheader, and ExtHeader::vbordermode.

## Member Data Documentation

## ◆ _baseMemUsed

size_t PtexReader::_baseMemUsed
| protected

Definition at line 717 of file PtexReader.h.

Referenced by open(), prune(), and purge().

## ◆ _blockReads

volatile size_t PtexReader::_blockReads
| protected

Definition at line 720 of file PtexReader.h.

Referenced by PtexCachedReader::getBlockReadsChange(), and logBlockRead().

## ◆ _constdata

uint8_t* PtexReader::_constdata
| protected

Definition at line 659 of file PtexReader.h.

Referenced by getConstData(), purge(), readConstData(), readEditFaceData(), and ~PtexReader().

## ◆ _constdatapos

FilePos PtexReader::_constdatapos
| protected

Definition at line 651 of file PtexReader.h.

Referenced by open(), and readConstData().

## ◆ _defaultIo

DefaultInputHandler PtexReader::_defaultIo
| protected

Definition at line 638 of file PtexReader.h.

## ◆ _editdatapos

FilePos PtexReader::_editdatapos
| protected

Definition at line 657 of file PtexReader.h.

Referenced by open(), and readEditData().

## ◆ _err

PtexErrorHandler* PtexReader::_err
| protected

Definition at line 640 of file PtexReader.h.

Referenced by open(), and setError().

## ◆ _errorPixel

std::vector<char> PtexReader::_errorPixel
| protected

Definition at line 714 of file PtexReader.h.

Referenced by errorData(), getData(), and open().

## ◆ _extheader

ExtHeader PtexReader::_extheader
| protected

Definition at line 649 of file PtexReader.h.

Referenced by edgeFilterMode(), extheader(), getInfo(), open(), readEditData(), readMetaData(), reopenFP(), uBorderMode(), and vBorderMode().

## ◆ _faceedits

std::vector<FaceEdit> PtexReader::_faceedits
| protected

Definition at line 683 of file PtexReader.h.

Referenced by purge(), readEditData(), readEditFaceData(), and readLevel().

## ◆ _faceinfo

std::vector<FaceInfo> PtexReader::_faceinfo
| protected

Definition at line 663 of file PtexReader.h.

Referenced by getData(), getFaceInfo(), purge(), readEditFaceData(), and readFaceInfo().

## ◆ _faceinfopos

FilePos PtexReader::_faceinfopos
| protected

Definition at line 650 of file PtexReader.h.

Referenced by open(), and readFaceInfo().

## ◆ _fp

PtexInputHandler::Handle PtexReader::_fp
| protected

Definition at line 645 of file PtexReader.h.

Referenced by closeFP(), isOpen(), open(), readBlock(), reopenFP(), seek(), and tryClose().

## ◆ _hasEdits

bool PtexReader::_hasEdits
| protected

Definition at line 661 of file PtexReader.h.

Referenced by hasEdits(), and readEditData().

## ◆ _header

Header PtexReader::_header
| protected

Definition at line 648 of file PtexReader.h.

Referenced by alphaChannel(), dataType(), datatype(), getData(), getInfo(), getPixel(), hasMipMaps(), header(), meshType(), nchannels(), numChannels(), numFaces(), open(), readConstData(), readEditFaceData(), readFaceData(), readFaceInfo(), readLevelInfo(), readMetaData(), PtexReader::TiledFaceBase::reduce(), and reopenFP().

## ◆ _io

PtexInputHandler* PtexReader::_io
| protected

Definition at line 639 of file PtexReader.h.

Referenced by closeFP(), open(), readBlock(), reopenFP(), and seek().

## ◆ _leveldatapos

FilePos PtexReader::_leveldatapos
| protected

Definition at line 653 of file PtexReader.h.

Referenced by open(), and readLevelInfo().

## ◆ _levelinfo

std::vector<LevelInfo> PtexReader::_levelinfo
| protected

Definition at line 665 of file PtexReader.h.

Referenced by levelinfo(), purge(), readLevel(), and readLevelInfo().

## ◆ _levelinfopos

FilePos PtexReader::_levelinfopos
| protected

Definition at line 652 of file PtexReader.h.

Referenced by open(), and readLevelInfo().

## ◆ _levelpos

std::vector<FilePos> PtexReader::_levelpos
| protected

Definition at line 666 of file PtexReader.h.

Referenced by purge(), readLevel(), and readLevelInfo().

## ◆ _levels

std::vector<Level*> PtexReader::_levels
| protected

Definition at line 667 of file PtexReader.h.

Referenced by getData(), getLevel(), prune(), purge(), readLevelInfo(), and ~PtexReader().

## ◆ _lmddatapos

FilePos PtexReader::_lmddatapos
| protected

Definition at line 656 of file PtexReader.h.

Referenced by open().

## ◆ _lmdheaderpos

FilePos PtexReader::_lmdheaderpos
| protected

Definition at line 655 of file PtexReader.h.

Referenced by open(), and readMetaData().

## ◆ _memUsed

volatile size_t PtexReader::_memUsed
| protected

Definition at line 718 of file PtexReader.h.

Referenced by PtexCachedReader::getMemUsedChange(), increaseMemUsed(), open(), prune(), and purge().

## ◆ _metadata

MetaData* PtexReader::_metadata
| protected

Definition at line 660 of file PtexReader.h.

Referenced by getMetaData(), prune(), readMetaData(), and ~PtexReader().

## ◆ _metadatapos

FilePos PtexReader::_metadatapos
| protected

Definition at line 654 of file PtexReader.h.

Referenced by open(), and readMetaData().

## ◆ _metaedits

std::vector<MetaEdit> PtexReader::_metaedits
| protected

Definition at line 675 of file PtexReader.h.

Referenced by purge(), readEditData(), readEditMetaData(), and readMetaData().

## ◆ _needToOpen

bool PtexReader::_needToOpen
| protected

Definition at line 643 of file PtexReader.h.

Referenced by invalidate(), needToOpen(), open(), and purge().

## ◆ _ok

bool PtexReader::_ok
| protected

Definition at line 642 of file PtexReader.h.

Referenced by getData(), invalidate(), ok(), open(), purge(), and setError().

## ◆ _opens

volatile size_t PtexReader::_opens
| protected

Definition at line 719 of file PtexReader.h.

Referenced by PtexCachedReader::getOpensChange(), and logOpen().

## ◆ _path

std::string PtexReader::_path
| protected

Definition at line 647 of file PtexReader.h.

Referenced by open(), path(), reopenFP(), and setError().

## ◆ _pendingPurge

bool PtexReader::_pendingPurge
| protected

Definition at line 644 of file PtexReader.h.

Referenced by pendingPurge(), purge(), and setPendingPurge().

## ◆ _pixelsize

int PtexReader::_pixelsize
| protected

Definition at line 658 of file PtexReader.h.

Referenced by errorData(), getData(), getPixel(), PtexReader::TiledReducedFace::getTile(), open(), pixelsize(), readConstData(), readEditFaceData(), readFaceData(), PtexReader::PackedFace::reduce(), PtexReader::ConstantFace::reduce(), and PtexReader::TiledFaceBase::reduce().

## ◆ _pos

FilePos PtexReader::_pos
| protected

Definition at line 646 of file PtexReader.h.

Referenced by readBlock(), reopenFP(), seek(), and tell().

## ◆ _premultiply

bool PtexReader::_premultiply
| protected

Definition at line 641 of file PtexReader.h.

Referenced by readConstData(), readEditFaceData(), and readFaceData().

## ◆ _reductions

ReductionMap PtexReader::_reductions
| protected

Definition at line 713 of file PtexReader.h.

Referenced by getData(), and prune().

## ◆ _rfaceids

std::vector<uint32_t> PtexReader::_rfaceids
| protected

Definition at line 664 of file PtexReader.h.

Referenced by getData(), purge(), and readFaceInfo().

## ◆ _zstream

z_stream_s PtexReader::_zstream
| protected

Definition at line 716 of file PtexReader.h.

Referenced by closeFP(), PtexReader(), and readZipBlock().

## ◆ readlock

Mutex PtexReader::readlock
| protected

Definition at line 637 of file PtexReader.h.

Referenced by PtexReader::MetaData::getEntry(), open(), readFaceData(), readLevel(), readMetaData(), and tryClose().

The documentation for this class was generated from the following files:

- PtexReader.h
- PtexReader.cpp