Panda3D

Macros | Enumerations | Functions | Variables
texture.cxx File Reference

PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University. More...

`#include "pandabase.h"`
`#include "texture.h"`
`#include "config_gobj.h"`
`#include "config_putil.h"`
`#include "texturePool.h"`
`#include "textureContext.h"`
`#include "bamCache.h"`
`#include "bamCacheRecord.h"`
`#include "datagram.h"`
`#include "datagramIterator.h"`
`#include "bamReader.h"`
`#include "bamWriter.h"`
`#include "string_utils.h"`
`#include "preparedGraphicsObjects.h"`
`#include "pnmImage.h"`
`#include "pnmReader.h"`
`#include "pfmFile.h"`
`#include "virtualFileSystem.h"`
`#include "datagramInputFile.h"`
`#include "datagramOutputFile.h"`
`#include "bam.h"`
`#include "zStream.h"`
`#include "indent.h"`
`#include "cmath.h"`
`#include "pStatTimer.h"`
`#include "pbitops.h"`
`#include "streamReader.h"`
`#include "texturePeeker.h"`
`#include "convert_srgb.h"`
`#include <stddef.h>`

Go to the source code of this file.

## Macros
#define | DDPF_ALPHAPIXELS 0x00000001
#define | DDPF_FOURCC 0x00000004
#define | DDPF_INDEXED 0x00000020
#define | DDPF_RGB 0x00000040
#define | DDS_MAGIC 0x20534444
#define | DDSCAPS2_CUBEMAP 0x00000200
#define | DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800
#define | DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000
#define | DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000
#define | DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400
#define | DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000
#define | DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000
#define | DDSCAPS2_VOLUME 0x00200000
#define | DDSCAPS_COMPLEX 0x00000008
#define | DDSCAPS_MIPMAP 0x00400000
#define | DDSCAPS_TEXTURE 0x00001000
#define | DDSD_CAPS 0x00000001
#define | DDSD_DEPTH 0x00800000
#define | DDSD_HEIGHT 0x00000002
#define | DDSD_LINEARSIZE 0x00080000
#define | DDSD_MIPMAPCOUNT 0x00020000
#define | DDSD_PITCH 0x00000008
#define | DDSD_PIXELFORMAT 0x00001000
#define | DDSD_WIDTH 0x00000004

