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 | MetaData
class | ConstDataPtr
class | FaceData
class | PackedFace
class | ConstantFace
class | ErrorFace
class | TiledFaceBase
class | TiledFace
class | TiledReducedFace
class | Level
class | DefaultInputHandler
class | ReductionKey

## Public Member Functions
| PtexReader (bool premultiply, PtexInputHandler *inputHandler, PtexErrorHandler *errorHandler)
virtual | ~PtexReader ()
virtual void | release ()
| Release resources held by this pointer (pointer becomes invalid).
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.
virtual Info | getInfo ()
virtual Ptex::MeshType | meshType ()
| Type of mesh for which texture data is defined.
virtual Ptex::DataType | dataType ()
| Type of data stored in file.
virtual Ptex::BorderMode | uBorderMode ()
| Mode for filtering texture access beyond mesh border.
virtual Ptex::BorderMode | vBorderMode ()
| Mode for filtering texture access beyond mesh border.
virtual Ptex::EdgeFilterMode | edgeFilterMode ()
| Mode for filtering textures across edges.
virtual int | alphaChannel ()
| Index of alpha channel (if any).
virtual int | numChannels ()
| Number of channels stored in file.
virtual int | numFaces ()
| Number of faces stored in file.
virtual bool | hasEdits ()
| Obsolete (returns false).
virtual bool | hasMipMaps ()
| True if the file has mipmaps.
virtual PtexMetaData * | getMetaData ()
| Access meta data.
virtual const Ptex::FaceInfo & | getFaceInfo (int faceid)
| Access resolution and adjacency information about a face.
virtual void | getData (int faceid, void *buffer, int stride)
| Access texture data for a face at highest-resolution.
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.
virtual PtexFaceData * | getData (int faceid, Res res)
virtual void * | getConstantData (int faceid) final
| Access the constant (or average) data value for a given face.
virtual void | getPixel (int faceid, int u, int v, float *result, int firstchan, int nchannels)
| Access a single texel from the highest resolution texture .
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.
void | getCompressedData (int faceid, int level, FaceDataHeader &fdh, std::vector< std::byte > &data)
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.
virtual PtexFaceData * | getData (int faceid, Ptex::Res res)=0
| Access texture data for a face at a specific resolution as stored on disk.

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

