PtexTexture Class Reference

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

#include <Ptexture.h>

List of all members.

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 PTEXAPI 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.


Member Function Documentation

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.

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

Type of data stored in file.

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

Mode for filtering textures across edges.

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.

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

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

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.

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:
faceid Face index [0..numFaces-1]
buffer User-supplied buffer
stride Size of each row in user buffer (in bytes)
virtual const Ptex::FaceInfo& PtexTexture::getFaceInfo ( int  faceid  )  [pure virtual]

Access resolution and adjacency information about a face.

virtual PtexMetaData* PtexTexture::getMetaData (  )  [pure virtual]

Access meta data.

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.

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:
faceid Face index [0..numFaces-1]
u U coordinate [0..ures-1]
v V coordinate [0..vres-1]
result Result data
firstchan First channel to access [0..numChannels-1]
nchannels Number of channels to access.
virtual bool PtexTexture::hasEdits (  )  [pure virtual]

True if the file has edit blocks.

See PtexWriter for more details.

virtual bool PtexTexture::hasMipMaps (  )  [pure virtual]

True if the file has mipmaps.

See PtexWriter for more details.

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

Type of mesh for which texture data is defined.

virtual int PtexTexture::numChannels (  )  [pure virtual]

Number of channels stored in file.

virtual int PtexTexture::numFaces (  )  [pure virtual]

Number of faces stored in file.

static PTEXAPI 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.

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.

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

Mode for filtering texture access beyond mesh border.

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

Mode for filtering texture access beyond mesh border.


Generated on 14 Dec 2015 for Ptex by  doxygen 1.6.1