Ptex

Public Member Functions | Protected Member Functions | Private Attributes | List of all members
PtexIncrWriter Class Reference

`#include <PtexWriter.h>`

Inheritance diagram for PtexIncrWriter:

## Public Member Functions
| PtexIncrWriter (const char *path, FILE *fp, Ptex::MeshType mt, Ptex::DataType dt, int nchannels, int alphachan, int nfaces)
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)
Public Member Functions inherited from PtexWriterBase
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.
virtual void | release ()
| Release resources held by this pointer (pointer becomes invalid).
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.

## Protected Member Functions
void | writeMetaDataEdit ()
virtual void | finish ()
virtual | ~PtexIncrWriter ()
Protected Member Functions inherited from PtexWriterBase
DataType | datatype () const
| 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.

## Private Attributes
FILE * | _fp

## 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, 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)
| Apply edits to a file.
Protected Attributes inherited from PtexWriterBase
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

## Detailed Description

Definition at line 181 of file PtexWriter.h.

## Constructor & Destructor Documentation

## ◆ PtexIncrWriter()

PtexIncrWriter::PtexIncrWriter | ( | const char * | path,
|  | FILE * | fp,
|  | Ptex::MeshType | mt,
|  | Ptex::DataType | dt,
|  | int | nchannels,
|  | int | alphachan,
|  | int | nfaces
| ) |  |

Definition at line 1217 of file PtexWriter.cpp.

References PtexWriterBase::_extheader, _fp, PtexWriterBase::_header, Header::alphachan, PtexWriterBase::datatype(), Header::extheadersize, ExtHeaderSize, HeaderSize, Header::magic, Magic, Header::meshtype, PtexUtils::min(), Header::nchannels, Header::nfaces, and PtexWriterBase::setError().

## ◆ ~PtexIncrWriter()

PtexIncrWriter::~PtexIncrWriter | ( |  | ) |
| protected virtual

Definition at line 1265 of file PtexWriter.cpp.

## Member Function Documentation

## ◆ close()

bool PtexIncrWriter::close | ( | Ptex::String & | error | ) |
| 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.

Reimplemented from PtexWriterBase.

Definition at line 1395 of file PtexWriter.cpp.

References _fp, and PtexWriterBase::close().

## ◆ finish()

void PtexIncrWriter::finish | ( |  | ) |
| protected virtual

Implements PtexWriterBase.

Definition at line 1407 of file PtexWriter.cpp.

References PtexWriterBase::_extheader, _fp, PtexWriterBase::_header, PtexWriterBase::_metadata, ExtHeader::editdatapos, ExtHeader::editdatasize, Header::extheadersize, ExtHeaderSize, HeaderSize, PtexUtils::min(), and writeMetaDataEdit().

## ◆ writeConstantFace()

bool PtexIncrWriter::writeConstantFace | ( | int | faceid,
|  | const FaceInfo & | f,
|  | const void * | data
| ) |  |
| virtual

Definition at line 1338 of file PtexWriter.cpp.

References _fp, PtexWriterBase::_pixelSize, enc_constant, et_editfacedata, EditFaceDataHeader::faceid, EditFaceDataHeader::faceinfo, EditFaceDataHeader::fdh, FaceDataHeader::set(), PtexWriterBase::storeFaceInfo(), and PtexWriterBase::writeBlock().

Referenced by writeFace().

## ◆ writeFace()

bool PtexIncrWriter::writeFace | ( | int | faceid,
|  | const FaceInfo & | f,
|  | const void * | data,
|  | int | stride
| ) |  |
| virtual

Definition at line 1270 of file PtexWriter.cpp.

References _fp, PtexWriterBase::_header, PtexWriterBase::_pixelSize, Header::alphachan, PtexUtils::average(), FaceDataHeader::blocksize(), PtexUtils::copy(), PtexWriterBase::datatype(), PtexUtils::divalpha(), et_editfacedata, EditFaceDataHeader::faceid, EditFaceDataHeader::faceinfo, EditFaceDataHeader::fdh, Header::hasAlpha(), PtexUtils::isConstant(), PtexUtils::multalpha(), Header::nchannels, PtexWriterBase::storeFaceInfo(), PtexWriterBase::writeBlank(), PtexWriterBase::writeBlock(), writeConstantFace(), and PtexWriterBase::writeFaceData().

## ◆ writeMetaDataEdit()

void PtexIncrWriter::writeMetaDataEdit | ( |  | ) |
| protected

Definition at line 1362 of file PtexWriter.cpp.

References _fp, PtexWriterBase::_metadata, et_editmetadata, EditMetaDataHeader::metadatamemsize, EditMetaDataHeader::metadatazipsize, PtexWriterBase::writeBlank(), PtexWriterBase::writeBlock(), PtexWriterBase::writeMetaDataBlock(), and PtexWriterBase::writeZipBlock().

Referenced by finish().

## Member Data Documentation

## ◆ _fp

FILE* PtexIncrWriter::_fp
| private

Definition at line 197 of file PtexWriter.h.

Referenced by close(), finish(), PtexIncrWriter(), writeConstantFace(), writeFace(), and writeMetaDataEdit().

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

- PtexWriter.h
- PtexWriter.cpp