Ptex: PtexReader Class Reference

Ptex

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Public Attributes | 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 | FaceData
struct | FaceEdit
class | Level
class | MetaData
struct | MetaEdit
class | PackedFace
struct | ReductionKey
class | TiledFace
class | TiledFaceBase
class | TiledReducedFace

## Public Member Functions
| PtexReader (void **parent, PtexCacheImpl *cache, bool premultiply, PtexInputHandler *handler)
bool | open (const char *path, Ptex::String &error)
void | setOwnsCache ()
virtual void | release ()
| Release resources held by this pointer (pointer becomes invalid). More...
virtual const char * | path ()
| Path that file was opened with. More...
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 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)
| Access texture data for a face at a specific resolution. More...
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)
| Access texture data for a face at a specific resolution as stored on disk. More...
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 PtexCachedFile
| PtexCachedFile (void **parent, PtexCacheImpl *cache)
void | ref ()
void | unref ()
Public Member Functions inherited from PtexLruItem
bool | inuse ()
void | orphan ()

## Public Attributes
Mutex | readlock
Mutex | reducelock

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

## Protected Member Functions
virtual | ~PtexReader ()
void | setError (const char *error)
FilePos | tell ()
void | seek (FilePos pos)
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 | getRes (int levelid, int faceid)
int | unpackedSize (FaceDataHeader fdh, int levelid, int faceid)
void | readFaceInfo ()
void | readLevelInfo ()
void | readConstData ()
void | readLevel (int levelid, Level *&level)
void | readFace (int levelid, Level *level, int faceid)
void | readFaceData (FilePos pos, FaceDataHeader fdh, Res res, int levelid, FaceData *&face)
void | readMetaData ()
void | readMetaDataBlock (MetaData *metadata, FilePos pos, int zipsize, int memsize)
void | readLargeMetaDataHeaders (MetaData *metadata, FilePos pos, int zipsize, int memsize)
void | readEditData ()
void | readEditFaceData ()
void | readEditMetaData ()
void | computeOffsets (FilePos pos, int noffsets, const FaceDataHeader *fdh, FilePos *offsets)
void | blendFaces (FaceData *&face, int faceid, Res res, bool blendu)
Protected Member Functions inherited from PtexCachedFile
virtual | ~PtexCachedFile ()
Protected Member Functions inherited from PtexLruItem
| PtexLruItem (void **parent=0)
virtual | ~PtexLruItem ()
Protected Member Functions inherited from PtexTexture
virtual | ~PtexTexture ()
| Destructor not for public use. Use release() instead. More...

## Protected Attributes
DefaultInputHandler | _defaultIo
PtexInputHandler * | _io
bool | _premultiply
bool | _ownsCache
bool | _ok
std::string | _error
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
safevector< FaceInfo > | _faceinfo
safevector< uint32_t > | _rfaceids
safevector< Res > | _res_r
safevector< LevelInfo > | _levelinfo
safevector< FilePos > | _levelpos
safevector< Level * > | _levels
safevector< MetaEdit > | _metaedits
safevector< FaceEdit > | _faceedits
ReductionMap | _reductions
z_stream_s | _zstream
Protected Attributes inherited from PtexCachedFile
PtexCacheImpl * | _cache

