Ptex: PtexTexture Class Reference

Ptex

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

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:

## Public Member Functions
virtual void | release ()=0
| Release resources held by this pointer (pointer becomes invalid). More...
virtual const char * | path ()=0
| Path that file was opened with. More...
virtual Ptex::MeshType | meshType ()=0
| Type of mesh for which texture data is defined. More...
virtual Ptex::DataType | dataType ()=0
| Type of data stored in file. More...
virtual Ptex::BorderMode | uBorderMode ()=0
| Mode for filtering texture access beyond mesh border. More...
virtual Ptex::BorderMode | vBorderMode ()=0
| Mode for filtering texture access beyond mesh border. More...
virtual int | alphaChannel ()=0
| Index of alpha channel (if any). More...
virtual int | numChannels ()=0
| Number of channels stored in file. More...
virtual int | numFaces ()=0
| Number of faces stored in file. More...
virtual bool | hasEdits ()=0
| True if the file has edit blocks. More...
virtual bool | hasMipMaps ()=0
| True if the file has mipmaps. More...
virtual PtexMetaData * | getMetaData ()=0
| Access meta data. More...
virtual const Ptex::FaceInfo & | getFaceInfo (int faceid)=0
| Access resolution and adjacency information about a face. More...
virtual void | getData (int faceid, void *buffer, int stride)=0
| Access texture data for a face at highest-resolution. More...
virtual void | getData (int faceid, void *buffer, int stride, Ptex::Res res)=0
| Access texture data for a face at a specific resolution. More...
virtual PtexFaceData * | getData (int faceid)=0
| Access texture data for a face at highest-resolution as stored on disk. More...
virtual PtexFaceData * | getData (int faceid, Ptex::Res res)=0
| Access texture data for a face at a specific resolution as stored on disk. More...
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 . More...
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. More...

## Static Public Member Functions
static PtexTexture * | open (const char *path, Ptex::String &error, bool premultiply=0)
| Open a ptex file for reading. More...

## Protected Member Functions
virtual | ~PtexTexture ()
| Destructor not for public use. Use release() instead. More...

## 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 439 of file Ptexture.h.

## Constructor & Destructor Documentation

virtual PtexTexture::~PtexTexture | ( |  | ) |
| inlineprotectedvirtual

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

Definition at line 442 of file Ptexture.h.

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

Implemented in PtexReader.

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

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

Type of data stored in file.

Implemented in PtexReader.

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

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)

Implemented in PtexReader.

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

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.

Implemented in PtexReader.

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

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

Implemented in PtexReader.

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.

Implemented in PtexReader.

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

Access resolution and adjacency information about a face.

Implemented in PtexReader.

Referenced by PtexTriangleFilter::applyAcrossEdge(), PtexSeparableFilter::applyAcrossEdge(), PtexSeparableFilter::applyToCorner(), PtexSeparableFilter::eval(), and PtexTriangleFilter::eval().

virtual PtexMetaData* PtexTexture::getMetaData | ( |  | ) |
| pure virtual

Access meta data.

Implemented in PtexReader.

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.

Implemented in PtexReader.

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.

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().

virtual bool PtexTexture::hasMipMaps | ( |  | ) |
| pure virtual

True if the file has mipmaps.

See PtexWriter for more details.

Implemented in PtexReader.

Referenced by PtexWriter::applyEdits().

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().

virtual int PtexTexture::numChannels | ( |  | ) |
| pure virtual

Number of channels stored in file.

Implemented in PtexReader.

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

virtual int PtexTexture::numFaces | ( |  | ) |
| pure virtual

Number of faces stored in file.

Implemented in PtexReader.

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

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 the a 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 46 of file PtexReader.cpp.

References PtexCache::create(), PtexCache::get(), PtexCache::purgeAll(), and PtexReader::setOwnsCache().

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

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.

virtual void PtexTexture::release | ( |  | ) |
| pure virtual

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

Implemented in PtexReader.

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

Mode for filtering texture access beyond mesh border.

Implemented in PtexReader.

Referenced by PtexMainWriter::PtexMainWriter().

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:

- Ptexture.h
- PtexReader.cpp