|
Ptex
|
#include <PtexWriter.h>
Classes | |
| struct | MetaEntry |
| struct | FaceRec |
Public Member Functions | |
| PtexMainWriter (const char *path, PtexTexture *tex, Ptex::MeshType mt, Ptex::DataType dt, int nchannels, int alphachan, int nfaces, bool genmipmaps) | |
| virtual void | release () |
| Release resources held by this pointer (pointer becomes invalid). | |
| virtual bool | close (Ptex::String &error) |
| Close the file. | |
| virtual bool | writeFace (int faceid, const FaceInfo &f, const void *data, int stride) |
| virtual bool | writeConstantFace (int faceid, const FaceInfo &f, const void *data) |
| virtual void | setBorderModes (Ptex::BorderMode uBorderMode, Ptex::BorderMode vBorderMode) |
| Set border modes. | |
| virtual void | setEdgeFilterMode (Ptex::EdgeFilterMode edgeFilterMode) |
| Set edge filter mode. | |
| virtual void | writeMeta (const char *key, const char *value) |
| Write a string as meta data. | |
| virtual void | writeMeta (const char *key, const int8_t *value, int count) |
| Write an array of signed 8-bit integers as meta data. | |
| virtual void | writeMeta (const char *key, const int16_t *value, int count) |
| Write an array of signed 16-bit integers as meta data. | |
| virtual void | writeMeta (const char *key, const int32_t *value, int count) |
| Write an array of signed 32-bit integers as meta data. | |
| virtual void | writeMeta (const char *key, const float *value, int count) |
| Write an array of signed 32-bit floats as meta data. | |
| virtual void | writeMeta (const char *key, const double *value, int count) |
| Write an array of signed 32-bit doubles as meta data. | |
| virtual void | writeMeta (PtexMetaData *data) |
| Copy meta data from an existing meta data block. | |
| 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. | |
| virtual bool | writeConstantFace (int faceid, const Ptex::FaceInfo &info, const void *data)=0 |
| Write constant texture data for a face. | |
Private Member Functions | |
| virtual | ~PtexMainWriter () |
| DataType | datatype () const |
| size_t | writeBlock (FILE *fp, const void *data, size_t size) |
| size_t | writeBlock (FILE *fp, const std::vector< std::byte > &dataBlock) |
| void | addToDataBlock (std::vector< std::byte > &dataBlock, const void *data, size_t size) |
| libdeflate_compressor * | getCompressor () |
| void | releaseCompressor (libdeflate_compressor *compressor) |
| void | compressDataBlock (libdeflate_compressor *compressor, std::vector< std::byte > &compressedData, const void *data, size_t size) |
| Res | calcTileRes (Res faceres) |
| void | addMetaData (const char *key, MetaDataType t, const void *value, int size) |
| void | compressFaceDataBlock (libdeflate_compressor *compressor, std::vector< std::byte > &compressedData, FaceDataHeader &fdh, Res res, const void *uncompressedData, int stride) |
| void | compressFaceData (libdeflate_compressor *compressor, std::vector< std::byte > &compressedData, FaceDataHeader &fdh, Res res, const void *uncompressedData) |
| void | addToMetaDataBlock (std::vector< std::byte > &dataBlock, const MetaEntry &val) |
| void | setError (const std::string &error) |
| bool | storeFaceInfo (int faceid, FaceInfo &dest, const FaceInfo &src, int flags=0) |
| void | finish () |
| void | flagConstantNeighorhoods () |
| void | storeConstValue (int faceid, const void *data, int stride, Res res) |
Private Attributes | |
| bool | _ok |
| std::string | _error |
| std::string | _path |
| Header | _header |
| ExtHeader | _extheader |
| int | _pixelSize |
| std::vector< MetaEntry > | _metadata |
| std::map< std::string, int > | _metamap |
| std::vector< libdeflate_compressor * > | _compressors |
| Mutex | _compressorMutex |
| PtexUtils::ReduceFn * | _reduceFn |
| std::string | _newpath |
| bool | _genmipmaps |
| std::vector< FaceInfo > | _faceinfo |
| std::vector< std::byte > | _constdata |
| std::vector< uint32_t > | _rfaceids |
| std::vector< uint32_t > | _faceids_r |
| std::vector< FaceRec > | _faces |
| PtexReader * | _reader |
Static Private Attributes | |
| static const int | MinReductionLog2 =2 |
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. | |
| static PtexWriter * | edit (const char *path, 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. | |
| 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. | |
| static bool | applyEdits (const char *path, Ptex::String &error) |
| Obsolete (returns true). | |
| Protected Member Functions inherited from PtexWriter | |
| virtual | ~PtexWriter () |
| Destructor not for public use. Use release() instead. | |
Definition at line 51 of file PtexWriter.h.
| PtexMainWriter::PtexMainWriter | ( | const char * | path, |
| PtexTexture * | tex, | ||
| Ptex::MeshType | mt, | ||
| Ptex::DataType | dt, | ||
| int | nchannels, | ||
| int | alphachan, | ||
| int | nfaces, | ||
| bool | genmipmaps ) |
Definition at line 528 of file PtexWriter.cpp.
References _constdata, _extheader, _faceinfo, _faces, _genmipmaps, _header, _newpath, _ok, _path, _pixelSize, _reader, _reduceFn, PtexTexture::edgeFilterMode(), Magic, PtexFileMajorVersion, PtexFileMinorVersion, PtexUtils::reduce(), PtexUtils::reduceTri(), setBorderModes(), setEdgeFilterMode(), PtexTexture::uBorderMode(), PtexTexture::vBorderMode(), and writeMeta().
|
privatevirtual |
Definition at line 582 of file PtexWriter.cpp.
References _compressors, and _reader.
|
private |
Definition at line 316 of file PtexWriter.cpp.
References _metadata, _metamap, PtexMainWriter::MetaEntry::data, PtexMainWriter::MetaEntry::datatype, PtexMainWriter::MetaEntry::key, and setError().
Referenced by writeMeta(), writeMeta(), writeMeta(), writeMeta(), writeMeta(), and writeMeta().
|
private |
Definition at line 361 of file PtexWriter.cpp.
Referenced by addToMetaDataBlock(), compressFaceData(), and finish().
|
private |
Definition at line 515 of file PtexWriter.cpp.
References addToDataBlock(), PtexMainWriter::MetaEntry::data, datatype(), PtexMainWriter::MetaEntry::datatype, and PtexMainWriter::MetaEntry::key.
Referenced by finish().
|
private |
Definition at line 402 of file PtexWriter.cpp.
References _pixelSize, PtexUtils::floor_log2(), Ptex::Res::size64(), and TileSize.
Referenced by compressFaceData().
|
virtual |
Close the file.
This operation can take some time if mipmaps are being generated. If an error occurs while writing, false is returned and an error string is written into the error parameter.
Implements PtexWriter.
Definition at line 591 of file PtexWriter.cpp.
References _newpath, _ok, _path, _reader, finish(), getError(), and setError().
Referenced by release().
|
private |
Definition at line 391 of file PtexWriter.cpp.
References setError().
Referenced by compressFaceData(), compressFaceDataBlock(), and finish().
|
private |
Definition at line 450 of file PtexWriter.cpp.
References _pixelSize, addToDataBlock(), calcTileRes(), compressDataBlock(), compressFaceDataBlock(), enc_constant, enc_tiled, PtexUtils::isConstant(), and FaceDataHeader::set().
Referenced by writeFace().
|
private |
Definition at line 424 of file PtexWriter.cpp.
References _header, _pixelSize, compressDataBlock(), datatype(), PtexUtils::deinterleave(), enc_diffzipped, enc_zipped, PtexUtils::encodeDifference(), and FaceDataHeader::set().
Referenced by compressFaceData().
|
inlineprivate |
Definition at line 90 of file PtexWriter.h.
References _header.
Referenced by addToMetaDataBlock(), compressFaceDataBlock(), finish(), storeConstValue(), and writeFace().
|
private |
Definition at line 721 of file PtexWriter.cpp.
References _constdata, _extheader, _faceids_r, _faceinfo, _faces, _genmipmaps, _header, _metadata, _newpath, _pixelSize, _reader, _rfaceids, addToDataBlock(), addToMetaDataBlock(), compressDataBlock(), PtexMainWriter::MetaEntry::data, datatype(), PtexMainWriter::MetaEntry::datatype, ExtHeaderSize, PtexMainWriter::FaceRec::faceData, PtexMainWriter::FaceRec::fdh, flagConstantNeighorhoods(), PtexUtils::genRfaceids(), getCompressor(), HeaderSize, Ptex::FaceInfo::isConstant(), PtexMainWriter::MetaEntry::key, LevelInfoSize, MetaDataThreshold, MinReductionLog2, releaseCompressor(), Ptex::FaceInfo::res, setError(), Ptex::Res::size64(), storeFaceInfo(), Ptex::Res::ulog2, Ptex::Res::vlog2, writeBlock(), and writeFace().
Referenced by close().
|
private |
Definition at line 939 of file PtexWriter.cpp.
References _constdata, _extheader, _faceinfo, _header, _pixelSize, and Ptex::m_clamp.
Referenced by finish().
|
private |
Definition at line 369 of file PtexWriter.cpp.
References _compressorMutex, and _compressors.
Referenced by finish(), and writeFace().
|
inline |
|
inline |
Definition at line 79 of file PtexWriter.h.
References _ok, and getError().
Referenced by PtexWriter::edit(), and PtexWriter::open().
|
virtual |
Release resources held by this pointer (pointer becomes invalid).
Implements PtexWriter.
Definition at line 182 of file PtexWriter.cpp.
References Ptex::String::c_str(), and close().
Referenced by PtexWriter::edit(), and PtexWriter::open().
|
private |
Definition at line 384 of file PtexWriter.cpp.
References _compressorMutex, and _compressors.
Referenced by finish(), and writeFace().
|
inlinevirtual |
Set border modes.
Implements PtexWriter.
Definition at line 62 of file PtexWriter.h.
References _extheader.
Referenced by PtexMainWriter().
|
inlinevirtual |
Set edge filter mode.
Implements PtexWriter.
Definition at line 67 of file PtexWriter.h.
References _extheader.
Referenced by PtexMainWriter().
|
inlineprivate |
Definition at line 112 of file PtexWriter.h.
Referenced by addMetaData(), close(), compressDataBlock(), finish(), storeFaceInfo(), and writeBlock().
|
private |
Definition at line 709 of file PtexWriter.cpp.
References _constdata, _header, _pixelSize, PtexUtils::average(), datatype(), and PtexUtils::divalpha().
Referenced by writeFace().
|
private |
Definition at line 192 of file PtexWriter.cpp.
References _header, and setError().
Referenced by finish(), writeConstantFace(), and writeFace().
|
inlineprivate |
|
private |
Definition at line 350 of file PtexWriter.cpp.
References _ok, and setError().
Referenced by finish().
|
virtual |
Definition at line 695 of file PtexWriter.cpp.
References _constdata, _faceinfo, _ok, _pixelSize, and storeFaceInfo().
Referenced by writeFace().
|
virtual |
Definition at line 613 of file PtexWriter.cpp.
References _faceinfo, _faces, _genmipmaps, _header, _ok, _pixelSize, _reduceFn, compressFaceData(), PtexUtils::copy(), datatype(), PtexMainWriter::FaceRec::faceData, PtexMainWriter::FaceRec::fdh, getCompressor(), PtexUtils::isConstant(), MinReductionLog2, PtexUtils::multalpha(), PtexMainWriter::FaceRec::mutex, releaseCompressor(), Ptex::Res::size64(), storeConstValue(), storeFaceInfo(), Ptex::Res::u(), Ptex::Res::ulog2, Ptex::Res::v(), Ptex::Res::vlog2, and writeConstantFace().
Referenced by finish().
|
virtual |
Write a string as meta data.
Both the key and string params must be null-terminated strings.
Implements PtexWriter.
Definition at line 224 of file PtexWriter.cpp.
References addMetaData().
Referenced by 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 254 of file PtexWriter.cpp.
References addMetaData().
|
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 248 of file PtexWriter.cpp.
References addMetaData().
|
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 236 of file PtexWriter.cpp.
References addMetaData().
|
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 242 of file PtexWriter.cpp.
References addMetaData().
|
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 230 of file PtexWriter.cpp.
References addMetaData().
|
virtual |
Copy meta data from an existing meta data block.
Implements PtexWriter.
Definition at line 260 of file PtexWriter.cpp.
References PtexMetaData::getKey(), PtexMetaData::getValue(), PtexMetaData::numKeys(), and writeMeta().
|
private |
Definition at line 128 of file PtexWriter.h.
Referenced by getCompressor(), and releaseCompressor().
|
private |
Definition at line 127 of file PtexWriter.h.
Referenced by getCompressor(), releaseCompressor(), and ~PtexMainWriter().
|
private |
Definition at line 135 of file PtexWriter.h.
Referenced by finish(), flagConstantNeighorhoods(), PtexMainWriter(), storeConstValue(), and writeConstantFace().
|
private |
Definition at line 119 of file PtexWriter.h.
Referenced by getError(), and setError().
|
private |
Definition at line 122 of file PtexWriter.h.
Referenced by finish(), flagConstantNeighorhoods(), PtexMainWriter(), setBorderModes(), and setEdgeFilterMode().
|
private |
Definition at line 137 of file PtexWriter.h.
Referenced by finish().
|
private |
Definition at line 134 of file PtexWriter.h.
Referenced by finish(), flagConstantNeighorhoods(), PtexMainWriter(), writeConstantFace(), and writeFace().
|
private |
Definition at line 145 of file PtexWriter.h.
Referenced by finish(), PtexMainWriter(), and writeFace().
|
private |
Definition at line 133 of file PtexWriter.h.
Referenced by finish(), PtexMainWriter(), and writeFace().
|
private |
Definition at line 121 of file PtexWriter.h.
Referenced by compressFaceDataBlock(), datatype(), finish(), flagConstantNeighorhoods(), PtexMainWriter(), storeConstValue(), storeFaceInfo(), and writeFace().
|
private |
Definition at line 124 of file PtexWriter.h.
Referenced by addMetaData(), and finish().
|
private |
Definition at line 125 of file PtexWriter.h.
Referenced by addMetaData().
|
private |
Definition at line 132 of file PtexWriter.h.
Referenced by close(), finish(), and PtexMainWriter().
|
private |
Definition at line 118 of file PtexWriter.h.
Referenced by close(), ok(), PtexMainWriter(), setError(), writeBlock(), writeConstantFace(), and writeFace().
|
private |
Definition at line 120 of file PtexWriter.h.
Referenced by close(), getError(), and PtexMainWriter().
|
private |
Definition at line 123 of file PtexWriter.h.
Referenced by calcTileRes(), compressFaceData(), compressFaceDataBlock(), finish(), flagConstantNeighorhoods(), PtexMainWriter(), storeConstValue(), writeConstantFace(), and writeFace().
|
private |
Definition at line 147 of file PtexWriter.h.
Referenced by close(), finish(), PtexMainWriter(), and ~PtexMainWriter().
|
private |
Definition at line 130 of file PtexWriter.h.
Referenced by PtexMainWriter(), and writeFace().
|
private |
Definition at line 136 of file PtexWriter.h.
Referenced by finish().
|
staticprivate |
Definition at line 139 of file PtexWriter.h.
Referenced by finish(), and writeFace().