## Additional Inherited Members
Public Types inherited from PtexIO
enum | Encoding { enc_constant, enc_zipped, enc_diffzipped, enc_tiled }
enum | EditType { et_editfacedata, et_editmetadata }
Public Types inherited from Ptex
enum | MeshType { mt_triangle, mt_quad }
| Type of base mesh for which the textures are defined. More...
enum | DataType { dt_uint8, dt_uint16, dt_half, dt_float }
| Type of data stored in texture file. More...
enum | BorderMode { m_clamp, m_black, m_periodic }
| How to handle mesh border when filtering. More...
enum | EdgeId { e_bottom, e_right, e_top, e_left }
| Edge IDs used in adjacency data in the Ptex::FaceInfo struct. More...
enum | MetaDataType { mdt_string, mdt_int8, mdt_int16, mdt_int32, mdt_float, mdt_double }
| Type of meta data entry. More...
Static Public Member Functions inherited from PtexLruItem
template<typename T >
static void | orphanList (T &list)
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...
Static Public Member Functions inherited from PtexIO
static bool | LittleEndian ()
Static Public Member Functions inherited from Ptex
static const char * | MeshTypeName (MeshType mt)
| Look up name of given mesh type. More...
static const char * | DataTypeName (DataType dt)
| Look up name of given data type. More...
static const char * | BorderModeName (BorderMode m)
| Look up name of given border mode. More...
static const char * | EdgeIdName (EdgeId eid)
| Look up name of given edge ID. More...
static const char * | MetaDataTypeName (MetaDataType mdt)
| Look up name of given meta data type. More...
static int | DataSize (DataType dt)
| Look up size of given data type (in bytes). More...
static float | OneValue (DataType dt)
| Look up value of given data type that corresponds to the normalized value of 1.0. More...
static float | OneValueInv (DataType dt)
| Lookup up inverse value of given data type that corresponds to the normalized value of 1.0. More...
static void | ConvertToFloat (float *dst, const void *src, Ptex::DataType dt, int numChannels)
| Convert a number of data values from the given data type to float. More...
static void | ConvertFromFloat (void *dst, const float *src, Ptex::DataType dt, int numChannels)
| Convert a number of data values from float to the given data type. More...
Static Public Attributes inherited from PtexIO
static const uint32_t | Magic = 'P' | ('t'<<8) | ('e'<<16) | ('x'<<24)
static const int | HeaderSize = sizeof(Header)
static const int | ExtHeaderSize = sizeof(ExtHeader)
static const int | LevelInfoSize = sizeof(LevelInfo)
static const int | FaceDataHeaderSize = sizeof(FaceDataHeader)
static const int | EditFaceDataHeaderSize = sizeof(EditFaceDataHeader)
static const int | EditMetaDataHeaderSize = sizeof(EditMetaDataHeader)
static const int | IBuffSize = 8192
static const int | BlockSize = 16384
static const int | TileSize = 65536
static const int | AllocaMax = 16384
static const int | MetaDataThreshold = 1024

## Detailed Description

Definition at line 72 of file PtexReader.h.

## Member Typedef Documentation

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

Definition at line 635 of file PtexReader.h.

## Constructor & Destructor Documentation

PtexReader::PtexReader | ( | void ** | parent,
|  | PtexCacheImpl * | cache,
|  | bool | premultiply,
|  | PtexInputHandler * | handler
| ) |  |

Definition at line 126 of file PtexReader.cpp.

References _header, and _zstream.

PtexReader::~PtexReader | ( |  | ) |
| protectedvirtual

Definition at line 146 of file PtexReader.cpp.

References PtexCachedFile::_cache, _constdata, _fp, _io, _levels, _metadata, _ownsCache, _reductions, _zstream, PtexHashMap< KeyType, DataType, HashFn >::begin(), PtexInputHandler::close(), PtexHashMap< KeyType, DataType, HashFn >::end(), PtexHashMap< ReductionKey, FaceData *, ReductionKey::Hasher >::iterator, PtexLruItem::orphan(), PtexLruItem::orphanList(), and PtexCacheImpl::setPendingDelete().

## Member Function Documentation

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 85 of file PtexReader.h.

void PtexReader::blendFaces | ( | FaceData *& | face,
|  | int | faceid,
|  | Res | res,
|  | bool | blendu
| ) |  |
| protected

Definition at line 942 of file PtexReader.cpp.

