PtexReader.h
Go to the documentation of this file.
#ifndef PtexReader_h
#define PtexReader_h
/*
PTEX SOFTWARE
Copyright 2014 Disney Enterprises, Inc. All rights reserved
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* The names "Disney", "Walt Disney Pictures", "Walt Disney Animation
Studios" or the names of its contributors may NOT be used to
endorse or promote products derived from this software without
specific prior written permission from Walt Disney Pictures.
Disclaimer: THIS SOFTWARE IS PROVIDED BY WALT DISNEY PICTURES AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE, NONINFRINGEMENT AND TITLE ARE DISCLAIMED.
IN NO EVENT SHALL WALT DISNEY PICTURES, THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND BASED ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <stdio.h>
#include <zlib.h>
#include <vector>
#include <string>
#include <map>
#include <errno.h>
#include "Ptexture.h"
#include "PtexIO.h"
#include "PtexUtils.h"
#include "PtexHashMap.h"
PTEX_NAMESPACE_BEGIN
class PtexReader : public PtexTexture {
public:
PtexReader(bool premultiply, PtexInputHandler* inputHandler, PtexErrorHandler* errorHandler);
virtual ~PtexReader();
virtual void release() { delete this; }
bool needToOpen() const { return _needToOpen; }
bool open(const char* path, Ptex::String& error);
void prune();
void purge();
void setPendingPurge() { _pendingPurge = true; }
bool pendingPurge() const { return _pendingPurge; }
bool tryClose();
bool ok() const { return _ok; }
bool isOpen() { return _fp; }
void invalidate() {
_ok = false;
_needToOpen = false;
}
void increaseMemUsed(size_t amount) { if (amount) AtomicAdd(&_memUsed, amount); }
void logOpen() { AtomicIncrement(&_opens); }
void logBlockRead() { AtomicIncrement(&_blockReads); }
virtual const char* path() { return _path.c_str(); }
virtual Info getInfo() {
Info info;
info.meshType = MeshType(_header.meshtype);
info.dataType = DataType(_header.datatype);
info.uBorderMode = BorderMode(_extheader.ubordermode);
info.vBorderMode = BorderMode(_extheader.vbordermode);
info.edgeFilterMode = EdgeFilterMode(_extheader.edgefiltermode);
info.alphaChannel = _header.alphachan;
info.numChannels = _header.nchannels;
info.numFaces = _header.nfaces;
return info;
}
virtual Ptex::MeshType meshType() { return MeshType(_header.meshtype); }
virtual Ptex::DataType dataType() { return DataType(_header.datatype); }
virtual Ptex::BorderMode uBorderMode() { return BorderMode(_extheader.ubordermode); }
virtual Ptex::BorderMode vBorderMode() { return BorderMode(_extheader.vbordermode); }
virtual Ptex::EdgeFilterMode edgeFilterMode() { return EdgeFilterMode(_extheader.edgefiltermode); }
virtual int alphaChannel() { return _header.alphachan; }
virtual int numChannels() { return _header.nchannels; }
virtual int numFaces() { return _header.nfaces; }
virtual bool hasEdits() { return _hasEdits; }
virtual bool hasMipMaps() { return _header.nlevels > 1; }
virtual PtexMetaData* getMetaData();
virtual const Ptex::FaceInfo& getFaceInfo(int faceid);
virtual void getData(int faceid, void* buffer, int stride);
virtual void getData(int faceid, void* buffer, int stride, Res res);
virtual PtexFaceData* getData(int faceid);
virtual PtexFaceData* getData(int faceid, Res res);
virtual void getPixel(int faceid, int u, int v,
float* result, int firstchan, int nchannels);
virtual void getPixel(int faceid, int u, int v,
float* result, int firstchan, int nchannels,
Ptex::Res res);
DataType datatype() const { return DataType(_header.datatype); }
int nchannels() const { return _header.nchannels; }
int pixelsize() const { return _pixelsize; }
const Header& header() const { return _header; }
const ExtHeader& extheader() const { return _extheader; }
const LevelInfo& levelinfo(int level) const { return _levelinfo[level]; }
class MetaData : public PtexMetaData {
public:
MetaData(PtexReader* reader)
: _reader(reader) {}
~MetaData() {}
virtual void release() {}
virtual int numKeys() { return int(_entries.size()); }
virtual void getKey(int index, const char*& key, MetaDataType& type)
{
if (index < 0 || index >= int(_entries.size())) {
return;
}
Entry* e = _entries[index];
key = e->key;
type = e->type;
}
virtual bool findKey(const char* key, int& index, MetaDataType& type)
{
MetaMap::iterator iter = _map.find(key);
if (iter==_map.end()) {
index = -1;
return false;
}
index = iter->second.index;
type = iter->second.type;
return true;
}
virtual void getValue(const char* key, const char*& value)
{
int index = -1;
MetaDataType type;
if (!findKey(key, index, type)) {
value = 0;
return;
}
Entry* e = getEntry(index);
if (e && e->type == mdt_string) value = (const char*) e->data;
else value = 0;
}
virtual void getValue(int index, const char*& value)
{
if (index < 0 || index >= int(_entries.size())) { value = 0; return; }
Entry* e = getEntry(index);
if (e && e->type == mdt_string) value = (const char*) e->data;
else value = 0;
}
template<typename T>
void getValue(int index, MetaDataType requestedType, const T*& value, int& count)
{
if (index < 0 || index >= int(_entries.size())) {
value = 0;
count = 0;
return;
}
Entry* e = getEntry(index);
if (e && e->type == requestedType) {
value = (const T*) e->data;
count = int(e->datasize/sizeof(T));
}
else { value = 0; count = 0; }
}
template<typename T>
void getValue(const char* key, MetaDataType requestedType, const T*& value, int& count)
{
int index = -1;
MetaDataType type;
findKey(key, index, type);
getValue<T>(index, requestedType, value, count);
}
virtual void getValue(const char* key, const int8_t*& value, int& count)
{
getValue<int8_t>(key, mdt_int8, value, count);
}
virtual void getValue(int index, const int8_t*& value, int& count)
{
getValue<int8_t>(index, mdt_int8, value, count);
}
virtual void getValue(const char* key, const int16_t*& value, int& count)
{
getValue<int16_t>(key, mdt_int16, value, count);
}
virtual void getValue(int index, const int16_t*& value, int& count)
{
getValue<int16_t>(index, mdt_int16, value, count);
}
virtual void getValue(const char* key, const int32_t*& value, int& count)
{
getValue<int32_t>(key, mdt_int32, value, count);
}
virtual void getValue(int index, const int32_t*& value, int& count)
{
getValue<int32_t>(index, mdt_int32, value, count);
}
virtual void getValue(const char* key, const float*& value, int& count)
{
getValue<float>(key, mdt_float, value, count);
}
virtual void getValue(int index, const float*& value, int& count)
{
getValue<float>(index, mdt_float, value, count);
}
virtual void getValue(const char* key, const double*& value, int& count)
{
getValue<double>(key, mdt_double, value, count);
}
virtual void getValue(int index, const double*& value, int& count)
{
getValue<double>(index, mdt_double, value, count);
}
void addEntry(uint8_t keysize, const char* key, uint8_t datatype,
uint32_t datasize, const void* data, size_t& metaDataMemUsed)
{
Entry* e = newEntry(keysize, key, datatype, datasize, metaDataMemUsed);
e->data = new char[datasize];
memcpy(e->data, data, datasize);
metaDataMemUsed += datasize;
}
void addLmdEntry(uint8_t keysize, const char* key, uint8_t datatype,
uint32_t datasize, FilePos filepos, uint32_t zipsize,
size_t& metaDataMemUsed)
{
Entry* e = newEntry(keysize, key, datatype, datasize, metaDataMemUsed);
e->isLmd = true;
e->lmdData = 0;
e->lmdPos = filepos;
e->lmdZipSize = zipsize;
}
size_t selfDataSize()
{
return sizeof(*this) + sizeof(Entry*) * _entries.capacity();
}
protected:
class LargeMetaData
{
public:
LargeMetaData(int size)
: _data(new char [size]) {}
virtual ~LargeMetaData() { delete [] _data; }
void* data() { return _data; }
private:
LargeMetaData(const LargeMetaData&);
char* _data;
};
struct Entry {
const char* key; // ptr to map key string
MetaDataType type; // meta data type
uint32_t datasize; // size of data in bytes
char* data; // if lmd, data only valid when lmd is loaded and ref'ed
bool isLmd; // true if data is a large meta data block
LargeMetaData* lmdData; // large meta data (lazy-loaded)
FilePos lmdPos; // large meta data file position
uint32_t lmdZipSize; // large meta data size on disk
uint32_t index; // index in vector
Entry() :
key(0), type(MetaDataType(0)), datasize(0), data(0),
isLmd(0), lmdData(0), lmdPos(0), lmdZipSize(0) {}
~Entry() { clear(); }
void clear() {
if (isLmd) {
isLmd = 0;
if (lmdData) { delete lmdData; lmdData = 0; }
lmdPos = 0;
lmdZipSize = 0;
}
else {
if (data) { delete [] data; }
}
data = 0;
}
};
Entry* newEntry(uint8_t keysize, const char* key, uint8_t datatype, uint32_t datasize, size_t& metaDataMemUsed)
{
std::pair<MetaMap::iterator,bool> result =
_map.insert(std::make_pair(std::string(key, keysize), Entry()));
Entry* e = &result.first->second;
bool newentry = result.second;
uint32_t index = 0;
if (newentry) {
index = uint32_t(_entries.size());
_entries.push_back(e);
}
else {
index = e->index;
e->clear();
}
e->key = result.first->first.c_str();
e->type = MetaDataType(datatype);
e->datasize = datasize;
e->index = index;
metaDataMemUsed += sizeof(std::string) + keysize + 1 + sizeof(Entry);
return e;
}
PTEXAPI Entry* getEntry(int index);
PtexReader* _reader;
typedef std::map<std::string, Entry> MetaMap;
MetaMap _map;
std::vector<Entry*> _entries;
};
class ConstDataPtr : public PtexFaceData {
public:
ConstDataPtr(void* data, int pixelsize)
: _data(data), _pixelsize(pixelsize) {}
virtual void release() { delete this; }
virtual Ptex::Res res() { return 0; }
virtual bool isConstant() { return true; }
virtual void getPixel(int, int, void* result)
{ memcpy(result, _data, _pixelsize); }
virtual void* getData() { return _data; }
virtual bool isTiled() { return false; }
virtual Ptex::Res tileRes() { return 0; }
virtual PtexFaceData* getTile(int) { return 0; }
protected:
void* _data;
int _pixelsize;
};
class FaceData : public PtexFaceData {
public:
FaceData(Res resArg)
: _res(resArg) {}
virtual ~FaceData() {}
virtual void release() { }
virtual Ptex::Res res() { return _res; }
virtual FaceData* reduce(PtexReader*, Res newres, PtexUtils::ReduceFn, size_t& newMemUsed) = 0;
protected:
Res _res;
};
class PackedFace : public FaceData {
public:
PackedFace(Res resArg, int pixelsize, int size)
: FaceData(resArg),
_pixelsize(pixelsize), _data(new char [size]) {}
void* data() { return _data; }
virtual bool isConstant() { return false; }
virtual void getPixel(int u, int v, void* result)
{
memcpy(result, _data + (v*_res.u() + u) * _pixelsize, _pixelsize);
}
virtual void* getData() { return _data; }
virtual bool isTiled() { return false; }
virtual Ptex::Res tileRes() { return _res; }
virtual PtexFaceData* getTile(int) { return 0; }
virtual FaceData* reduce(PtexReader*, Res newres, PtexUtils::ReduceFn, size_t& newMemUsed);
protected:
virtual ~PackedFace() { delete [] _data; }
int _pixelsize;
char* _data;
};
class ConstantFace : public PackedFace {
public:
ConstantFace(int pixelsize)
: PackedFace(0, pixelsize, pixelsize) {}
virtual bool isConstant() { return true; }
virtual void getPixel(int, int, void* result) { memcpy(result, _data, _pixelsize); }
virtual FaceData* reduce(PtexReader*, Res newres, PtexUtils::ReduceFn, size_t& newMemUsed);
};
class ErrorFace : public ConstantFace {
bool _deleteOnRelease;
public:
ErrorFace(void* errorPixel, int pixelsize, bool deleteOnRelease)
: ConstantFace(pixelsize), _deleteOnRelease(deleteOnRelease)
{
memcpy(_data, errorPixel, pixelsize);
}
virtual void release() { if (_deleteOnRelease) delete this; }
};
class TiledFaceBase : public FaceData {
public:
TiledFaceBase(PtexReader* reader, Res resArg, Res tileresArg)
: FaceData(resArg),
_reader(reader),
_tileres(tileresArg)
{
_dt = reader->datatype();
_nchan = reader->nchannels();
_pixelsize = DataSize(_dt)*_nchan;
_ntilesu = _res.ntilesu(tileresArg);
_ntilesv = _res.ntilesv(tileresArg);
_ntiles = _ntilesu*_ntilesv;
_tiles.resize(_ntiles);
}
virtual void release() { }
virtual bool isConstant() { return false; }
virtual void getPixel(int u, int v, void* result);
virtual void* getData() { return 0; }
virtual bool isTiled() { return true; }
virtual Ptex::Res tileRes() { return _tileres; }
virtual FaceData* reduce(PtexReader*, Res newres, PtexUtils::ReduceFn, size_t& newMemUsed);
Res tileres() const { return _tileres; }
int ntilesu() const { return _ntilesu; }
int ntilesv() const { return _ntilesv; }
int ntiles() const { return _ntiles; }
protected:
size_t baseExtraMemUsed() { return _tiles.size() * sizeof(_tiles[0]); }
virtual ~TiledFaceBase() {
for (std::vector<FaceData*>::iterator i = _tiles.begin(); i != _tiles.end(); ++i) {
if (*i) delete *i;
}
}
PtexReader* _reader;
Res _tileres;
DataType _dt;
int _nchan;
int _ntilesu;
int _ntilesv;
int _ntiles;
int _pixelsize;
std::vector<FaceData*> _tiles;
};
class TiledFace : public TiledFaceBase {
public:
TiledFace(PtexReader* reader, Res resArg, Res tileresArg, int levelid)
: TiledFaceBase(reader, resArg, tileresArg),
_levelid(levelid)
{
_fdh.resize(_ntiles),
_offsets.resize(_ntiles);
}
virtual PtexFaceData* getTile(int tile)
{
FaceData*& f = _tiles[tile];
if (!f) readTile(tile, f);
return f;
}
void readTile(int tile, FaceData*& data);
size_t memUsed() {
return sizeof(*this) + baseExtraMemUsed() + _fdh.size() * (sizeof(_fdh[0]) + sizeof(_offsets[0]));
}
protected:
friend class PtexReader;
int _levelid;
std::vector<FaceDataHeader> _fdh;
std::vector<FilePos> _offsets;
};
class TiledReducedFace : public TiledFaceBase {
public:
TiledReducedFace(PtexReader* reader, Res resArg, Res tileresArg,
TiledFaceBase* parentface, PtexUtils::ReduceFn reducefn)
: TiledFaceBase(reader, resArg, tileresArg),
_parentface(parentface),
_reducefn(reducefn)
{
}
~TiledReducedFace()
{
}
virtual PtexFaceData* getTile(int tile);
size_t memUsed() { return sizeof(*this) + baseExtraMemUsed(); }
protected:
TiledFaceBase* _parentface;
PtexUtils::ReduceFn* _reducefn;
};
class Level {
public:
std::vector<FaceDataHeader> fdh;
std::vector<FilePos> offsets;
std::vector<FaceData*> faces;
Level(int nfaces)
: fdh(nfaces),
offsets(nfaces),
faces(nfaces) {}
~Level() {
for (std::vector<FaceData*>::iterator i = faces.begin(); i != faces.end(); ++i) {
if (*i) delete *i;
}
}
size_t memUsed() {
return sizeof(*this) + fdh.size() * (sizeof(fdh[0]) +
sizeof(offsets[0]) +
sizeof(faces[0]));
}
};
protected:
void setError(const char* error)
{
std::string msg = error;
msg += " PtexFile: ";
msg += _path;
msg += "\n";
if (_err) _err->reportError(msg.c_str());
else std::cerr << msg;
_ok = 0;
}
FilePos tell() { return _pos; }
void seek(FilePos pos)
{
if (!_fp && !reopenFP()) return;
logBlockRead();
if (pos != _pos) {
_io->seek(_fp, pos);
_pos = 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)
{
Level*& level = _levels[levelid];
if (!level) readLevel(levelid, level);
return level;
}
uint8_t* getConstData() { return _constdata; }
FaceData* getFace(int levelid, Level* level, int faceid, Res res)
{
FaceData*& face = level->faces[faceid];
if (!face) readFace(levelid, level, faceid, res);
return face;
}
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)
{
return new ErrorFace(&_errorPixel[0], _pixelsize, deleteOnRelease);
}
void computeOffsets(FilePos pos, int noffsets, const FaceDataHeader* fdh, FilePos* offsets)
{
FilePos* end = offsets + noffsets;
while (offsets != end) { *offsets++ = pos; pos += fdh->blocksize(); fdh++; }
}
class DefaultInputHandler : public PtexInputHandler
{
char* buffer;
public:
DefaultInputHandler() : buffer(0) {}
virtual Handle open(const char* path) {
FILE* fp = fopen(path, "rb");
if (fp) {
buffer = new char [IBuffSize];
setvbuf(fp, buffer, _IOFBF, IBuffSize);
}
else buffer = 0;
return (Handle) fp;
}
virtual void seek(Handle handle, int64_t pos) { fseeko((FILE*)handle, pos, SEEK_SET); }
virtual size_t read(void* bufferArg, size_t size, Handle handle) {
return fread(bufferArg, size, 1, (FILE*)handle) == 1 ? size : 0;
}
virtual bool close(Handle handle) {
bool ok = handle && (fclose((FILE*)handle) == 0);
if (buffer) { delete [] buffer; buffer = 0; }
return ok;
}
virtual const char* lastError() { return strerror(errno); }
};
Mutex readlock;
DefaultInputHandler _defaultIo; // Default IO handler
PtexInputHandler* _io; // IO handler
PtexErrorHandler* _err; // Error handler
bool _premultiply; // true if reader should premultiply the alpha chan
bool _ok; // flag set to false if open or read error occurred
bool _needToOpen; // true if file needs to be opened (or reopened after a purge)
bool _pendingPurge; // true if a purge attempt was made but file was busy
PtexInputHandler::Handle _fp; // file pointer
FilePos _pos; // current seek position
std::string _path; // current file path
Header _header; // the header
ExtHeader _extheader; // extended header
FilePos _faceinfopos; // file positions of data sections
FilePos _constdatapos; // ...
FilePos _levelinfopos;
FilePos _leveldatapos;
FilePos _metadatapos;
FilePos _lmdheaderpos;
FilePos _lmddatapos;
FilePos _editdatapos;
int _pixelsize; // size of a pixel in bytes
uint8_t* _constdata; // constant pixel value per face
MetaData* _metadata; // meta data (read on demand)
bool _hasEdits; // has edit blocks
std::vector<FaceInfo> _faceinfo; // per-face header info
std::vector<uint32_t> _rfaceids; // faceids sorted in reduction order
std::vector<LevelInfo> _levelinfo; // per-level header info
std::vector<FilePos> _levelpos; // file position of each level's data
std::vector<Level*> _levels; // level data (read on demand)
struct MetaEdit
{
FilePos pos;
int zipsize;
int memsize;
};
std::vector<MetaEdit> _metaedits;
struct FaceEdit
{
FilePos pos;
int faceid;
FaceDataHeader fdh;
};
std::vector<FaceEdit> _faceedits;
class ReductionKey {
int64_t _val;
public:
ReductionKey() : _val(-1) {}
ReductionKey(uint32_t faceid, Res res)
: _val( int64_t(faceid)<<32 | uint32_t(16777619*((res.val()<<16) ^ faceid)) ) {}
void copy(volatile ReductionKey& key) volatile
{
_val = key._val;
}
void move(volatile ReductionKey& key) volatile
{
_val = key._val;
}
bool matches(const ReductionKey& key) volatile
{
return _val == key._val;
}
bool isEmpty() volatile { return _val==-1; }
uint32_t hash() volatile
{
return uint32_t(_val);
}
};
typedef PtexHashMap<ReductionKey, FaceData*> ReductionMap;
ReductionMap _reductions;
std::vector<char> _errorPixel; // referenced by errorData()
z_stream_s _zstream;
size_t _baseMemUsed;
volatile size_t _memUsed;
volatile size_t _opens;
volatile size_t _blockReads;
};
PTEX_NAMESPACE_END
#endif
PTEXAPI
#define PTEXAPI
Definition PtexExports.h:60
PtexHashMap.h
Contains PtexHashMap, a lightweight multi-threaded hash table.
PtexIO.h
IBuffSize
const int IBuffSize
Definition PtexIO.h:113
FilePos
off_t FilePos
Definition PtexPlatform.h:99
AtomicAdd
PTEX_INLINE T AtomicAdd(volatile T *target, T value)
Definition PtexPlatform.h:209
AtomicIncrement
PTEX_INLINE T AtomicIncrement(volatile T *target)
Definition PtexPlatform.h:225
PtexUtils.h
PTEX_NAMESPACE_END
#define PTEX_NAMESPACE_END
Definition PtexVersion.h:62
Ptexture.h
Public API classes for reading, writing, caching, and filtering Ptex files.
Mutex
Definition PtexPlatform.h:137
PtexErrorHandler
Custom handler interface redirecting Ptex error messages.
Definition Ptexture.h:658
PtexErrorHandler::reportError
virtual void reportError(const char *error)=0
PtexFaceData
Per-face texture data accessor.
Definition Ptexture.h:406
PtexHashMap
Definition PtexHashMap.h:152
PtexInputHandler
Custom handler interface for intercepting and redirecting Ptex input stream calls.
Definition Ptexture.h:619
PtexInputHandler::seek
virtual void seek(Handle handle, int64_t pos)=0
Seek to an absolute byte position in the input stream.
PtexInputHandler::Handle
void * Handle
Definition Ptexture.h:624
PtexMetaData
Meta data accessor.
Definition Ptexture.h:328
PtexReader::ConstDataPtr
Definition PtexReader.h:345
PtexReader::ConstDataPtr::isConstant
virtual bool isConstant()
True if this data block is constant.
Definition PtexReader.h:351
PtexReader::ConstDataPtr::_data
void * _data
Definition PtexReader.h:360
PtexReader::ConstDataPtr::res
virtual Ptex::Res res()
Resolution of the texture held by this data block.
Definition PtexReader.h:350
PtexReader::ConstDataPtr::release
virtual void release()
Release resources held by this pointer (pointer becomes invalid).
Definition PtexReader.h:349
PtexReader::ConstDataPtr::isTiled
virtual bool isTiled()
True if this data block is tiled.
Definition PtexReader.h:355
PtexReader::ConstDataPtr::getData
virtual void * getData()
Access the data from this data block.
Definition PtexReader.h:354
PtexReader::ConstDataPtr::getPixel
virtual void getPixel(int, int, void *result)
Read a single texel from the data block.
Definition PtexReader.h:352
PtexReader::ConstDataPtr::_pixelsize
int _pixelsize
Definition PtexReader.h:361
PtexReader::ConstDataPtr::tileRes
virtual Ptex::Res tileRes()
Resolution of each tile in this data block.
Definition PtexReader.h:356
PtexReader::ConstDataPtr::getTile
virtual PtexFaceData * getTile(int)
Access a tile from the data block.
Definition PtexReader.h:357
PtexReader::ConstDataPtr::ConstDataPtr
ConstDataPtr(void *data, int pixelsize)
Definition PtexReader.h:347
PtexReader::ConstantFace
Definition PtexReader.h:401
PtexReader::ConstantFace::getPixel
virtual void getPixel(int, int, void *result)
Read a single texel from the data block.
Definition PtexReader.h:406
PtexReader::ConstantFace::ConstantFace
ConstantFace(int pixelsize)
Definition PtexReader.h:403
PtexReader::ConstantFace::isConstant
virtual bool isConstant()
True if this data block is constant.
Definition PtexReader.h:405
PtexReader::ConstantFace::reduce
virtual FaceData * reduce(PtexReader *, Res newres, PtexUtils::ReduceFn, size_t &newMemUsed)
Definition PtexReader.cpp:966
PtexReader::DefaultInputHandler
Definition PtexReader.h:612
PtexReader::DefaultInputHandler::buffer
char * buffer
Definition PtexReader.h:613
PtexReader::DefaultInputHandler::seek
virtual void seek(Handle handle, int64_t pos)
Seek to an absolute byte position in the input stream.
Definition PtexReader.h:625
PtexReader::DefaultInputHandler::DefaultInputHandler
DefaultInputHandler()
Definition PtexReader.h:615
PtexReader::DefaultInputHandler::close
virtual bool close(Handle handle)
Close a file.
Definition PtexReader.h:629
PtexReader::DefaultInputHandler::read
virtual size_t read(void *bufferArg, size_t size, Handle handle)
Read a number of bytes from the file.
Definition PtexReader.h:626
PtexReader::DefaultInputHandler::open
virtual Handle open(const char *path)
Open a file in read mode.
Definition PtexReader.h:616
PtexReader::DefaultInputHandler::lastError
virtual const char * lastError()
Return the last error message encountered.
Definition PtexReader.h:634
PtexReader::ErrorFace
Definition PtexReader.h:410
PtexReader::ErrorFace::_deleteOnRelease
bool _deleteOnRelease
Definition PtexReader.h:411
PtexReader::ErrorFace::release
virtual void release()
Release resources held by this pointer (pointer becomes invalid).
Definition PtexReader.h:418
PtexReader::ErrorFace::ErrorFace
ErrorFace(void *errorPixel, int pixelsize, bool deleteOnRelease)
Definition PtexReader.h:413
PtexReader::FaceData
Definition PtexReader.h:365
PtexReader::FaceData::res
virtual Ptex::Res res()
Resolution of the texture held by this data block.
Definition PtexReader.h:371
PtexReader::FaceData::reduce
virtual FaceData * reduce(PtexReader *, Res newres, PtexUtils::ReduceFn, size_t &newMemUsed)=0
PtexReader::FaceData::release
virtual void release()
Release resources held by this pointer (pointer becomes invalid).
Definition PtexReader.h:370
PtexReader::FaceData::~FaceData
virtual ~FaceData()
Definition PtexReader.h:369
PtexReader::FaceData::_res
Res _res
Definition PtexReader.h:374
PtexReader::FaceData::FaceData
FaceData(Res resArg)
Definition PtexReader.h:367
PtexReader::Level
Definition PtexReader.h:520
PtexReader::Level::Level
Level(int nfaces)
Definition PtexReader.h:526
PtexReader::Level::offsets
std::vector< FilePos > offsets
Definition PtexReader.h:523
PtexReader::Level::fdh
std::vector< FaceDataHeader > fdh
Definition PtexReader.h:522
PtexReader::Level::faces
std::vector< FaceData * > faces
Definition PtexReader.h:524
PtexReader::Level::memUsed
size_t memUsed()
Definition PtexReader.h:537
PtexReader::Level::~Level
~Level()
Definition PtexReader.h:531
PtexReader::MetaData::LargeMetaData
Definition PtexReader.h:273
PtexReader::MetaData::LargeMetaData::data
void * data()
Definition PtexReader.h:278
PtexReader::MetaData::LargeMetaData::LargeMetaData
LargeMetaData(int size)
Definition PtexReader.h:275
PtexReader::MetaData::LargeMetaData::LargeMetaData
LargeMetaData(const LargeMetaData &)
PtexReader::MetaData::LargeMetaData::_data
char * _data
Definition PtexReader.h:281
PtexReader::MetaData::LargeMetaData::~LargeMetaData
virtual ~LargeMetaData()
Definition PtexReader.h:277
PtexReader::MetaData
Definition PtexReader.h:120
PtexReader::MetaData::getValue
virtual void getValue(int index, const int8_t *&value, int &count)
Query the value of a given meta data entry by index.
Definition PtexReader.h:201
PtexReader::MetaData::selfDataSize
size_t selfDataSize()
Definition PtexReader.h:266
PtexReader::MetaData::release
virtual void release()
Release resources held by this pointer (pointer becomes invalid).
Definition PtexReader.h:125
PtexReader::MetaData::newEntry
Entry * newEntry(uint8_t keysize, const char *key, uint8_t datatype, uint32_t datasize, size_t &metaDataMemUsed)
Definition PtexReader.h:313
PtexReader::MetaData::getKey
virtual void getKey(int index, const char *&key, MetaDataType &type)
Definition PtexReader.h:128
PtexReader::MetaData::getValue
virtual void getValue(int index, const double *&value, int &count)
Query the value of a given meta data entry by index.
Definition PtexReader.h:241
PtexReader::MetaData::getValue
virtual void getValue(const char *key, const int8_t *&value, int &count)
Query the value of a given meta data entry.
Definition PtexReader.h:196
PtexReader::MetaData::getValue
virtual void getValue(int index, const char *&value)
Query the value of a given meta data entry by index.
Definition PtexReader.h:163
PtexReader::MetaData::~MetaData
~MetaData()
Definition PtexReader.h:124
PtexReader::MetaData::addEntry
void addEntry(uint8_t keysize, const char *key, uint8_t datatype, uint32_t datasize, const void *data, size_t &metaDataMemUsed)
Definition PtexReader.h:246
PtexReader::MetaData::getValue
virtual void getValue(int index, const float *&value, int &count)
Query the value of a given meta data entry by index.
Definition PtexReader.h:231
PtexReader::MetaData::getValue
void getValue(const char *key, MetaDataType requestedType, const T *&value, int &count)
Definition PtexReader.h:188
PtexReader::MetaData::findKey
virtual bool findKey(const char *key, int &index, MetaDataType &type)
Definition PtexReader.h:138
PtexReader::MetaData::getValue
virtual void getValue(int index, const int16_t *&value, int &count)
Query the value of a given meta data entry by index.
Definition PtexReader.h:211
PtexReader::MetaData::MetaData
MetaData(PtexReader *reader)
Definition PtexReader.h:122
PtexReader::MetaData::getValue
virtual void getValue(const char *key, const int32_t *&value, int &count)
Query the value of a given meta data entry.
Definition PtexReader.h:216
PtexReader::MetaData::numKeys
virtual int numKeys()
Query number of meta data entries stored in file.
Definition PtexReader.h:127
PtexReader::MetaData::getValue
virtual void getValue(int index, const int32_t *&value, int &count)
Query the value of a given meta data entry by index.
Definition PtexReader.h:221
PtexReader::MetaData::getValue
virtual void getValue(const char *key, const double *&value, int &count)
Query the value of a given meta data entry.
Definition PtexReader.h:236
PtexReader::MetaData::_reader
PtexReader * _reader
Definition PtexReader.h:338
PtexReader::MetaData::_map
MetaMap _map
Definition PtexReader.h:340
PtexReader::MetaData::getValue
virtual void getValue(const char *key, const char *&value)
Query the value of a given meta data entry.
Definition PtexReader.h:150
PtexReader::MetaData::MetaMap
std::map< std::string, Entry > MetaMap
Definition PtexReader.h:339
PtexReader::MetaData::getValue
virtual void getValue(const char *key, const float *&value, int &count)
Query the value of a given meta data entry.
Definition PtexReader.h:226
PtexReader::MetaData::addLmdEntry
void addLmdEntry(uint8_t keysize, const char *key, uint8_t datatype, uint32_t datasize, FilePos filepos, uint32_t zipsize, size_t &metaDataMemUsed)
Definition PtexReader.h:255
PtexReader::MetaData::getValue
void getValue(int index, MetaDataType requestedType, const T *&value, int &count)
Definition PtexReader.h:172
PtexReader::MetaData::getEntry
Entry * getEntry(int index)
Definition PtexReader.cpp:343
PtexReader::MetaData::_entries
std::vector< Entry * > _entries
Definition PtexReader.h:341
PtexReader::MetaData::getValue
virtual void getValue(const char *key, const int16_t *&value, int &count)
Query the value of a given meta data entry.
Definition PtexReader.h:206
PtexReader::PackedFace
Definition PtexReader.h:377
PtexReader::PackedFace::~PackedFace
virtual ~PackedFace()
Definition PtexReader.h:395
PtexReader::PackedFace::data
void * data()
Definition PtexReader.h:382
PtexReader::PackedFace::getTile
virtual PtexFaceData * getTile(int)
Access a tile from the data block.
Definition PtexReader.h:391
PtexReader::PackedFace::PackedFace
PackedFace(Res resArg, int pixelsize, int size)
Definition PtexReader.h:379
PtexReader::PackedFace::isTiled
virtual bool isTiled()
True if this data block is tiled.
Definition PtexReader.h:389
PtexReader::PackedFace::_pixelsize
int _pixelsize
Definition PtexReader.h:397
PtexReader::PackedFace::tileRes
virtual Ptex::Res tileRes()
Resolution of each tile in this data block.
Definition PtexReader.h:390
PtexReader::PackedFace::_data
char * _data
Definition PtexReader.h:398
PtexReader::PackedFace::reduce
virtual FaceData * reduce(PtexReader *, Res newres, PtexUtils::ReduceFn, size_t &newMemUsed)
Definition PtexReader.cpp:949
PtexReader::PackedFace::isConstant
virtual bool isConstant()
True if this data block is constant.
Definition PtexReader.h:383
PtexReader::PackedFace::getPixel
virtual void getPixel(int u, int v, void *result)
Read a single texel from the data block.
Definition PtexReader.h:384
PtexReader::PackedFace::getData
virtual void * getData()
Access the data from this data block.
Definition PtexReader.h:388
PtexReader::ReductionKey
Definition PtexReader.h:685
PtexReader::ReductionKey::_val
int64_t _val
Definition PtexReader.h:686
PtexReader::ReductionKey::isEmpty
bool isEmpty() volatile
Definition PtexReader.h:706
PtexReader::ReductionKey::ReductionKey
ReductionKey(uint32_t faceid, Res res)
Definition PtexReader.h:689
PtexReader::ReductionKey::move
void move(volatile ReductionKey &key) volatile
Definition PtexReader.h:697
PtexReader::ReductionKey::ReductionKey
ReductionKey()
Definition PtexReader.h:688
PtexReader::ReductionKey::hash
uint32_t hash() volatile
Definition PtexReader.h:707
PtexReader::ReductionKey::matches
bool matches(const ReductionKey &key) volatile
Definition PtexReader.h:702
PtexReader::ReductionKey::copy
void copy(volatile ReductionKey &key) volatile
Definition PtexReader.h:692
PtexReader::TiledFaceBase
Definition PtexReader.h:421
PtexReader::TiledFaceBase::TiledFaceBase
TiledFaceBase(PtexReader *reader, Res resArg, Res tileresArg)
Definition PtexReader.h:423
PtexReader::TiledFaceBase::baseExtraMemUsed
size_t baseExtraMemUsed()
Definition PtexReader.h:450
PtexReader::TiledFaceBase::_tiles
std::vector< FaceData * > _tiles
Definition PtexReader.h:466
PtexReader::TiledFaceBase::isTiled
virtual bool isTiled()
True if this data block is tiled.
Definition PtexReader.h:441
PtexReader::TiledFaceBase::reduce
virtual FaceData * reduce(PtexReader *, Res newres, PtexUtils::ReduceFn, size_t &newMemUsed)
Definition PtexReader.cpp:979
PtexReader::TiledFaceBase::tileres
Res tileres() const
Definition PtexReader.h:444
PtexReader::TiledFaceBase::ntilesu
int ntilesu() const
Definition PtexReader.h:445
PtexReader::TiledFaceBase::_dt
DataType _dt
Definition PtexReader.h:460
PtexReader::TiledFaceBase::getData
virtual void * getData()
Access the data from this data block.
Definition PtexReader.h:440
PtexReader::TiledFaceBase::_ntilesv
int _ntilesv
Definition PtexReader.h:463
PtexReader::TiledFaceBase::_ntilesu
int _ntilesu
Definition PtexReader.h:462
PtexReader::TiledFaceBase::_nchan
int _nchan
Definition PtexReader.h:461
PtexReader::TiledFaceBase::ntilesv
int ntilesv() const
Definition PtexReader.h:446
PtexReader::TiledFaceBase::_ntiles
int _ntiles
Definition PtexReader.h:464
PtexReader::TiledFaceBase::release
virtual void release()
Release resources held by this pointer (pointer becomes invalid).
Definition PtexReader.h:437
PtexReader::TiledFaceBase::_tileres
Res _tileres
Definition PtexReader.h:459
PtexReader::TiledFaceBase::tileRes
virtual Ptex::Res tileRes()
Resolution of each tile in this data block.
Definition PtexReader.h:442
PtexReader::TiledFaceBase::ntiles
int ntiles() const
Definition PtexReader.h:447
PtexReader::TiledFaceBase::_pixelsize
int _pixelsize
Definition PtexReader.h:465
PtexReader::TiledFaceBase::isConstant
virtual bool isConstant()
True if this data block is constant.
Definition PtexReader.h:438
PtexReader::TiledFaceBase::_reader
PtexReader * _reader
Definition PtexReader.h:458
PtexReader::TiledFaceBase::getPixel
virtual void getPixel(int u, int v, void *result)
Read a single texel from the data block.
Definition PtexReader.cpp:1104
PtexReader::TiledFaceBase::~TiledFaceBase
virtual ~TiledFaceBase()
Definition PtexReader.h:452
PtexReader::TiledFace
Definition PtexReader.h:470
PtexReader::TiledFace::_fdh
std::vector< FaceDataHeader > _fdh
Definition PtexReader.h:493
PtexReader::TiledFace::TiledFace
TiledFace(PtexReader *reader, Res resArg, Res tileresArg, int levelid)
Definition PtexReader.h:472
PtexReader::TiledFace::_levelid
int _levelid
Definition PtexReader.h:492
PtexReader::TiledFace::memUsed
size_t memUsed()
Definition PtexReader.h:486
PtexReader::TiledFace::getTile
virtual PtexFaceData * getTile(int tile)
Access a tile from the data block.
Definition PtexReader.h:479
PtexReader::TiledFace::readTile
void readTile(int tile, FaceData *&data)
Definition PtexReader.cpp:635
PtexReader::TiledFace::_offsets
std::vector< FilePos > _offsets
Definition PtexReader.h:494
PtexReader::TiledReducedFace
Definition PtexReader.h:498
PtexReader::TiledReducedFace::_parentface
TiledFaceBase * _parentface
Definition PtexReader.h:515
PtexReader::TiledReducedFace::getTile
virtual PtexFaceData * getTile(int tile)
Access a tile from the data block.
Definition PtexReader.cpp:1115
PtexReader::TiledReducedFace::~TiledReducedFace
~TiledReducedFace()
Definition PtexReader.h:507
PtexReader::TiledReducedFace::_reducefn
PtexUtils::ReduceFn * _reducefn
Definition PtexReader.h:516
PtexReader::TiledReducedFace::memUsed
size_t memUsed()
Definition PtexReader.h:512
PtexReader::TiledReducedFace::TiledReducedFace
TiledReducedFace(PtexReader *reader, Res resArg, Res tileresArg, TiledFaceBase *parentface, PtexUtils::ReduceFn reducefn)
Definition PtexReader.h:500
PtexReader
Definition PtexReader.h:52
PtexReader::readLevelInfo
void readLevelInfo()
Definition PtexReader.cpp:298
PtexReader::_reductions
ReductionMap _reductions
Definition PtexReader.h:713
PtexReader::reopenFP
bool reopenFP()
Definition PtexReader.cpp:240
PtexReader::ok
bool ok() const
Definition PtexReader.h:64
PtexReader::datatype
DataType datatype() const
Definition PtexReader.h:113
PtexReader::readEditFaceData
void readEditFaceData()
Definition PtexReader.cpp:502
PtexReader::_premultiply
bool _premultiply
Definition PtexReader.h:641
PtexReader::_constdatapos
FilePos _constdatapos
Definition PtexReader.h:651
PtexReader::readMetaDataBlock
void readMetaDataBlock(MetaData *metadata, FilePos pos, int zipsize, int memsize, size_t &metaDataMemUsed)
Definition PtexReader.cpp:414
PtexReader::extheader
const ExtHeader & extheader() const
Definition PtexReader.h:117
PtexReader::numFaces
virtual int numFaces()
Number of faces stored in file.
Definition PtexReader.h:97
PtexReader::setPendingPurge
void setPendingPurge()
Definition PtexReader.h:61
PtexReader::readFaceInfo
void readFaceInfo()
Definition PtexReader.cpp:277
PtexReader::vBorderMode
virtual Ptex::BorderMode vBorderMode()
Mode for filtering texture access beyond mesh border.
Definition PtexReader.h:93
PtexReader::_path
std::string _path
Definition PtexReader.h:647
PtexReader::_constdata
uint8_t * _constdata
Definition PtexReader.h:659
PtexReader::_levelpos
std::vector< FilePos > _levelpos
Definition PtexReader.h:666
PtexReader::readEditData
void readEditData()
Definition PtexReader.cpp:468
PtexReader::getPixel
virtual void getPixel(int faceid, int u, int v, float *result, int firstchan, int nchannels)
Access a single texel from the highest resolution texture .
Definition PtexReader.cpp:893
PtexReader::getInfo
virtual Info getInfo()
Definition PtexReader.h:77
PtexReader::_faceedits
std::vector< FaceEdit > _faceedits
Definition PtexReader.h:683
PtexReader::_opens
volatile size_t _opens
Definition PtexReader.h:719
PtexReader::isOpen
bool isOpen()
Definition PtexReader.h:65
PtexReader::release
virtual void release()
Release resources held by this pointer (pointer becomes invalid).
Definition PtexReader.h:56
PtexReader::increaseMemUsed
void increaseMemUsed(size_t amount)
Definition PtexReader.h:71
PtexReader::path
virtual const char * path()
Path that file was opened with.
Definition PtexReader.h:75
PtexReader::getFace
FaceData * getFace(int levelid, Level *level, int faceid, Res res)
Definition PtexReader.h:580
PtexReader::purge
void purge()
Definition PtexReader.cpp:115
PtexReader::_editdatapos
FilePos _editdatapos
Definition PtexReader.h:657
PtexReader::tell
FilePos tell()
Definition PtexReader.h:557
PtexReader::getLevel
Level * getLevel(int levelid)
Definition PtexReader.h:572
PtexReader::errorData
FaceData * errorData(bool deleteOnRelease=false)
Definition PtexReader.h:600
PtexReader::~PtexReader
virtual ~PtexReader()
Definition PtexReader.cpp:93
PtexReader::_hasEdits
bool _hasEdits
Definition PtexReader.h:661
PtexReader::_needToOpen
bool _needToOpen
Definition PtexReader.h:643
PtexReader::uBorderMode
virtual Ptex::BorderMode uBorderMode()
Mode for filtering texture access beyond mesh border.
Definition PtexReader.h:92
PtexReader::computeOffsets
void computeOffsets(FilePos pos, int noffsets, const FaceDataHeader *fdh, FilePos *offsets)
Definition PtexReader.h:605
PtexReader::readConstData
void readConstData()
Definition PtexReader.cpp:319
PtexReader::getMetaData
virtual PtexMetaData * getMetaData()
Access meta data.
Definition PtexReader.cpp:335
PtexReader::needToOpen
bool needToOpen() const
Definition PtexReader.h:57
PtexReader::alphaChannel
virtual int alphaChannel()
Index of alpha channel (if any).
Definition PtexReader.h:95
PtexReader::_extheader
ExtHeader _extheader
Definition PtexReader.h:649
PtexReader::_leveldatapos
FilePos _leveldatapos
Definition PtexReader.h:653
PtexReader::getData
virtual void getData(int faceid, void *buffer, int stride)
Access texture data for a face at highest-resolution.
Definition PtexReader.cpp:711
PtexReader::_err
PtexErrorHandler * _err
Definition PtexReader.h:640
PtexReader::header
const Header & header() const
Definition PtexReader.h:116
PtexReader::readEditMetaData
void readEditMetaData()
Definition PtexReader.cpp:533
PtexReader::_faceinfopos
FilePos _faceinfopos
Definition PtexReader.h:650
PtexReader::_levelinfo
std::vector< LevelInfo > _levelinfo
Definition PtexReader.h:665
PtexReader::ReductionMap
PtexHashMap< ReductionKey, FaceData * > ReductionMap
Definition PtexReader.h:712
PtexReader::hasMipMaps
virtual bool hasMipMaps()
True if the file has mipmaps.
Definition PtexReader.h:99
PtexReader::_zstream
z_stream_s _zstream
Definition PtexReader.h:716
PtexReader::_io
PtexInputHandler * _io
Definition PtexReader.h:639
PtexReader::getFaceInfo
virtual const Ptex::FaceInfo & getFaceInfo(int faceid)
Access resolution and adjacency information about a face.
Definition PtexReader.cpp:267
PtexReader::_metadatapos
FilePos _metadatapos
Definition PtexReader.h:654
PtexReader::readLargeMetaDataHeaders
void readLargeMetaDataHeaders(MetaData *metadata, FilePos pos, int zipsize, int memsize, size_t &metaDataMemUsed)
Definition PtexReader.cpp:440
PtexReader::closeFP
void closeFP()
Definition PtexReader.cpp:230
PtexReader::_pixelsize
int _pixelsize
Definition PtexReader.h:658
PtexReader::_pendingPurge
bool _pendingPurge
Definition PtexReader.h:644
PtexReader::pendingPurge
bool pendingPurge() const
Definition PtexReader.h:62
PtexReader::readlock
Mutex readlock
Definition PtexReader.h:637
PtexReader::readFace
void readFace(int levelid, Level *level, int faceid, Res res)
Definition PtexReader.cpp:627
PtexReader::_levelinfopos
FilePos _levelinfopos
Definition PtexReader.h:652
PtexReader::_lmdheaderpos
FilePos _lmdheaderpos
Definition PtexReader.h:655
PtexReader::hasEdits
virtual bool hasEdits()
True if the file has edit blocks.
Definition PtexReader.h:98
PtexReader::nchannels
int nchannels() const
Definition PtexReader.h:114
PtexReader::_lmddatapos
FilePos _lmddatapos
Definition PtexReader.h:656
PtexReader::prune
void prune()
Definition PtexReader.cpp:104
PtexReader::_rfaceids
std::vector< uint32_t > _rfaceids
Definition PtexReader.h:664
PtexReader::_metaedits
std::vector< MetaEdit > _metaedits
Definition PtexReader.h:675
PtexReader::_memUsed
volatile size_t _memUsed
Definition PtexReader.h:718
PtexReader::_defaultIo
DefaultInputHandler _defaultIo
Definition PtexReader.h:638
PtexReader::_blockReads
volatile size_t _blockReads
Definition PtexReader.h:720
PtexReader::_header
Header _header
Definition PtexReader.h:648
PtexReader::readFaceData
void readFaceData(FilePos pos, FaceDataHeader fdh, Res res, int levelid, FaceData *&face)
Definition PtexReader.cpp:641
PtexReader::seek
void seek(FilePos pos)
Definition PtexReader.h:558
PtexReader::readBlock
bool readBlock(void *data, int size, bool reportError=true)
Definition PtexReader.cpp:548
PtexReader::_metadata
MetaData * _metadata
Definition PtexReader.h:660
PtexReader::_levels
std::vector< Level * > _levels
Definition PtexReader.h:667
PtexReader::_baseMemUsed
size_t _baseMemUsed
Definition PtexReader.h:717
PtexReader::_faceinfo
std::vector< FaceInfo > _faceinfo
Definition PtexReader.h:663
PtexReader::invalidate
void invalidate()
Definition PtexReader.h:66
PtexReader::meshType
virtual Ptex::MeshType meshType()
Type of mesh for which texture data is defined.
Definition PtexReader.h:90
PtexReader::edgeFilterMode
virtual Ptex::EdgeFilterMode edgeFilterMode()
Mode for filtering textures across edges.
Definition PtexReader.h:94
PtexReader::pixelsize
int pixelsize() const
Definition PtexReader.h:115
PtexReader::_fp
PtexInputHandler::Handle _fp
Definition PtexReader.h:645
PtexReader::readZipBlock
bool readZipBlock(void *data, int zipsize, int unzipsize)
Definition PtexReader.cpp:563
PtexReader::readMetaData
void readMetaData()
Definition PtexReader.cpp:381
PtexReader::logBlockRead
void logBlockRead()
Definition PtexReader.h:73
PtexReader::logOpen
void logOpen()
Definition PtexReader.h:72
PtexReader::readLevel
void readLevel(int levelid, Level *&level)
Definition PtexReader.cpp:595
PtexReader::dataType
virtual Ptex::DataType dataType()
Type of data stored in file.
Definition PtexReader.h:91
PtexReader::_errorPixel
std::vector< char > _errorPixel
Definition PtexReader.h:714
PtexReader::getConstData
uint8_t * getConstData()
Definition PtexReader.h:579
PtexReader::numChannels
virtual int numChannels()
Number of channels stored in file.
Definition PtexReader.h:96
PtexReader::_pos
FilePos _pos
Definition PtexReader.h:646
PtexReader::open
bool open(const char *path, Ptex::String &error)
Definition PtexReader.cpp:137
PtexReader::levelinfo
const LevelInfo & levelinfo(int level) const
Definition PtexReader.h:118
PtexReader::tryClose
bool tryClose()
Definition PtexReader.cpp:219
PtexReader::setError
void setError(const char *error)
Definition PtexReader.h:546
PtexReader::_ok
bool _ok
Definition PtexReader.h:642
PtexTexture
Interface for reading data from a ptex file.
Definition Ptexture.h:457
Ptex::String
Memory-managed string.
Definition Ptexture.h:296
PTEX_NAMESPACE_BEGIN
Definition PtexSeparableKernel.cpp:42
PtexUtils::ReduceFn
void ReduceFn(const void *src, int sstride, int ures, int vres, void *dst, int dstride, DataType dt, int nchannels)
Definition PtexUtils.h:185
Ptex::DataType
DataType
Type of data stored in texture file.
Definition Ptexture.h:72
Ptex::MeshType
MeshType
Type of base mesh for which the textures are defined.
Definition Ptexture.h:66
Ptex::BorderMode
BorderMode
How to handle mesh border when filtering.
Definition Ptexture.h:86
Ptex::EdgeFilterMode
EdgeFilterMode
How to handle transformation across edges when filtering.
Definition Ptexture.h:80
ExtHeader
Definition PtexIO.h:64
ExtHeader::edgefiltermode
uint16_t edgefiltermode
Definition PtexIO.h:68
ExtHeader::vbordermode
uint16_t vbordermode
Definition PtexIO.h:67
ExtHeader::ubordermode
uint16_t ubordermode
Definition PtexIO.h:65
FaceDataHeader
Definition PtexIO.h:82
FaceDataHeader::blocksize
uint32_t blocksize() const
Definition PtexIO.h:84
Header
Definition PtexIO.h:44
Header::nlevels
uint16_t nlevels
Definition PtexIO.h:51
Header::nchannels
uint16_t nchannels
Definition PtexIO.h:50
Header::meshtype
uint32_t meshtype
Definition PtexIO.h:47
Header::datatype
uint32_t datatype
Definition PtexIO.h:48
Header::alphachan
int32_t alphachan
Definition PtexIO.h:49
Header::nfaces
uint32_t nfaces
Definition PtexIO.h:52
LevelInfo
Definition PtexIO.h:75
PtexReader::FaceEdit
Definition PtexReader.h:678
PtexReader::FaceEdit::pos
FilePos pos
Definition PtexReader.h:679
PtexReader::FaceEdit::faceid
int faceid
Definition PtexReader.h:680
PtexReader::FaceEdit::fdh
FaceDataHeader fdh
Definition PtexReader.h:681
PtexReader::MetaData::Entry
Definition PtexReader.h:284
PtexReader::MetaData::Entry::key
const char * key
Definition PtexReader.h:285
PtexReader::MetaData::Entry::type
MetaDataType type
Definition PtexReader.h:286
PtexReader::MetaData::Entry::lmdPos
FilePos lmdPos
Definition PtexReader.h:291
PtexReader::MetaData::Entry::clear
void clear()
Definition PtexReader.h:299
PtexReader::MetaData::Entry::~Entry
~Entry()
Definition PtexReader.h:298
PtexReader::MetaData::Entry::lmdZipSize
uint32_t lmdZipSize
Definition PtexReader.h:292
PtexReader::MetaData::Entry::isLmd
bool isLmd
Definition PtexReader.h:289
PtexReader::MetaData::Entry::Entry
Entry()
Definition PtexReader.h:295
PtexReader::MetaData::Entry::datasize
uint32_t datasize
Definition PtexReader.h:287
PtexReader::MetaData::Entry::lmdData
LargeMetaData * lmdData
Definition PtexReader.h:290
PtexReader::MetaData::Entry::index
uint32_t index
Definition PtexReader.h:293
PtexReader::MetaData::Entry::data
char * data
Definition PtexReader.h:288
PtexReader::MetaEdit
Definition PtexReader.h:670
PtexReader::MetaEdit::zipsize
int zipsize
Definition PtexReader.h:672
PtexReader::MetaEdit::memsize
int memsize
Definition PtexReader.h:673
PtexReader::MetaEdit::pos
FilePos pos
Definition PtexReader.h:671
PtexTexture::Info
Get most commonly used info in a single call for convenience / efficiency.
Definition Ptexture.h:486
PtexTexture::Info::numChannels
int numChannels
Definition Ptexture.h:493
PtexTexture::Info::uBorderMode
BorderMode uBorderMode
Definition Ptexture.h:489
PtexTexture::Info::vBorderMode
BorderMode vBorderMode
Definition Ptexture.h:490
PtexTexture::Info::edgeFilterMode
EdgeFilterMode edgeFilterMode
Definition Ptexture.h:491
PtexTexture::Info::alphaChannel
int alphaChannel
Definition Ptexture.h:492
PtexTexture::Info::dataType
DataType dataType
Definition Ptexture.h:488
PtexTexture::Info::numFaces
int numFaces
Definition Ptexture.h:494
PtexTexture::Info::meshType
MeshType meshType
Definition Ptexture.h:487
Ptex::FaceInfo
Information about a face, as stored in the Ptex file header.
Definition Ptexture.h:229
Ptex::Res
Pixel resolution of a given texture.
Definition Ptexture.h:159