## Enumerations
enum | KTXCompressedFormat { KTX_COMPRESSED_LUMINANCE_ALPHA_LATC2 = 0x8C72 , KTX_COMPRESSED_LUMINANCE_LATC1 = 0x8C70 , KTX_COMPRESSED_R11_EAC = 0x9270 , KTX_COMPRESSED_RED = 0x8225 , KTX_COMPRESSED_RED_RGTC1 = 0x8DBB , KTX_COMPRESSED_RG = 0x8226 , KTX_COMPRESSED_RG11_EAC = 0x9272 , KTX_COMPRESSED_RG_RGTC2 = 0x8DBD , KTX_COMPRESSED_RGB = 0x84ED , KTX_COMPRESSED_RGB8_ETC2 = 0x9274 , KTX_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276 , KTX_COMPRESSED_RGB_BPTC_SIGNED_FLOAT = 0x8E8E , KTX_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT = 0x8E8F , KTX_COMPRESSED_RGB_FXT1_3DFX = 0x86B0 , KTX_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01 , KTX_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00 , KTX_COMPRESSED_RGB_S3TC_DXT1 = 0x83F0 , KTX_COMPRESSED_RGBA = 0x84EE , KTX_COMPRESSED_RGBA8_ETC2_EAC = 0x9278 , KTX_COMPRESSED_RGBA_BPTC_UNORM = 0x8E8C , KTX_COMPRESSED_RGBA_FXT1_3DFX = 0x86B1 , KTX_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03 , KTX_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG = 0x9137 , KTX_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02 , KTX_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG = 0x9138 , KTX_COMPRESSED_RGBA_S3TC_DXT1 = 0x83F1 , KTX_COMPRESSED_RGBA_S3TC_DXT3 = 0x83F2 , KTX_COMPRESSED_RGBA_S3TC_DXT5 = 0x83F3 , KTX_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2 = 0x8C73 , KTX_COMPRESSED_SIGNED_LUMINANCE_LATC1 = 0x8C71 , KTX_COMPRESSED_SIGNED_R11_EAC = 0x9271 , KTX_COMPRESSED_SIGNED_RED_RGTC1 = 0x8DBC , KTX_COMPRESSED_SIGNED_RG11_EAC = 0x9273 , KTX_COMPRESSED_SIGNED_RG_RGTC2 = 0x8DBE , KTX_COMPRESSED_SLUMINANCE = 0x8C4A , KTX_COMPRESSED_SLUMINANCE_ALPHA = 0x8C4B , KTX_COMPRESSED_SRGB = 0x8C48 , KTX_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279 , KTX_COMPRESSED_SRGB8_ETC2 = 0x9275 , KTX_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277 , KTX_COMPRESSED_SRGB_ALPHA = 0x8C49 , KTX_COMPRESSED_SRGB_ALPHA_BPTC_UNORM = 0x8E8D , KTX_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1 = 0x8A56 , KTX_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2 = 0x93F0 , KTX_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1 = 0x8A57 , KTX_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2 = 0x93F1 , KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT1 = 0x8C4D , KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT3 = 0x8C4E , KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT5 = 0x8C4F , KTX_COMPRESSED_SRGB_PVRTC_2BPPV1 = 0x8A54 , KTX_COMPRESSED_SRGB_PVRTC_4BPPV1 = 0x8A55 , KTX_COMPRESSED_SRGB_S3TC_DXT1 = 0x8C4C , KTX_ETC1_RGB8 = 0x8D64 , KTX_ETC1_SRGB8 = 0x88EE }
enum | KTXFormat { KTX_ALPHA = 0x1906 , KTX_ALPHA12 = 0x803D , KTX_ALPHA16 = 0x803E , KTX_ALPHA16_SNORM = 0x9018 , KTX_ALPHA4 = 0x803B , KTX_ALPHA8 = 0x803C , KTX_ALPHA8_SNORM = 0x9014 , KTX_ALPHA_SNORM = 0x9010 , KTX_BGR = 0x80E0 , KTX_BGR_INTEGER = 0x8D9A , KTX_BGRA = 0x80E1 , KTX_BGRA_INTEGER = 0x8D9B , KTX_BLUE = 0x1905 , KTX_BLUE_INTEGER = 0x8D96 , KTX_COLOR_INDEX = 0x1900 , KTX_DEPTH24_STENCIL8 = 0x88F0 , KTX_DEPTH32F_STENCIL8 = 0x8CAD , KTX_DEPTH_COMPONENT = 0x1902 , KTX_DEPTH_COMPONENT16 = 0x81A5 , KTX_DEPTH_COMPONENT24 = 0x81A6 , KTX_DEPTH_COMPONENT32 = 0x81A7 , KTX_DEPTH_COMPONENT32F = 0x8CAC , KTX_DEPTH_STENCIL = 0x84F9 , KTX_GREEN = 0x1904 , KTX_GREEN_INTEGER = 0x8D95 , KTX_INTENSITY = 0x8049 , KTX_INTENSITY12 = 0x804C , KTX_INTENSITY16 = 0x804D , KTX_INTENSITY16_SNORM = 0x901B , KTX_INTENSITY4 = 0x804A , KTX_INTENSITY8 = 0x804B , KTX_INTENSITY8_SNORM = 0x9017 , KTX_INTENSITY_SNORM = 0x9013 , KTX_LUMINANCE = 0x1909 , KTX_LUMINANCE12 = 0x8041 , KTX_LUMINANCE12_ALPHA12 = 0x8047 , KTX_LUMINANCE12_ALPHA4 = 0x8046 , KTX_LUMINANCE16 = 0x8042 , KTX_LUMINANCE16_ALPHA16 = 0x8048 , KTX_LUMINANCE16_ALPHA16_SNORM = 0x901A , KTX_LUMINANCE16_SNORM = 0x9019 , KTX_LUMINANCE4 = 0x803F , KTX_LUMINANCE4_ALPHA4 = 0x8043 , KTX_LUMINANCE6_ALPHA2 = 0x8044 , KTX_LUMINANCE8 = 0x8040 , KTX_LUMINANCE8_ALPHA8 = 0x8045 , KTX_LUMINANCE8_ALPHA8_SNORM = 0x9016 , KTX_LUMINANCE8_SNORM = 0x9015 , KTX_LUMINANCE_ALPHA = 0x190A , KTX_LUMINANCE_ALPHA_SNORM = 0x9012 , KTX_LUMINANCE_SNORM = 0x9011 , KTX_R11F_G11F_B10F = 0x8C3A , KTX_R16 = 0x822A , KTX_R16_SNORM = 0x8F98 , KTX_R16F = 0x822D , KTX_R16I = 0x8233 , KTX_R16UI = 0x8234 , KTX_R32F = 0x822E , KTX_R32I = 0x8235 , KTX_R32UI = 0x8236 , KTX_R3_G3_B2 = 0x2A10 , KTX_R8 = 0x8229 , KTX_R8_SNORM = 0x8F94 , KTX_R8I = 0x8231 , KTX_R8UI = 0x8232 , KTX_RED = 0x1903 , KTX_RED_INTEGER = 0x8D94 , KTX_RED_SNORM = 0x8F90 , KTX_RG = 0x8227 , KTX_RG16 = 0x822C , KTX_RG16_SNORM = 0x8F99 , KTX_RG16F = 0x822F , KTX_RG16I = 0x8239 , KTX_RG16UI = 0x823A , KTX_RG32F = 0x8230 , KTX_RG32I = 0x823B , KTX_RG32UI = 0x823C , KTX_RG8 = 0x822B , KTX_RG8_SNORM = 0x8F95 , KTX_RG8I = 0x8237 , KTX_RG8UI = 0x8238 , KTX_RG_INTEGER = 0x8228 , KTX_RG_SNORM = 0x8F91 , KTX_RGB = 0x1907 , KTX_RGB10 = 0x8052 , KTX_RGB10_A2 = 0x8059 , KTX_RGB12 = 0x8053 , KTX_RGB16 = 0x8054 , KTX_RGB16_SNORM = 0x8F9A , KTX_RGB16F = 0x881B , KTX_RGB16I = 0x8D89 , KTX_RGB16UI = 0x8D77 , KTX_RGB2 = 0x804E , KTX_RGB32F = 0x8815 , KTX_RGB32I = 0x8D83 , KTX_RGB32UI = 0x8D71 , KTX_RGB4 = 0x804F , KTX_RGB5 = 0x8050 , KTX_RGB5_A1 = 0x8057 , KTX_RGB8 = 0x8051 , KTX_RGB8_SNORM = 0x8F96 , KTX_RGB8I = 0x8D8F , KTX_RGB8UI = 0x8D7D , KTX_RGB9_E5 = 0x8C3D , KTX_RGB_INTEGER = 0x8D98 , KTX_RGB_SNORM = 0x8F92 , KTX_RGBA = 0x1908 , KTX_RGBA12 = 0x805A , KTX_RGBA16 = 0x805B , KTX_RGBA16_SNORM = 0x8F9B , KTX_RGBA16F = 0x881A , KTX_RGBA16I = 0x8D88 , KTX_RGBA16UI = 0x8D76 , KTX_RGBA2 = 0x8055 , KTX_RGBA32F = 0x8814 , KTX_RGBA32I = 0x8D82 , KTX_RGBA32UI = 0x8D70 , KTX_RGBA4 = 0x8056 , KTX_RGBA8 = 0x8058 , KTX_RGBA8_SNORM = 0x8F97 , KTX_RGBA8I = 0x8D8E , KTX_RGBA8UI = 0x8D7C , KTX_RGBA_INTEGER = 0x8D99 , KTX_RGBA_SNORM = 0x8F93 , KTX_SLUMINANCE = 0x8C46 , KTX_SLUMINANCE8 = 0x8C47 , KTX_SLUMINANCE8_ALPHA8 = 0x8C45 , KTX_SLUMINANCE_ALPHA = 0x8C44 , KTX_SRGB = 0x8C40 , KTX_SRGB8 = 0x8C41 , KTX_SRGB8_ALPHA8 = 0x8C43 , KTX_SRGB_ALPHA = 0x8C42 , KTX_STENCIL_INDEX = 0x1901 , KTX_STENCIL_INDEX1 = 0x8D46 , KTX_STENCIL_INDEX16 = 0x8D49 , KTX_STENCIL_INDEX4 = 0x8D47 , KTX_STENCIL_INDEX8 = 0x8D48 }
enum | KTXType { KTX_BYTE = 0x1400 , KTX_UNSIGNED_BYTE = 0x1401 , KTX_SHORT = 0x1402 , KTX_UNSIGNED_SHORT = 0x1403 , KTX_INT = 0x1404 , KTX_UNSIGNED_INT = 0x1405 , KTX_FLOAT = 0x1406 , KTX_HALF_FLOAT = 0x140B , KTX_UNSIGNED_BYTE_3_3_2 = 0x8032 , KTX_UNSIGNED_SHORT_4_4_4_4 = 0x8033 , KTX_UNSIGNED_SHORT_5_5_5_1 = 0x8034 , KTX_UNSIGNED_INT_8_8_8_8 = 0x8035 , KTX_UNSIGNED_INT_10_10_10_2 = 0x8036 , KTX_UNSIGNED_BYTE_2_3_3_REV = 0x8362 , KTX_UNSIGNED_SHORT_5_6_5 = 0x8363 , KTX_UNSIGNED_SHORT_5_6_5_REV = 0x8364 , KTX_UNSIGNED_SHORT_4_4_4_4_REV = 0x8365 , KTX_UNSIGNED_SHORT_1_5_5_5_REV = 0x8366 , KTX_UNSIGNED_INT_8_8_8_8_REV = 0x8367 , KTX_UNSIGNED_INT_2_10_10_10_REV = 0x8368 , KTX_UNSIGNED_INT_24_8 = 0x84FA , KTX_UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B , KTX_UNSIGNED_INT_5_9_9_9_REV = 0x8C3E , KTX_FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD }

