Ptex
|
#include <PtexWriter.h>
Classes | |
struct | MetaEntry |
Public Member Functions | |
virtual void | setBorderModes (Ptex::BorderMode uBorderMode, Ptex::BorderMode vBorderMode) |
Set border modes. More... | |
virtual void | setEdgeFilterMode (Ptex::EdgeFilterMode edgeFilterMode) |
Set edge filter mode. More... | |
virtual void | writeMeta (const char *key, const char *value) |
Write a string as meta data. More... | |
virtual void | writeMeta (const char *key, const int8_t *value, int count) |
Write an array of signed 8-bit integers as meta data. More... | |
virtual void | writeMeta (const char *key, const int16_t *value, int count) |
Write an array of signed 16-bit integers as meta data. More... | |
virtual void | writeMeta (const char *key, const int32_t *value, int count) |
Write an array of signed 32-bit integers as meta data. More... | |
virtual void | writeMeta (const char *key, const float *value, int count) |
Write an array of signed 32-bit floats as meta data. More... | |
virtual void | writeMeta (const char *key, const double *value, int count) |
Write an array of signed 32-bit doubles as meta data. More... | |
virtual void | writeMeta (PtexMetaData *data) |
Copy meta data from an existing meta data block. More... | |
virtual bool | close (Ptex::String &error) |
Close the file. More... | |
virtual void | release () |
Release resources held by this pointer (pointer becomes invalid). More... | |
bool | ok (Ptex::String &error) |
void | getError (Ptex::String &error) |
Public Member Functions inherited from PtexWriter | |
virtual bool | writeFace (int faceid, const Ptex::FaceInfo &info, const void *data, int stride=0)=0 |
Write texture data for a face. More... | |
virtual bool | writeConstantFace (int faceid, const Ptex::FaceInfo &info, const void *data)=0 |
Write constant texture data for a face. More... | |
Protected Member Functions | |
DataType | datatype () const |
virtual void | finish ()=0 |
PtexWriterBase (const char *path, Ptex::MeshType mt, Ptex::DataType dt, int nchannels, int alphachan, int nfaces, bool compress) | |
virtual | ~PtexWriterBase () |
int | writeBlank (FILE *fp, int size) |
int | writeBlock (FILE *fp, const void *data, int size) |
int | writeZipBlock (FILE *fp, const void *data, int size, bool finish=true) |
int | readBlock (FILE *fp, void *data, int size) |
int | copyBlock (FILE *dst, FILE *src, FilePos pos, int size) |
Res | calcTileRes (Res faceres) |
virtual void | addMetaData (const char *key, MetaDataType t, const void *value, int size) |
void | writeConstFaceBlock (FILE *fp, const void *data, FaceDataHeader &fdh) |
void | writeFaceBlock (FILE *fp, const void *data, int stride, Res res, FaceDataHeader &fdh) |
void | writeFaceData (FILE *fp, const void *data, int stride, Res res, FaceDataHeader &fdh) |
void | writeReduction (FILE *fp, const void *data, int stride, Res res) |
int | writeMetaDataBlock (FILE *fp, MetaEntry &val) |
void | setError (const std::string &error) |
bool | storeFaceInfo (int faceid, FaceInfo &dest, const FaceInfo &src, int flags=0) |
Protected Member Functions inherited from PtexWriter | |
virtual | ~PtexWriter () |
Destructor not for public use. Use release() instead. More... | |
Protected Attributes | |
bool | _ok |
std::string | _error |
std::string | _path |
std::string | _tilepath |
FILE * | _tilefp |
Header | _header |
ExtHeader | _extheader |
int | _pixelSize |
std::vector< MetaEntry > | _metadata |
std::map< std::string, int > | _metamap |
z_stream_s | _zstream |
PtexUtils::ReduceFn * | _reduceFn |
Additional Inherited Members | |
Static Public Member Functions inherited from PtexWriter | |
static PtexWriter * | open (const char *path, Ptex::MeshType mt, Ptex::DataType dt, int nchannels, int alphachan, int nfaces, Ptex::String &error, bool genmipmaps=true) |
Open a new texture file for writing. More... | |
static PtexWriter * | edit (const char *path, bool incremental, Ptex::MeshType mt, Ptex::DataType dt, int nchannels, int alphachan, int nfaces, Ptex::String &error, bool genmipmaps=true) |
Open an existing texture file for writing. More... | |
static bool | applyEdits (const char *path, Ptex::String &error) |
Apply edits to a file. More... | |
Definition at line 50 of file PtexWriter.h.
|
protected |
Definition at line 261 of file PtexWriter.cpp.
References _extheader, _header, _pixelSize, _reduceFn, _tilefp, _tilepath, _zstream, Header::alphachan, Header::datatype, Header::extheadersize, PTEX_NAMESPACE_BEGIN::fileError(), Header::magic, Magic, Header::meshtype, Header::minorversion, Ptex::mt_triangle, Header::nchannels, Header::nfaces, Header::nlevels, PTEX_NAMESPACE_BEGIN::OpenTempFile(), Header::pixelSize(), PtexFileMajorVersion, PtexFileMinorVersion, PtexUtils::reduce(), PtexUtils::reduceTri(), setError(), and Header::version.
|
protectedvirtual |
Definition at line 310 of file PtexWriter.cpp.
References _zstream.
|
protectedvirtual |
Reimplemented in PtexMainWriter.
Definition at line 453 of file PtexWriter.cpp.
References _metadata, _metamap, PtexWriterBase::MetaEntry::data, PtexWriterBase::MetaEntry::datatype, PtexWriterBase::MetaEntry::key, and setError().
Referenced by PtexMainWriter::addMetaData(), and writeMeta().
|
protected |
Definition at line 570 of file PtexWriter.cpp.
References _pixelSize, PtexUtils::floor_log2(), PtexUtils::min(), and TileSize.
Referenced by writeFaceData().
|
virtual |
Close the file.
This operation can take some time if mipmaps are being generated or if there are many edit blocks. If an error occurs while writing, false is returned and an error string is written into the error parameter.
Implements PtexWriter.
Reimplemented in PtexIncrWriter, and PtexMainWriter.
Definition at line 316 of file PtexWriter.cpp.
References _ok, _tilefp, _tilepath, finish(), and getError().
Referenced by PtexMainWriter::close(), PtexIncrWriter::close(), and release().
|
protected |
Definition at line 551 of file PtexWriter.cpp.
References BlockSize, setError(), and writeBlock().
Referenced by PtexMainWriter::finish(), writeFaceData(), and PtexMainWriter::writeMetaData().
|
inlineprotected |
Definition at line 80 of file PtexWriter.h.
References _header, and Header::datatype.
Referenced by PtexIncrWriter::PtexIncrWriter(), PtexMainWriter::storeConstValue(), PtexMainWriter::writeFace(), PtexIncrWriter::writeFace(), writeFaceBlock(), PtexMainWriter::writeMetaData(), writeMetaDataBlock(), and writeReduction().
|
protectedpure virtual |
Implemented in PtexIncrWriter, and PtexMainWriter.
Referenced by close().
|
inline |
|
inline |
Definition at line 71 of file PtexWriter.h.
References _ok, and getError().
Referenced by PtexWriter::edit(), and PtexWriter::open().
|
protected |
Definition at line 541 of file PtexWriter.cpp.
References setError().
Referenced by PtexMainWriter::generateReductions().
|
virtual |
Release resources held by this pointer (pointer becomes invalid).
Implements PtexWriter.
Definition at line 301 of file PtexWriter.cpp.
References _tilefp, Ptex::String::c_str(), and close().
Referenced by PtexWriter::edit(), and PtexWriter::open().
|
inlinevirtual |
Set border modes.
Implements PtexWriter.
Definition at line 52 of file PtexWriter.h.
References _extheader, ExtHeader::ubordermode, and ExtHeader::vbordermode.
Referenced by PtexMainWriter::PtexMainWriter().
|
inlinevirtual |
Set edge filter mode.
Implements PtexWriter.
Definition at line 57 of file PtexWriter.h.
References _extheader, and ExtHeader::edgefiltermode.
Referenced by PtexMainWriter::PtexMainWriter().
|
inlineprotected |
Definition at line 110 of file PtexWriter.h.
Referenced by addMetaData(), copyBlock(), PtexMainWriter::finish(), PtexIncrWriter::PtexIncrWriter(), PtexMainWriter::PtexMainWriter(), PtexWriterBase(), readBlock(), storeFaceInfo(), writeBlock(), and writeZipBlock().
|
protected |
Definition at line 329 of file PtexWriter.cpp.
References _header, Header::meshtype, Ptex::mt_triangle, Header::nfaces, and setError().
Referenced by PtexMainWriter::writeConstantFace(), PtexIncrWriter::writeConstantFace(), PtexMainWriter::writeFace(), and PtexIncrWriter::writeFace().
|
protected |
Definition at line 487 of file PtexWriter.cpp.
References _ok, BlockSize, and writeBlock().
Referenced by PtexMainWriter::finish(), PtexIncrWriter::writeFace(), PtexMainWriter::writeMetaData(), and PtexIncrWriter::writeMetaDataEdit().
|
protected |
Definition at line 499 of file PtexWriter.cpp.
References _ok, and setError().
Referenced by copyBlock(), PtexMainWriter::finish(), writeBlank(), PtexIncrWriter::writeConstantFace(), writeConstFaceBlock(), PtexIncrWriter::writeFace(), writeFaceData(), PtexIncrWriter::writeMetaDataEdit(), writeReduction(), and writeZipBlock().
|
protected |
Definition at line 592 of file PtexWriter.cpp.
References _pixelSize, enc_constant, FaceDataHeader::set(), and writeBlock().
Referenced by writeFaceData().
|
protected |
Definition at line 602 of file PtexWriter.cpp.
References _header, _pixelSize, AllocaMax, Ptex::DataSize(), datatype(), PtexUtils::deinterleave(), Ptex::dt_uint16, Ptex::dt_uint8, enc_diffzipped, enc_zipped, PtexUtils::encodeDifference(), Header::nchannels, FaceDataHeader::set(), and writeZipBlock().
Referenced by writeFaceData().
|
protected |
Definition at line 629 of file PtexWriter.cpp.
References _pixelSize, _tilefp, FaceDataHeader::blocksize(), calcTileRes(), copyBlock(), enc_tiled, PtexUtils::isConstant(), FaceDataHeader::set(), writeBlock(), writeConstFaceBlock(), writeFaceBlock(), and writeZipBlock().
Referenced by PtexMainWriter::generateReductions(), PtexMainWriter::writeFace(), and PtexIncrWriter::writeFace().
|
virtual |
Write a string as meta data.
Both the key and string params must be null-terminated strings.
Implements PtexWriter.
Definition at line 361 of file PtexWriter.cpp.
References addMetaData(), and Ptex::mdt_string.
Referenced by PtexMainWriter::PtexMainWriter(), and writeMeta().
|
virtual |
Write an array of signed 32-bit doubles as meta data.
The key must be a null-terminated string.
Implements PtexWriter.
Definition at line 391 of file PtexWriter.cpp.
References addMetaData(), and Ptex::mdt_double.
|
virtual |
Write an array of signed 32-bit floats as meta data.
The key must be a null-terminated string.
Implements PtexWriter.
Definition at line 385 of file PtexWriter.cpp.
References addMetaData(), and Ptex::mdt_float.
|
virtual |
Write an array of signed 16-bit integers as meta data.
The key must be a null-terminated string.
Implements PtexWriter.
Definition at line 373 of file PtexWriter.cpp.
References addMetaData(), and Ptex::mdt_int16.
|
virtual |
Write an array of signed 32-bit integers as meta data.
The key must be a null-terminated string.
Implements PtexWriter.
Definition at line 379 of file PtexWriter.cpp.
References addMetaData(), and Ptex::mdt_int32.
|
virtual |
Write an array of signed 8-bit integers as meta data.
The key must be a null-terminated string.
Implements PtexWriter.
Definition at line 367 of file PtexWriter.cpp.
References addMetaData(), and Ptex::mdt_int8.
|
virtual |
Copy meta data from an existing meta data block.
Implements PtexWriter.
Definition at line 397 of file PtexWriter.cpp.
References PtexMetaData::getKey(), PtexMetaData::getValue(), Ptex::mdt_double, Ptex::mdt_float, Ptex::mdt_int16, Ptex::mdt_int32, Ptex::mdt_int8, Ptex::mdt_string, PtexMetaData::numKeys(), and writeMeta().
|
protected |
Definition at line 707 of file PtexWriter.cpp.
References PtexWriterBase::MetaEntry::data, datatype(), PtexWriterBase::MetaEntry::datatype, PtexWriterBase::MetaEntry::key, and writeZipBlock().
Referenced by PtexMainWriter::writeMetaData(), and PtexIncrWriter::writeMetaDataEdit().
|
protected |
Definition at line 690 of file PtexWriter.cpp.
References _header, _pixelSize, _reduceFn, AllocaMax, datatype(), Header::nchannels, Ptex::Res::size(), Ptex::Res::u(), and writeBlock().
Referenced by PtexMainWriter::generateReductions(), and PtexMainWriter::writeFace().
|
protected |
Definition at line 510 of file PtexWriter.cpp.
References _ok, _zstream, BlockSize, setError(), and writeBlock().
Referenced by PtexMainWriter::finish(), writeFaceBlock(), writeFaceData(), PtexMainWriter::writeMetaData(), writeMetaDataBlock(), and PtexIncrWriter::writeMetaDataEdit().
|
protected |
Definition at line 114 of file PtexWriter.h.
Referenced by getError(), and setError().
|
protected |
Definition at line 119 of file PtexWriter.h.
Referenced by PtexMainWriter::finish(), PtexIncrWriter::finish(), PtexMainWriter::flagConstantNeighorhoods(), PtexIncrWriter::PtexIncrWriter(), PtexWriterBase(), setBorderModes(), setEdgeFilterMode(), and PtexMainWriter::writeMetaData().
|
protected |
Definition at line 118 of file PtexWriter.h.
Referenced by datatype(), PtexMainWriter::finish(), PtexIncrWriter::finish(), PtexMainWriter::flagConstantNeighorhoods(), PtexMainWriter::generateReductions(), PtexIncrWriter::PtexIncrWriter(), PtexWriterBase(), PtexMainWriter::storeConstValue(), storeFaceInfo(), PtexMainWriter::writeFace(), PtexIncrWriter::writeFace(), writeFaceBlock(), PtexMainWriter::writeMetaData(), and writeReduction().
|
protected |
Definition at line 121 of file PtexWriter.h.
Referenced by addMetaData(), PtexMainWriter::finish(), PtexIncrWriter::finish(), PtexMainWriter::writeMetaData(), and PtexIncrWriter::writeMetaDataEdit().
|
protected |
Definition at line 122 of file PtexWriter.h.
Referenced by addMetaData().
|
protected |
Definition at line 113 of file PtexWriter.h.
Referenced by close(), PtexMainWriter::generateReductions(), ok(), setError(), writeBlank(), writeBlock(), PtexMainWriter::writeConstantFace(), PtexMainWriter::writeFace(), and writeZipBlock().
|
protected |
Definition at line 115 of file PtexWriter.h.
Referenced by PtexMainWriter::close(), and getError().
|
protected |
Definition at line 120 of file PtexWriter.h.
Referenced by calcTileRes(), PtexMainWriter::finish(), PtexMainWriter::flagConstantNeighorhoods(), PtexMainWriter::generateReductions(), PtexMainWriter::PtexMainWriter(), PtexWriterBase(), PtexMainWriter::storeConstValue(), PtexMainWriter::writeConstantFace(), PtexIncrWriter::writeConstantFace(), writeConstFaceBlock(), PtexMainWriter::writeFace(), PtexIncrWriter::writeFace(), writeFaceBlock(), writeFaceData(), and writeReduction().
|
protected |
Definition at line 125 of file PtexWriter.h.
Referenced by PtexWriterBase(), and writeReduction().
|
protected |
Definition at line 117 of file PtexWriter.h.
Referenced by close(), PtexWriterBase(), release(), and writeFaceData().
|
protected |
Definition at line 116 of file PtexWriter.h.
Referenced by close(), and PtexWriterBase().
|
protected |
Definition at line 123 of file PtexWriter.h.
Referenced by PtexWriterBase(), writeZipBlock(), and ~PtexWriterBase().