References PtexCachedFile::_cache, _faceinfo, _pixelsize, Ptex::FaceInfo::adjedge(), Ptex::FaceInfo::adjfaces, PtexUtils::blend(), PtexCacheImpl::cachelock, datatype(), Ptex::e_bottom, Ptex::e_left, Ptex::e_right, Ptex::e_top, getData(), PtexReader::PackedFace::getData(), nchannels(), PtexCacheImpl::purgeData(), reducelock, PtexCachedData::ref(), release(), Ptex::Res::swapuv(), Ptex::Res::u(), Ptex::Res::ulog2, Ptex::Res::v(), and Ptex::Res::vlog2.

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

Definition at line 538 of file PtexReader.h.

References PtexIO::FaceDataHeader::blocksize().

Referenced by readFaceData(), and readLevel().

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

Type of data stored in file.

Implements PtexTexture.

Definition at line 82 of file PtexReader.h.

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

Definition at line 103 of file PtexReader.h.

Referenced by blendFaces(), readLargeMetaDataHeaders(), readMetaDataBlock(), and PtexReader::PackedFace::reduce().

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

Definition at line 107 of file PtexReader.h.

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

Definition at line 496 of file PtexReader.h.

Referenced by getData().

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 759 of file PtexReader.cpp.

References _faceinfo, _ok, and Ptex::FaceInfo::res.

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

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

Access texture data for a face at a specific resolution.

The specified resolution may be lower 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 getData() method for interface details.

Implements PtexTexture.

Definition at line 767 of file PtexReader.cpp.

References _ok, _pixelsize, PtexUtils::copy(), PtexUtils::fill(), getData(), PtexFaceData::getData(), PtexFaceData::getTile(), PtexFaceData::isConstant(), PtexFaceData::isTiled(), Ptex::Res::ntilesu(), Ptex::Res::ntilesv(), PtexFaceData::tileRes(), Ptex::Res::u(), and Ptex::Res::v().

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

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

Implements PtexTexture.

Definition at line 815 of file PtexReader.cpp.

References PtexCachedFile::_cache, _faceinfo, _header, _ok, _pixelsize, PtexCacheImpl::cachelock, getConstData(), getFace(), getLevel(), Ptex::FaceInfo::isConstant(), PtexIO::Header::nfaces, Ptex::FaceInfo::res, and PtexCachedData::unref().

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

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

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.

Implements PtexTexture.

Definition at line 834 of file PtexReader.cpp.

References PtexCachedFile::_cache, _faceinfo, _header, _levels, _ok, _pixelsize, _reductions, _rfaceids, PtexCacheImpl::cachelock, PtexReader::Level::faces, PtexPtr< T >::get(), getConstData(), getData(), getFace(), getLevel(), Ptex::FaceInfo::hasEdits(), Ptex::FaceInfo::isConstant(), PtexInternal::_SpinLock::lock(), PtexIO::Header::meshtype, Ptex::mt_triangle, PtexIO::Header::nfaces, PtexReader::FaceData::reduce(), PtexUtils::reduceTri(), PtexUtils::reduceu(), PtexUtils::reducev(), PtexCachedData::ref(), Ptex::FaceInfo::res, Ptex::Res::ulog2, PtexInternal::_SpinLock::unlock(), PtexCachedData::unref(), and Ptex::Res::vlog2.

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

Definition at line 497 of file PtexReader.h.

References PtexReader::Level::faces, and PtexCachedData::ref().

Referenced by getData().

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

Access resolution and adjacency information about a face.

Implements PtexTexture.

Definition at line 185 of file PtexReader.cpp.

References _faceinfo.

Referenced by PtexMainWriter::finish().

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

Definition at line 488 of file PtexReader.h.

References PtexCachedData::ref().

Referenced by getData().

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

Access meta data.

Implements PtexTexture.

Definition at line 255 of file PtexReader.cpp.

References PtexCachedFile::_cache, _metadata, PtexCacheImpl::cachelock, readMetaData(), and PtexCachedData::ref().

Referenced by PtexMainWriter::PtexMainWriter().

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 1041 of file PtexReader.cpp.

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

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 1070 of file PtexReader.cpp.

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