## Functions
ostream & | operator<< (ostream &out, Texture::ComponentType ct)
ostream & | operator<< (ostream &out, Texture::CompressionMode cm)
ostream & | operator<< (ostream &out, Texture::Format f)
ostream & | operator<< (ostream &out, Texture::QualityLevel tql)
ostream & | operator<< (ostream &out, Texture::TextureType tt)
istream & | operator>> (istream &in, Texture::QualityLevel &tql)
| PT (AsyncFuture) Texture
| Indicates that the texture should be enqueued to be prepared in the indicated prepared_objects at the beginning of the next frame. More...
| PT (Texture) Texture
| Constructs a new Texture object from the txo file. More...
| PT (TexturePeeker) Texture
| Returns a TexturePeeker object that can be used to examine the individual texels stored within this Texture by (u, v) coordinate. More...

## Variables
ConfigVariableEnum< Texture::QualityLevel > | texture_quality_level ("texture-quality-level", Texture::QL_normal, PRC_DESC("This specifies a global quality level for all textures. You " "may specify either fastest, normal, or best. This actually " "affects the meaning of Texture::set_quality_level(QL_default), " "so it may be overridden on a per-texture basis. This generally " "only has an effect when using the tinydisplay software renderer; " "it has little or no effect on normal, hardware-accelerated " "renderers. See Texture::set_quality_level()."))

