Ptex
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
PtexTexture Class Referenceabstract

Interface for reading data from a ptex file. More...

#include <Ptexture.h>

Inheritance diagram for PtexTexture:
PtexReader PtexCachedReader

Classes

struct  Info
 Get most commonly used info in a single call for convenience / efficiency. More...
 

Public Member Functions

virtual void release ()=0
 Release resources held by this pointer (pointer becomes invalid).
 
virtual const char * path ()=0
 Path that file was opened with.
 
virtual Info getInfo ()=0
 
virtual Ptex::MeshType meshType ()=0
 Type of mesh for which texture data is defined.
 
virtual Ptex::DataType dataType ()=0
 Type of data stored in file.
 
virtual Ptex::BorderMode uBorderMode ()=0
 Mode for filtering texture access beyond mesh border.
 
virtual Ptex::BorderMode vBorderMode ()=0
 Mode for filtering texture access beyond mesh border.
 
virtual Ptex::EdgeFilterMode edgeFilterMode ()=0
 Mode for filtering textures across edges.
 
virtual int alphaChannel ()=0
 Index of alpha channel (if any).
 
virtual int numChannels ()=0
 Number of channels stored in file.
 
virtual int numFaces ()=0
 Number of faces stored in file.
 
virtual bool hasEdits ()=0
 True if the file has edit blocks.
 
virtual bool hasMipMaps ()=0
 True if the file has mipmaps.
 
virtual PtexMetaDatagetMetaData ()=0
 Access meta data.
 
virtual const Ptex::FaceInfogetFaceInfo (int faceid)=0
 Access resolution and adjacency information about a face.
 
virtual void getData (int faceid, void *buffer, int stride)=0
 Access texture data for a face at highest-resolution.
 
virtual void getData (int faceid, void *buffer, int stride, Ptex::Res res)=0
 Access texture data for a face at a specific resolution.
 
virtual PtexFaceDatagetData (int faceid)=0
 Access texture data for a face at highest-resolution as stored on disk.
 
virtual PtexFaceDatagetData (int faceid, Ptex::Res res)=0
 Access texture data for a face at a specific resolution as stored on disk.
 
virtual void getPixel (int faceid, int u, int v, float *result, int firstchan, int nchannels)=0
 Access a single texel from the highest resolution texture .
 
virtual void getPixel (int faceid, int u, int v, float *result, int firstchan, int nchannels, Ptex::Res res)=0
 Access a single texel for a face at a particular resolution.
 

Static Public Member Functions

static PtexTextureopen (const char *path, Ptex::String &error, bool premultiply=0)
 Open a ptex file for reading.
 

Protected Member Functions

virtual ~PtexTexture ()
 Destructor not for public use. Use release() instead.
 

Detailed Description

Interface for reading data from a ptex file.

PtexTexture instances can be acquired via the static open() method, or via the PtexCache interface.

Data access through this interface is returned in v-major order with all data channels interleaved per texel.

Definition at line 457 of file Ptexture.h.

Constructor & Destructor Documentation

◆ ~PtexTexture()

virtual PtexTexture::~PtexTexture ( )
inlineprotectedvirtual

Destructor not for public use. Use release() instead.

Definition at line 460 of file Ptexture.h.

Member Function Documentation

◆ alphaChannel()

virtual int PtexTexture::alphaChannel ( )
pure virtual

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.

Implemented in PtexReader.

Referenced by PtexWriter::applyEdits(), and PtexWriter::edit().

◆ dataType()

virtual Ptex::DataType PtexTexture::dataType ( )
pure virtual

Type of data stored in file.

Implemented in PtexReader.

Referenced by PtexWriter::applyEdits(), PtexWriter::edit(), and PtexTriangleFilter::eval().

◆ edgeFilterMode()

virtual Ptex::EdgeFilterMode PtexTexture::edgeFilterMode ( )
pure virtual

Mode for filtering textures across edges.

Implemented in PtexReader.

Referenced by PtexMainWriter::PtexMainWriter().

◆ getData() [1/4]

virtual PtexFaceData * PtexTexture::getData ( int  faceid)
pure virtual

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

Implemented in PtexReader.

◆ getData() [2/4]

virtual PtexFaceData * PtexTexture::getData ( int  faceid,
Ptex::Res  res 
)
pure 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.

◆ getData() [3/4]