Res PtexReader::getRes | ( | int | levelid,
|  | int | faceid
| ) |  |
| inlineprotected

Definition at line 505 of file PtexReader.h.

References Ptex::Res::ulog2, and Ptex::Res::vlog2.

Referenced by readFace().

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

True if the file has edit blocks.

See PtexWriter for more details.

Implements PtexTexture.

Definition at line 88 of file PtexReader.h.

Referenced by PtexMainWriter::PtexMainWriter().

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

True if the file has mipmaps.

See PtexWriter for more details.

Implements PtexTexture.

Definition at line 89 of file PtexReader.h.

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

Definition at line 106 of file PtexReader.h.

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

Definition at line 108 of file PtexReader.h.

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

Type of mesh for which texture data is defined.

Implements PtexTexture.

Definition at line 81 of file PtexReader.h.

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

Definition at line 104 of file PtexReader.h.

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

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

Number of channels stored in file.

Implements PtexTexture.

Definition at line 86 of file PtexReader.h.

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

Number of faces stored in file.

Implements PtexTexture.

Definition at line 87 of file PtexReader.h.

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

Definition at line 63 of file PtexReader.cpp.

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

Referenced by PtexReaderCache::get().

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 80 of file PtexReader.h.

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

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

Definition at line 105 of file PtexReader.h.

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

Definition at line 503 of file PtexReader.cpp.

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

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

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

Definition at line 240 of file PtexReader.cpp.

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

Referenced by open().

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

Definition at line 425 of file PtexReader.cpp.

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

Referenced by open().

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

Definition at line 457 of file PtexReader.cpp.

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

Referenced by readEditData().

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

Definition at line 488 of file PtexReader.cpp.

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

Referenced by readEditData().

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

Definition at line 590 of file PtexReader.cpp.

References PtexCachedFile::_cache, PtexIO::FaceDataHeader::blocksize(), PtexIO::BlockSize, PtexCacheImpl::cachelock, PtexIO::enc_tiled, PtexIO::FaceDataHeader::encoding(), PtexReader::Level::faces, PtexReader::Level::fdh, getRes(), PtexInternal::_SpinLock::lock(), PtexReader::Level::offsets, readFaceData(), readlock, PtexCachedData::ref(), PtexInternal::_SpinLock::unlock(), unpackedSize(), and PtexCachedFile::unref().

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

Definition at line 700 of file PtexReader.cpp.

References PtexCachedFile::_cache, PtexReader::TiledFace::_fdh, _header, PtexReader::TiledFaceBase::_ntiles, PtexReader::TiledFace::_offsets, _pixelsize, _premultiply, PtexIO::AllocaMax, PtexIO::Header::alphachan, PtexIO::FaceDataHeader::blocksize(), computeOffsets(), PtexReader::PackedFace::data(), Ptex::DataSize(), PtexIO::Header::datatype, PtexUtils::decodeDifference(), PtexIO::enc_constant, PtexIO::enc_diffzipped, PtexIO::enc_tiled, PtexIO::enc_zipped, PtexIO::FaceDataHeader::encoding(), PtexIO::FaceDataHeaderSize, PtexIO::Header::hasAlpha(), PtexUtils::interleave(), PtexUtils::multalpha(), PtexIO::Header::nchannels, readBlock(), readZipBlock(), seek(), tell(), Ptex::Res::u(), unpackedSize(), and Ptex::Res::v().

Referenced by readFace().

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

Definition at line 195 of file PtexReader.cpp.

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

Referenced by open().

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

Definition at line 397 of file PtexReader.cpp.

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

Referenced by readMetaData().

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

Definition at line 545 of file PtexReader.cpp.