## Protected Member Functions
void | setError (const char *error, bool ioError=false)
void | setIOError (const char *error)
FilePos | tell ()
void | seek (FilePos pos)
void | closeFP ()
bool | reopenFP ()
bool | readBlock (void *data, int size)
bool | readZipBlock (void *data, int zipsize, int unzipsize)
Level * | getLevel (int levelid)
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)
FaceData * | errorData (bool deleteOnRelease=false)
void | computeFaceTileOffsets (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.

## 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
int | _pixelsize
uint8_t * | _constdata
MetaData * | _metadata
std::vector< FaceInfo > | _faceinfo
std::vector< uint32_t > | _rfaceids
std::vector< LevelInfo > | _levelinfo
std::vector< FilePos > | _levelpos
std::vector< Level * > | _levels
ReductionMap | _reductions
std::vector< char > | _errorPixel
libdeflate_decompressor * | _decompressor
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.

## Detailed Description

Definition at line 53 of file PtexReader.h.

## Member Typedef Documentation

## ◆ ReductionMap

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

Definition at line 702 of file PtexReader.h.

## Constructor & Destructor Documentation

## ◆ PtexReader()

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

Definition at line 74 of file PtexReader.cpp.

References _baseMemUsed, _blockReads, _constdata, _decompressor, _defaultIo, _err, _fp, _io, _memUsed, _metadata, _needToOpen, _ok, _opens, _pendingPurge, _pixelsize, _pos, and _premultiply.

Referenced by PtexReader::MetaData::MetaData(), PtexTexture::open(), PtexCachedReader::PtexCachedReader(), PtexReader::ConstantFace::reduce(), PtexReader::FaceData::reduce(), PtexReader::PackedFace::reduce(), PtexReader::TiledFaceBase::reduce(), PtexReader::TiledFaceBase::TiledFaceBase(), and PtexReader::TiledReducedFace::TiledReducedFace().

## ◆ ~PtexReader()

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

Definition at line 95 of file PtexReader.cpp.

References _constdata, _decompressor, _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 96 of file PtexReader.h.

References _header, and Header::alphachan.

## ◆ closeFP()

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

Definition at line 272 of file PtexReader.cpp.

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

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

## ◆ computeFaceTileOffsets()

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

Definition at line 613 of file PtexReader.h.

References FaceDataHeader::blocksize().

Referenced by readFaceData().

## ◆ dataType()

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

Type of data stored in file.

Implements PtexTexture.

Definition at line 92 of file PtexReader.h.

References _header, and Header::datatype.

## ◆ datatype()

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

Definition at line 116 of file PtexReader.h.

References _header, and Header::datatype.

Referenced by PtexReader::MetaData::addEntry(), PtexReader::MetaData::addLmdEntry(), getPixel(), getPixel(), PtexReader::MetaData::newEntry(), readConstData(), 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 95 of file PtexReader.h.

References _extheader, and ExtHeader::edgefiltermode.

## ◆ errorData()

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

Definition at line 608 of file PtexReader.h.

References _errorPixel, _pixelsize, and PtexReader::ErrorFace::ErrorFace().

Referenced by getData(), getData(), and readFaceData().

## ◆ extheader()

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

Definition at line 120 of file PtexReader.h.

References _extheader.

## ◆ getCompressedData()

void PtexReader::getCompressedData | ( | int | faceid,
|  | int | level,
|  | FaceDataHeader & | fdh,
|  | std::vector< std::byte > & | data )

Definition at line 940 of file PtexReader.cpp.

References _faceinfo, _header, _levels, _ok, _rfaceids, FaceDataHeader::blocksize(), enc_tiled, FaceDataHeader::encoding(), FaceDataHeaderSize, PtexReader::Level::fdh, getLevel(), FaceDataHeader::isLargeFace(), Header::nfaces, PtexReader::Level::offsets, readBlock(), readZipBlock(), and seek().

Referenced by PtexMainWriter::finish().

## ◆ getConstantData()

virtual void * PtexReader::getConstantData | ( | int | faceid | ) |
| inlinefinalvirtual

Access the constant (or average) data value for a given face.

The returned value is a pointer to the stored data and must be cast to the appropriate type.

Implements PtexTexture.

Definition at line 108 of file PtexReader.h.

References _constdata, and _pixelsize.

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

## ◆ 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 747 of file PtexReader.cpp.

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

## ◆ getData() [2/4]

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

Definition at line 765 of file PtexReader.cpp.

References _faceinfo, _header, _levels, _ok, _pixelsize, _reductions, _rfaceids, PtexReader::ConstDataPtr::ConstDataPtr(), errorData(), PtexReader::Level::faces, PtexHashMap< Key, Value >::get(), PtexPtr< T >::get(), getConstantData(), getData(), getFace(), getLevel(), increaseMemUsed(), Header::meshtype, 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 691 of file PtexReader.cpp.

References getData(), and getFaceInfo().

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

## ◆ getData() [4/4]

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

Definition at line 698 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 591 of file PtexReader.h.

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

Referenced by getData(), and getData().

## ◆ getFaceInfo()

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

Access resolution and adjacency information about a face.

Implements PtexTexture.

Definition at line 308 of file PtexReader.cpp.

References _faceinfo.

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

## ◆ getInfo()

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

Implements PtexTexture.

Definition at line 78 of file PtexReader.h.

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

## ◆ getLevel()

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

Definition at line 584 of file PtexReader.h.

References _levels, and readLevel().

Referenced by getCompressedData(), getData(), and getData().

## ◆ getMetaData()

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

Access meta data.

Implements PtexTexture.

Definition at line 385 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 873 of file PtexReader.cpp.

References _faceinfo, _header, _pixelsize, ConvertToFloat(), datatype(), getConstantData(), getData(), Header::nchannels, and Header::nfaces.

## ◆ 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 906 of file PtexReader.cpp.

References _faceinfo, _header, _pixelsize, ConvertToFloat(), datatype(), getConstantData(), getData(), Header::nchannels, and Header::nfaces.

## ◆ hasEdits()

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

Obsolete (returns false).

Implements PtexTexture.

Definition at line 99 of file PtexReader.h.

## ◆ hasMipMaps()

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

True if the file has mipmaps.

See PtexWriter for more details.

Implements PtexTexture.

Definition at line 100 of file PtexReader.h.

References _header, and Header::nlevels.

Referenced by PtexMainWriter::finish().

## ◆ header()

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

Definition at line 119 of file PtexReader.h.

References _header.

## ◆ increaseMemUsed()

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

Definition at line 72 of file PtexReader.h.

References _memUsed, and AtomicAdd().

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

## ◆ invalidate()

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

Definition at line 67 of file PtexReader.h.

References _needToOpen, and _ok.

Referenced by PtexReaderCache::get().

## ◆ isOpen()

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

Definition at line 66 of file PtexReader.h.

References _fp.

## ◆ levelinfo()

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

Definition at line 121 of file PtexReader.h.

References _levelinfo.

## ◆ logBlockRead()

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

Definition at line 74 of file PtexReader.h.

References _blockReads, and AtomicIncrement().

Referenced by seek().

## ◆ logOpen()

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

Definition at line 73 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 91 of file PtexReader.h.

References _header, and Header::meshtype.

## ◆ nchannels()

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

Definition at line 117 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 58 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 97 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 98 of file PtexReader.h.

References _header, and Header::nfaces.

## ◆ ok()

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

Definition at line 65 of file PtexReader.h.

References _ok.

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

## ◆ open()

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

Definition at line 141 of file PtexReader.cpp.

References _baseMemUsed, _constdatapos, _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, Header::datatype, ExtHeaderSize, Header::extheadersize, Header::faceinfosize, HeaderSize, PtexInputHandler::lastError(), Header::leveldatasize, LevelInfoSize, Header::levelinfosize, LittleEndian(), ExtHeader::lmddatasize, ExtHeader::lmdheaderzipsize, Magic, Header::magic, Header::meshtype, Header::metadatamemsize, Header::metadatazipsize, Header::nchannels, needToOpen(), Header::nfaces, Header::nlevels, PtexInputHandler::open(), Header::pixelSize(), pixelsize(), readBlock(), readConstData(), 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 76 of file PtexReader.h.

References _path.

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

## ◆ pendingPurge()

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

Definition at line 63 of file PtexReader.h.

References _pendingPurge.

Referenced by PtexReaderCache::get().

## ◆ pixelsize()

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

Definition at line 118 of file PtexReader.h.

References _pixelsize.

Referenced by PtexReader::ConstantFace::ConstantFace(), PtexReader::ConstDataPtr::ConstDataPtr(), PtexReader::ErrorFace::ErrorFace(), open(), and PtexReader::PackedFace::PackedFace().

## ◆ prune()

void PtexReader::prune | ( |  | ) |

Definition at line 107 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 118 of file PtexReader.cpp.

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

Referenced by PtexCachedReader::tryPurge().

## ◆ readBlock()

bool PtexReader::readBlock | ( | void * | data,
|  | int | size )
| protected

Definition at line 514 of file PtexReader.cpp.

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

Referenced by getCompressedData(), open(), readFaceData(), readLevel(), readLevelInfo(), readZipBlock(), and reopenFP().

## ◆ readConstData()

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

Definition at line 364 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(), seek(), and setError().

Referenced by open().

## ◆ readFace()

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

Definition at line 607 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 621 of file PtexReader.cpp.

References PtexReader::TiledFace::_fdh, _header, PtexReader::TiledFaceBase::_ntiles, PtexReader::TiledFace::_offsets, _pixelsize, _premultiply, AllocaMax, Header::alphachan, AtomicStore(), FaceDataHeader::blocksize(), computeFaceTileOffsets(), PtexReader::ConstantFace::ConstantFace(), PtexReader::PackedFace::data(), 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, PtexReader::PackedFace::PackedFace(), readBlock(), readlock, readZipBlock(), seek(), tell(), and PtexReader::TiledFace::TiledFace().

Referenced by readFace().

## ◆ readFaceInfo()

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

Definition at line 318 of file PtexReader.cpp.

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

Referenced by open().

## ◆ readLargeMetaDataHeaders()

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

Definition at line 485 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 547 of file PtexReader.cpp.

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

Referenced by getLevel().

## ◆ readLevelInfo()

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

Definition at line 343 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 431 of file PtexReader.cpp.

References _extheader, _header, _lmdheaderpos, _metadata, _metadatapos, AtomicStore(), increaseMemUsed(), ExtHeader::lmdheadermemsize, ExtHeader::lmdheaderzipsize, PtexReader::MetaData::MetaData(), 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 459 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 528 of file PtexReader.cpp.

References _decompressor, _ok, readBlock(), and setError().

Referenced by getCompressedData(), 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 57 of file PtexReader.h.

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

## ◆ reopenFP()

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

Definition at line 281 of file PtexReader.cpp.

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

Referenced by seek().

## ◆ seek()

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

Definition at line 570 of file PtexReader.h.

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

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

## ◆ setError()

void PtexReader::setError | ( | const char * | error,
|  | bool | ioError = false )
| inlineprotected

Definition at line 549 of file PtexReader.h.

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

Referenced by readConstData(), readFaceInfo(), readZipBlock(), reopenFP(), setIOError(), and PtexCachedReader::unref().

## ◆ setIOError()

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

Definition at line 564 of file PtexReader.h.

References setError().

Referenced by readBlock(), and reopenFP().

## ◆ setPendingPurge()

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

Definition at line 62 of file PtexReader.h.

References _pendingPurge.

Referenced by PtexCachedReader::tryPurge().

## ◆ tell()

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

Definition at line 569 of file PtexReader.h.

References _pos.

Referenced by readFaceData(), and readLevel().

## ◆ tryClose()

bool PtexReader::tryClose | ( |  | ) |

Definition at line 261 of file PtexReader.cpp.

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

Referenced by PtexReaderCache::pruneFilesIfNeeded().

## ◆ uBorderMode()

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

Mode for filtering texture access beyond mesh border.

Implements PtexTexture.

Definition at line 93 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 94 of file PtexReader.h.

References _extheader, and ExtHeader::vbordermode.

## Member Data Documentation

## ◆ _baseMemUsed

size_t PtexReader::_baseMemUsed
| protected

Definition at line 707 of file PtexReader.h.

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

## ◆ _blockReads

volatile size_t PtexReader::_blockReads
| protected

Definition at line 710 of file PtexReader.h.

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

## ◆ _constdata

uint8_t* PtexReader::_constdata
| protected

Definition at line 666 of file PtexReader.h.

Referenced by getConstantData(), PtexReader(), purge(), readConstData(), and ~PtexReader().

## ◆ _constdatapos

FilePos PtexReader::_constdatapos
| protected

Definition at line 659 of file PtexReader.h.

Referenced by open(), and readConstData().

## ◆ _decompressor

libdeflate_decompressor* PtexReader::_decompressor
| protected

Definition at line 706 of file PtexReader.h.

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

## ◆ _defaultIo

DefaultInputHandler PtexReader::_defaultIo
| protected

Definition at line 646 of file PtexReader.h.

Referenced by PtexReader().

## ◆ _err

PtexErrorHandler* PtexReader::_err
| protected

Definition at line 648 of file PtexReader.h.

Referenced by open(), PtexReader(), and setError().

## ◆ _errorPixel

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

Definition at line 704 of file PtexReader.h.

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

## ◆ _extheader

ExtHeader PtexReader::_extheader
| protected

Definition at line 657 of file PtexReader.h.

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

## ◆ _faceinfo

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

Definition at line 669 of file PtexReader.h.

Referenced by getCompressedData(), getData(), getData(), getFaceInfo(), getPixel(), getPixel(), purge(), and readFaceInfo().

## ◆ _faceinfopos

FilePos PtexReader::_faceinfopos
| protected

Definition at line 658 of file PtexReader.h.

Referenced by open(), and readFaceInfo().

## ◆ _fp

PtexInputHandler::Handle PtexReader::_fp
| protected

Definition at line 653 of file PtexReader.h.

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

## ◆ _header

Header PtexReader::_header
| protected

Definition at line 656 of file PtexReader.h.

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

## ◆ _io

PtexInputHandler* PtexReader::_io
| protected

Definition at line 647 of file PtexReader.h.

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

## ◆ _leveldatapos

FilePos PtexReader::_leveldatapos
| protected

Definition at line 661 of file PtexReader.h.

Referenced by open(), and readLevelInfo().

## ◆ _levelinfo

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

Definition at line 671 of file PtexReader.h.

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

## ◆ _levelinfopos

FilePos PtexReader::_levelinfopos
| protected

Definition at line 660 of file PtexReader.h.

Referenced by open(), and readLevelInfo().

## ◆ _levelpos

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

Definition at line 672 of file PtexReader.h.

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

## ◆ _levels

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

Definition at line 673 of file PtexReader.h.

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

## ◆ _lmddatapos

FilePos PtexReader::_lmddatapos
| protected

Definition at line 664 of file PtexReader.h.

Referenced by open().

## ◆ _lmdheaderpos

FilePos PtexReader::_lmdheaderpos
| protected

Definition at line 663 of file PtexReader.h.

Referenced by open(), and readMetaData().

## ◆ _memUsed

volatile size_t PtexReader::_memUsed
| protected

Definition at line 708 of file PtexReader.h.

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

## ◆ _metadata

MetaData* PtexReader::_metadata
| protected

Definition at line 667 of file PtexReader.h.

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

## ◆ _metadatapos

FilePos PtexReader::_metadatapos
| protected

Definition at line 662 of file PtexReader.h.

Referenced by open(), and readMetaData().

## ◆ _needToOpen

bool PtexReader::_needToOpen
| protected

Definition at line 651 of file PtexReader.h.

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

## ◆ _ok

bool PtexReader::_ok
| protected

Definition at line 650 of file PtexReader.h.

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

## ◆ _opens

volatile size_t PtexReader::_opens
| protected

Definition at line 709 of file PtexReader.h.

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

## ◆ _path

std::string PtexReader::_path
| protected

Definition at line 655 of file PtexReader.h.

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

## ◆ _pendingPurge

bool PtexReader::_pendingPurge
| protected

Definition at line 652 of file PtexReader.h.

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

## ◆ _pixelsize

int PtexReader::_pixelsize
| protected

Definition at line 665 of file PtexReader.h.

Referenced by errorData(), getConstantData(), getData(), getData(), getData(), getPixel(), getPixel(), open(), pixelsize(), PtexReader(), readConstData(), and readFaceData().

## ◆ _pos

FilePos PtexReader::_pos
| protected

Definition at line 654 of file PtexReader.h.

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

## ◆ _premultiply

bool PtexReader::_premultiply
| protected

Definition at line 649 of file PtexReader.h.

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

## ◆ _reductions

ReductionMap PtexReader::_reductions
| protected

Definition at line 703 of file PtexReader.h.

Referenced by getData(), and prune().

## ◆ _rfaceids

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

Definition at line 670 of file PtexReader.h.

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

## ◆ readlock

Mutex PtexReader::readlock
| protected

Definition at line 645 of file PtexReader.h.

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

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

- PtexReader.h
- PtexReader.cpp