virtual void PtexTexture::getData ( int  faceid,
void *  buffer,
int  stride 
)
pure 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
faceidFace index [0..numFaces-1]
bufferUser-supplied buffer
strideSize of each row in user buffer (in bytes)

Implemented in PtexReader.

Referenced by PtexSeparableFilter::apply(), PtexTriangleFilter::apply(), PtexSeparableFilter::eval(), and PtexTriangleFilter::eval().

◆ getData() [4/4]

virtual void PtexTexture::getData ( int  faceid,
void *  buffer,
int  stride,
Ptex::Res  res 
)
pure 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.

◆ getFaceInfo()

virtual const Ptex::FaceInfo & PtexTexture::getFaceInfo ( int  faceid)
pure virtual

◆ getInfo()

virtual Info PtexTexture::getInfo ( )
pure virtual

Implemented in PtexReader.

◆ getMetaData()

virtual PtexMetaData * PtexTexture::getMetaData ( )
pure virtual

Access meta data.

Implemented in PtexReader.

◆ getPixel() [1/2]

virtual void PtexTexture::getPixel ( int  faceid,
int  u,
int  v,
float *  result,
int  firstchan,
int  nchannels 
)
pure 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
faceidFace index [0..numFaces-1]
uU coordinate [0..ures-1]
vV coordinate [0..vres-1]
resultResult data
firstchanFirst channel to access [0..numChannels-1]
nchannelsNumber of channels to access.

Implemented in PtexReader.

Referenced by PtexPointFilter::eval(), and PtexPointFilterTri::eval().

◆ getPixel() [2/2]

virtual void PtexTexture::getPixel ( int  faceid,
int  u,
int  v,
float *  result,
int  firstchan,
int  nchannels,
Ptex::Res  res 
)
pure 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.

Implemented in PtexReader.

◆ hasEdits()

virtual bool PtexTexture::hasEdits ( )
pure virtual

True if the file has edit blocks.

See PtexWriter for more details.

Implemented in PtexReader.

Referenced by PtexWriter::applyEdits().

◆ hasMipMaps()

virtual bool PtexTexture::hasMipMaps ( )
pure virtual

True if the file has mipmaps.

See PtexWriter for more details.

Implemented in PtexReader.

Referenced by PtexWriter::applyEdits().

◆ meshType()

virtual Ptex::MeshType PtexTexture::meshType ( )
pure virtual

Type of mesh for which texture data is defined.

Implemented in PtexReader.

Referenced by PtexWriter::applyEdits(), PtexWriter::edit(), and PtexFilter::getFilter().

◆ numChannels()

virtual int PtexTexture::numChannels ( )
pure virtual

Number of channels stored in file.

Implemented in PtexReader.

Referenced by PtexWriter::applyEdits(), PtexWriter::edit(), and PtexTriangleFilter::eval().

◆ numFaces()

virtual int PtexTexture::numFaces ( )
pure virtual

◆ open()

PTEX_NAMESPACE_BEGIN PtexTexture * PtexTexture::open ( const char *  path,
Ptex::String error,
bool  premultiply = 0 
)
static

Open a ptex file for reading.

If an error occurs, an error message will be stored in the error string param and a null pointer will be returned.

If the premultiply param is set to true and the texture file has a specified alpha channel, then all data stored in the file will be multiplied by alpha when read from disk. If premultiply is false, then the full-resolution textures will be returned as stored on disk which is assumed to be unmultiplied. Reductions (both stored mip-maps and dynamically generated reductions) are always premultiplied with alpha. See PtexWriter for more information about alpha channels.

Definition at line 59 of file PtexReader.cpp.

References PtexReader::open(), path(), and PtexReader::release().

Referenced by PtexWriter::applyEdits(), and PtexWriter::edit().

◆ path()

virtual const char * PtexTexture::path ( )
pure virtual

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.

Implemented in PtexReader.

Referenced by open().

◆ release()

virtual void PtexTexture::release ( )
pure virtual

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

Implemented in PtexCachedReader, and PtexReader.

◆ uBorderMode()

virtual Ptex::BorderMode PtexTexture::uBorderMode ( )
pure virtual

Mode for filtering texture access beyond mesh border.

Implemented in PtexReader.

Referenced by PtexMainWriter::PtexMainWriter().

◆ vBorderMode()

virtual Ptex::BorderMode PtexTexture::vBorderMode ( )
pure virtual

Mode for filtering texture access beyond mesh border.

Implemented in PtexReader.

Referenced by PtexMainWriter::PtexMainWriter().


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