References PtexCachedFile::_cache, _faceedits, _levelinfo, _levelpos, PtexCacheImpl::cachelock, computeOffsets(), PtexIO::FaceDataHeaderSize, PtexReader::FaceEdit::faceid, PtexReader::Level::fdh, PtexReader::FaceEdit::fdh, PtexIO::LevelInfo::levelheadersize, PtexInternal::_SpinLock::lock(), PtexIO::LevelInfo::nfaces, PtexReader::Level::offsets, PtexReader::FaceEdit::pos, PtexCacheImpl::purgeData(), readlock, readZipBlock(), PtexCachedData::ref(), seek(), tell(), and PtexInternal::_SpinLock::unlock().

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

Definition at line 220 of file PtexReader.cpp.

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

Referenced by open().

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

Definition at line 320 of file PtexReader.cpp.

References PtexCachedFile::_cache, _extheader, _header, _lmdheaderpos, _metadata, _metadatapos, _metaedits, PtexCacheImpl::cachelock, PtexIO::ExtHeader::lmdheadermemsize, PtexIO::ExtHeader::lmdheaderzipsize, PtexInternal::_SpinLock::lock(), PtexIO::Header::metadatamemsize, PtexIO::Header::metadatazipsize, PtexCacheImpl::purgeData(), readLargeMetaDataHeaders(), readlock, readMetaDataBlock(), PtexCachedData::ref(), and PtexInternal::_SpinLock::unlock().

Referenced by getMetaData().

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

Definition at line 371 of file PtexReader.cpp.

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

Referenced by readMetaData().

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

Definition at line 518 of file PtexReader.cpp.

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

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

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

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

Implements PtexTexture.

Definition at line 170 of file PtexReader.cpp.

References PtexCachedFile::_cache, PtexCacheImpl::cachelock, PtexCacheImpl::handlePendingDelete(), and PtexCachedFile::unref().

Referenced by blendFaces(), PtexMainWriter::close(), PtexReader::TiledReducedFace::getTile(), PtexReader::TiledFaceBase::reduce(), and PtexMainWriter::~PtexMainWriter().

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

Definition at line 477 of file PtexReader.h.

References STATS_INC.

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

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

Definition at line 470 of file PtexReader.h.

Referenced by readBlock(), and readZipBlock().

void PtexReader::setOwnsCache | ( |  | ) |
| inline

Definition at line 78 of file PtexReader.h.

Referenced by PtexTexture::open().

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

Definition at line 476 of file PtexReader.h.

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

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

Mode for filtering texture access beyond mesh border.

Implements PtexTexture.

Definition at line 83 of file PtexReader.h.

int PtexReader::unpackedSize | ( | FaceDataHeader | fdh,
|  | int | levelid,
|  | int | faceid
| ) |  |
| inlineprotected

Definition at line 516 of file PtexReader.h.

References PtexIO::FaceDataHeader::encoding().

Referenced by readFace(), and readFaceData().

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

Mode for filtering texture access beyond mesh border.

Implements PtexTexture.

Definition at line 84 of file PtexReader.h.

## Member Data Documentation

uint8_t* PtexReader::_constdata
| protected

Definition at line 591 of file PtexReader.h.

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

FilePos PtexReader::_constdatapos
| protected

Definition at line 583 of file PtexReader.h.

Referenced by open(), and readConstData().

DefaultInputHandler PtexReader::_defaultIo
| protected

Definition at line 571 of file PtexReader.h.

FilePos PtexReader::_editdatapos
| protected

Definition at line 589 of file PtexReader.h.

Referenced by open(), and readEditData().

std::string PtexReader::_error
| protected

Definition at line 576 of file PtexReader.h.

Referenced by open().

ExtHeader PtexReader::_extheader
| protected

Definition at line 581 of file PtexReader.h.

Referenced by open(), readEditData(), and readMetaData().

safevector<FaceEdit> PtexReader::_faceedits
| protected

Definition at line 616 of file PtexReader.h.

Referenced by readEditFaceData(), and readLevel().

safevector<FaceInfo> PtexReader::_faceinfo
| protected

Definition at line 595 of file PtexReader.h.

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

FilePos PtexReader::_faceinfopos
| protected

