SbTVizTexture Class Reference
[TerrainViz]

TerrainViz Texture class. More...

#include <TerrainViz/SbTVizTexture.h>

List of all members.

Public Types

enum  FileType {
  UNKNOWN,
  RGB,
  SGI,
  TIFF,
  GIF,
  JPEG,
  BMP,
  PNG,
  NUM_FILETYPES
}

Public Member Functions

 SbTVizTexture ()
virtual ~SbTVizTexture ()
SbBool loadTextureFile (const char *fileName, int level, const SbVec2s &position, const SbVec2s &borders=SbVec2s(0, 0))
const SbStringgetFileName () const
int getLevel () const
const SbVec2sgetPosition () const
const SbVec2sgetSize () const
int getNumComponents () const
const SbVec2sgetBorders () const
void setValues (const SbVec2s &size, int nc, int level, const SbVec2s &position, const SbVec2s &borders, const unsigned char *bytes)
const unsigned char * getValues (SbVec2s &size, int &nc) const
SbBool writeTextureFile (const SbString &filename)
void setBitmapFileType (FileType in_type)
FileType getBitmapFileType (void)

Detailed Description

TerrainViz Texture class.

This class loads and stores a texture file. It also handles the attributes of the texture to fit the texture quadtree.

Each texture is characterized by its level in the the texture list quadtree, its position in this level, the number of color components, and its pixel size.

This texture is to be used with an SbTVizTextureList instance.

See SbTVizTextureList for more details on texture levels and positions.

By default the level is 0 and the position is (0,0).

If the texture image's width or height is not a power of 2, or the image's width or height is greater than the maximum supported by OpenGL, then the image will be automatically scaled up or down to the next power of 2 or the maximum texture size. For maximum speed, point-sampling is used to do the scale; if you want more accurate resampling, pre-filter images to a power of 2 smaller than the maximum texture size (use the OpenGL glGetIntegerv(GL_MAX_TEXTURE_SIZE...) call to determine the maximum texture size for a specific OpenGL implementation).

The following file formats are supported: SGI RGB, GIF, JPEG, PNG, TIFF, and (Windows only) BMP.

When data are specified from a file (loadTextureFile), there is no buffer copy remaining after the data are sent to OpenGL. When data are specified from a buffer (setValues), this buffer is kept in memory, because it can be called by writeTextureFile. If you use large image buffers, it is recommended to save these on disk (writeTextureFile) and then reload (loadTextureFile) to avoid memory overload.

SEE ALSO

SbTVizData, SbTVizRegularGridData, SbTVizTextureList, SoTViz, SoTVizRender

Deprecated:

Deprecated since Open Inventor 9500
No longer supported.

Member Enumeration Documentation

DEPRECATED : useless.

It has no effect.

Enumerator:
UNKNOWN 
RGB 
SGI 
TIFF 
GIF 
JPEG 
BMP 
PNG 
NUM_FILETYPES 

Constructor & Destructor Documentation

SbTVizTexture::SbTVizTexture (  ) 

Constructor.

virtual SbTVizTexture::~SbTVizTexture (  )  [virtual]

Destructor.


Member Function Documentation

FileType SbTVizTexture::getBitmapFileType ( void   )  [inline]

DEPRECATED : useless.

It has no effect.

const SbVec2s& SbTVizTexture::getBorders (  )  const [inline]

Returns the X and Y borders (the number of pixels overlap) used for texture continuity.

The X and Y borders are specified using loadTextureFile or in the XML file itself.

const SbString& SbTVizTexture::getFileName ( void   )  const [inline]

Returns the file name.

Returns an empty string if setValues was used to specify the texture data.

int SbTVizTexture::getLevel (  )  const [inline]

Returns the level of the texture in the texture quadtree.

int SbTVizTexture::getNumComponents (  )  const [inline]

Returns the number of color components.

const SbVec2s& SbTVizTexture::getPosition ( void   )  const [inline]

Returns the position of the texture in the level.

const SbVec2s& SbTVizTexture::getSize ( void   )  const [inline]

Returns the texture size in pixels.

const unsigned char* SbTVizTexture::getValues ( SbVec2s size,
int &  nc 
) const

Returns the pixel values, the number of components, and the size of the texture.

The pixels in the image are returned as an array of unsigned chars. The size and nc arguments are filled in with the dimensions of the image and the number of components in the image; the number of bytes in the array returned will be size [0]* size [1]* nc .

SbBool SbTVizTexture::loadTextureFile ( const char *  fileName,
int  level,
const SbVec2s position,
const SbVec2s borders = SbVec2s(0, 0) 
)

Sets the attributes and loads the texture file.

void SbTVizTexture::setBitmapFileType ( FileType  in_type  )  [inline]

DEPRECATED : useless.

It has no effect.

void SbTVizTexture::setValues ( const SbVec2s size,
int  nc,
int  level,
const SbVec2s position,
const SbVec2s borders,
const unsigned char *  bytes 
)

Sets the pixel values, the number of components, and the size of the texture.

Sets also the other necessary attributs position, level and borders (number of pixel overlap). See SoSFImage for information on how the pixel values should be stored in the array. Remember that the buffer is kept in memory after the data is sent to OpenGL (see class description).

SbBool SbTVizTexture::writeTextureFile ( const SbString filename  ) 

Saves the texture buffer as a PNG file.


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

Open Inventor by FEI reference manual, generated on 19 Aug 2019
Copyright © FEI S.A.S. All rights reserved.
http://www.openinventor.com/