## Detailed Description

PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.

All rights reserved.

All use of this software is subject to the terms of the revised BSD license. You should have received a copy of this license along with this source code in a file named "LICENSE."

Author
  mike

Date
  1997-01-09

Author
  fperazzi, PandaSE

Date
  2010-04-29

Definition in file texture.cxx.

## Function Documentation

## ◆ PT() [1/3]

PT | ( | AsyncFuture |  | ) |

Indicates that the texture should be enqueued to be prepared in the indicated prepared_objects at the beginning of the next frame.

This will ensure the texture is already loaded into texture memory if it is expected to be rendered soon.

Use this function instead of prepare_now() to preload textures from a user interface standpoint.

Definition at line 1434 of file texture.cxx.

## ◆ PT() [2/3]

PT | ( | Texture |  | ) |

Constructs a new Texture object from the txo file.

The internal implementation of operator =().

A factory function to make a new Texture, used to pass to the TexturePool.

This is similar to Texture::read_txo(), but it constructs and returns a new object, which allows it to return a subclass of Texture (for instance, a movie texture).

Pass a real filename if it is available, or empty string if it is not.

Assumes the lock is already held on both Textures.

Definition at line 859 of file texture.cxx.

References DatagramInputFile::open(), and DatagramInputFile::read_header().

## ◆ PT() [3/3]

PT | ( | TexturePeeker |  | ) |

Returns a TexturePeeker object that can be used to examine the individual texels stored within this Texture by (u, v) coordinate.

If the texture has a ram image resident, that image is used. If it does not have a full ram image but does have a simple_ram_image resident, that image is used instead. If neither image is resident the full image is reloaded.

Returns NULL if the texture cannot find an image to load, or the texture format is incompatible.

Definition at line 1413 of file texture.cxx.