Definition at line 582 of file PtexReader.h.

Referenced by open(), and readFaceInfo().

PtexInputHandler::Handle PtexReader::_fp
| protected

Definition at line 577 of file PtexReader.h.

Referenced by open(), readBlock(), and ~PtexReader().

bool PtexReader::_hasEdits
| protected

Definition at line 593 of file PtexReader.h.

Referenced by readEditData().

Header PtexReader::_header
| protected

Definition at line 580 of file PtexReader.h.

Referenced by getData(), getPixel(), open(), PtexReader(), readConstData(), readEditFaceData(), readFaceData(), readFaceInfo(), readLevelInfo(), readMetaData(), and PtexReader::TiledFaceBase::reduce().

PtexInputHandler* PtexReader::_io
| protected

Definition at line 572 of file PtexReader.h.

Referenced by open(), readBlock(), and ~PtexReader().

FilePos PtexReader::_leveldatapos
| protected

Definition at line 585 of file PtexReader.h.

Referenced by open(), and readLevelInfo().

safevector<LevelInfo> PtexReader::_levelinfo
| protected

Definition at line 598 of file PtexReader.h.

Referenced by readLevel(), and readLevelInfo().

FilePos PtexReader::_levelinfopos
| protected

Definition at line 584 of file PtexReader.h.

Referenced by open(), and readLevelInfo().

safevector<FilePos> PtexReader::_levelpos
| protected

Definition at line 599 of file PtexReader.h.

Referenced by readLevel(), and readLevelInfo().

safevector<Level*> PtexReader::_levels
| protected

Definition at line 600 of file PtexReader.h.

Referenced by getData(), readLevelInfo(), and ~PtexReader().

FilePos PtexReader::_lmddatapos
| protected

Definition at line 588 of file PtexReader.h.

Referenced by open().

FilePos PtexReader::_lmdheaderpos
| protected

Definition at line 587 of file PtexReader.h.

Referenced by open(), and readMetaData().

MetaData* PtexReader::_metadata
| protected

Definition at line 592 of file PtexReader.h.

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

FilePos PtexReader::_metadatapos
| protected

Definition at line 586 of file PtexReader.h.

Referenced by open(), and readMetaData().

safevector<MetaEdit> PtexReader::_metaedits
| protected

Definition at line 608 of file PtexReader.h.

Referenced by readEditMetaData(), and readMetaData().

bool PtexReader::_ok
| protected

Definition at line 575 of file PtexReader.h.

Referenced by getData(), and open().

bool PtexReader::_ownsCache
| protected

Definition at line 574 of file PtexReader.h.

Referenced by ~PtexReader().

std::string PtexReader::_path
| protected

Definition at line 579 of file PtexReader.h.

Referenced by open().

int PtexReader::_pixelsize
| protected

Definition at line 590 of file PtexReader.h.

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

FilePos PtexReader::_pos
| protected

Definition at line 578 of file PtexReader.h.

Referenced by readBlock().

bool PtexReader::_premultiply
| protected

Definition at line 573 of file PtexReader.h.

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

ReductionMap PtexReader::_reductions
| protected

Definition at line 636 of file PtexReader.h.

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

safevector<Res> PtexReader::_res_r
| protected

Definition at line 597 of file PtexReader.h.

Referenced by readFaceInfo().

safevector<uint32_t> PtexReader::_rfaceids
| protected

Definition at line 596 of file PtexReader.h.

Referenced by getData(), and readFaceInfo().

z_stream_s PtexReader::_zstream
| protected

Definition at line 638 of file PtexReader.h.

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

Mutex PtexReader::readlock

Definition at line 465 of file PtexReader.h.

Referenced by PtexReader::MetaData::getEntry(), readFace(), readLevel(), and readMetaData().

Mutex PtexReader::reducelock

Definition at line 466 of file PtexReader.h.

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

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

- PtexReader.h
- PtexReader.cpp