# VideoTexture

from pandac.PandaModules import VideoTexture

Class : VideoTexture
Description : The base class for a family of animated Textures that take their input from a video source, such as a movie file. These Textures may be stopped, started, etc. using the AnimInterface controls, similar to an animated character.

## Inheritance:

VideoTexture: Texture AnimInterface
Texture: TypedWritableReferenceCount Namable
TypedWritableReferenceCount: TypedWritable ReferenceCount
TypedWritable: TypedObject
TypedObject: MemoryBase
MemoryBase:
ReferenceCount: MemoryBase
Namable:
AnimInterface:

## Methods of VideoTexture:

getClassType
getKeepRamImage
getTexScale
getVideoHeight
getVideoWidth
hasRamImage

## Methods of Texture:

clear
clearAlphaFilename
clearAlphaFullpath
clearAuxData
clearFilename
clearFullpath
clearRamImage
clearRamMipmapImage
clearRamMipmapImages
estimateTextureMemory
generateAlphaScaleMap
generateNormalizationCubeMap
generateRamMipmapImages
getAlphaFilename
getAlphaFullpath
getAnisotropicDegree
getAuxData
getBorderColor
getClassType
getComponentType
getComponentWidth
getCompression
getExpectedMipmapXSize
getExpectedMipmapYSize
getExpectedMipmapZSize
getExpectedNumMipmapLevels
getExpectedRamImageSize
getExpectedRamMipmapImageSize
getExpectedRamMipmapPageSize
getExpectedRamPageSize
getFilename
getFormat
getFullpath
getImageModified
getKeepRamImage
getLoadedFromImage
getLoadedFromTxo
getMagfilter
getMatchFramebufferFormat
getMinfilter
getNumComponents
getNumRamMipmapImages
getPropertiesModified
getRamImage
getRamImageCompression
getRamImageSize
getRamMipmapImage
getRamMipmapImageSize
getRamMipmapPageSize
getRamPageSize
getRenderToTexture
getTextureType
getWrapU
getWrapV
getWrapW
getXSize
getYSize
getZSize
hasAllRamMipmapImages
hasAlphaFilename
hasAlphaFullpath
hasFilename
hasFullpath
hasRamImage
hasRamMipmapImage
isMipmap
isPrepared
load
loadRelated
makeCopy
makeRamImage
makeRamMipmapImage
mightHaveRamImage
modifyRamImage
modifyRamMipmapImage
prepare
prepareNow
read
readTxo
release
releaseAll
reload
setAlphaFilename
setAlphaFullpath
setAnisotropicDegree
setAuxData
setBorderColor
setComponentType
setCompression
setFilename
setFormat
setFullpath
setKeepRamImage
setLoadedFromImage
setLoadedFromTxo
setMagfilter
setMatchFramebufferFormat
setMinfilter
setRamImage
setRamMipmapImage
setRenderToTexture
setup1dTexture
setup2dTexture
setup3dTexture
setupCubeMap
setupTexture
setWrapU
setWrapV
setWrapW
setXSize
setYSize
setZSize
store
usesMipmaps
write
writeTxo

## Methods of TypedWritableReferenceCount:

getClassType

## Methods of TypedWritable:

getClassType

## Methods of TypedObject:

getClassType
getType
getTypeIndex
isExactType
isOfType

## Methods of ReferenceCount:

getClassType
getRefCount
ref
testRefCountIntegrity
testRefCountNonzero
unref

## Methods of Namable:

clearName
getClassType
getName
hasName
operator =
output
setName

## Methods of AnimInterface:

getClassType
getFrac
getFrame
getFrameRate
getFullFframe
getFullFrame
getNextFrame
getNumFrames
getPlayRate
isPlaying
loop
output
pingpong
play
pose
setPlayRate
stop

## Constants in Texture:

TT1dTexture | (TextureType)
TT2dTexture | (TextureType)
TT3dTexture | (TextureType)
TTCubeMap | (TextureType)
TUnsignedByte | (ComponentType)
TUnsignedShort | (ComponentType)
TFloat | (ComponentType)
FDepthStencil | (Format)
FDepthComponent | (Format)
FColorIndex | (Format)
FRed | (Format)
FGreen | (Format)
FBlue | (Format)
FAlpha | (Format)
FRgb | (Format)
FRgb5 | (Format)
FRgb8 | (Format)
FRgb12 | (Format)
FRgb332 | (Format)
FRgba | (Format)
FRgbm | (Format)
FRgba4 | (Format)
FRgba5 | (Format)
FRgba8 | (Format)
FRgba12 | (Format)
FLuminance | (Format)
FLuminanceAlpha | (Format)
FLuminanceAlphamask | (Format)
FRgba16 | (Format)
FRgba32 | (Format)
FTNearest | (FilterType)
FTLinear | (FilterType)
FTNearestMipmapNearest | (FilterType)
FTLinearMipmapNearest | (FilterType)
FTNearestMipmapLinear | (FilterType)
FTLinearMipmapLinear | (FilterType)
FTShadow | (FilterType)
FTDefault | (FilterType)
FTInvalid | (FilterType)
WMClamp | (WrapMode)
WMRepeat | (WrapMode)
WMMirror | (WrapMode)
WMMirrorOnce | (WrapMode)
WMBorderColor | (WrapMode)
WMInvalid | (WrapMode)
CMDefault | (CompressionMode)
CMOff | (CompressionMode)
CMOn | (CompressionMode)
CMFxt1 | (CompressionMode)
CMDxt1 | (CompressionMode)
CMDxt2 | (CompressionMode)
CMDxt3 | (CompressionMode)
CMDxt4 | (CompressionMode)
CMDxt5 | (CompressionMode)

getClassType static TypeHandle VideoTexture::get_class_type(void); Undocumented function.

getKeepRamImage virtual bool VideoTexture::get_keep_ram_image(void) const; Description: Returns the flag that indicates whether this Texture is eligible to have its main RAM copy of the texture memory dumped when the texture is prepared for rendering. See set_keep_ram_image().

getTexScale LVecBase2f VideoTexture::get_tex_scale(void) const; Description: Returns a scale pair that is suitable for applying to geometry via NodePath::set_tex_scale(), which will convert texture coordinates on the geometry from the range 0..1 into the appropriate range to render the video part of the texture. This is necessary in the event the video source is not a power of two and set_power_2() is true. In this case, the video image will be mapped to the lower-left corner of the texture, and the rest of the texture space will be unused; so we will need to remap any texture coordinates to fill the space correctly.

getVideoHeight int VideoTexture::get_video_height(void) const; Description: Returns the height in texels of the source video stream. This is not necessarily the height of the actual texture, since the texture may have been expanded to raise it to a power of 2.

getVideoWidth int VideoTexture::get_video_width(void) const; Filename: videoTexture.I Created by: drose (21Sep05) PANDA 3D SOFTWARE Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved All use of this software is subject to the terms of the Panda 3d Software license. You should have received a copy of this license along with this source code; you will also find a current copy of the license at http://etc.cmu.edu/panda3d/docs/license/ . To contact the maintainers of this program write to panda3d-general@lists.sourceforge.net . Description: Returns the width in texels of the source video stream. This is not necessarily the width of the actual texture, since the texture may have been expanded to raise it to a power of 2.

hasRamImage virtual bool VideoTexture::has_ram_image(void) const; Description: Returns true if the Texture has its image contents available in main RAM, false if it exists only in texture memory or in the prepared GSG context.

clear virtual void Texture::clear(void); Description: Reinitializes the texture to its default, empty state.

clearAlphaFilename void Texture::clear_alpha_filename(void); Description: Removes the alpha filename, if it was previously set. See set_alpha_filename().

clearAlphaFullpath void Texture::clear_alpha_fullpath(void); Description: Removes the alpha fullpath, if it was previously set. See set_alpha_fullpath().

clearAuxData void Texture::clear_aux_data(string const &key); Description: Removes a record previously recorded via set_aux_data().

clearFilename void Texture::clear_filename(void); These are published, but in general, you shouldn't be mucking with these values; they are set automatically when a texture is loaded. Description: Removes the alpha filename, if it was previously set. See set_filename().

clearFullpath void Texture::clear_fullpath(void); Description: Removes the alpha fullpath, if it was previously set. See set_fullpath().

clearRamImage void Texture::clear_ram_image(void); Description: Discards the current system-RAM image.

clearRamMipmapImage void Texture::clear_ram_mipmap_image(int n); Description: Discards the current system-RAM image for the nth mipmap level.

clearRamMipmapImages void Texture::clear_ram_mipmap_images(void); Description: Discards the current system-RAM image for all mipmap levels, except level 0 (the base image).

estimateTextureMemory unsigned int Texture::estimate_texture_memory(void) const; Description: Estimates the amount of texture memory that will be consumed by loading this texture. This returns a value that is not specific to any particular graphics card or driver; it tries to make a reasonable assumption about how a driver will load the texture. It does not account for texture compression or anything fancy. This is mainly useful for debugging and reporting purposes. Returns a value in bytes.

generateAlphaScaleMap void Texture::generate_alpha_scale_map(void); Description: Generates a special 256x1 1-d texture that can be used to apply an arbitrary alpha scale to objects by judicious use of texture matrix. The texture is a gradient, with an alpha of 0 on the left (U = 0), and 255 on the right (U = 1).

generateNormalizationCubeMap void Texture::generate_normalization_cube_map(int size); Description: Generates a special cube map image in the texture that can be used to apply bump mapping effects: for each texel in the cube map that is indexed by the 3-d texture coordinates (x, y, z), the resulting value is the normalized vector (x, y, z) (compressed from -1..1 into 0..1).

generateRamMipmapImages void Texture::generate_ram_mipmap_images(void); Description: Automatically fills in the n mipmap levels of the Texture, based on the texture's source image. This requires the texture's ram image to be available in system memory. This call is not normally necessary, since the mipmap levels will be generated automatically if needed. But there may be certain cases in which you would like to call this explicitly.

getAlphaFilename Filename const &Texture::get_alpha_filename(void) const; Description: Returns the alpha_filename that has been set. If this is set, it represents the name of the alpha component, which is stored in a separate file. See also get_filename(), and get_alpha_fullpath().

getAlphaFullpath Filename const &Texture::get_alpha_fullpath(void) const; Description: Returns the alpha_fullpath that has been set. This is the full path to the alpha part of the image file as it was found along the texture search path.

getAnisotropicDegree int Texture::get_anisotropic_degree(void) const; Description: Returns the degree of anisotropic filtering that should be applied to the texture. Normally, this is 1, to indicate that anisotropic filtering should be disabled. If this is a number higher than 1, anisotropic filtering should be enabled (if the rendering backend supports it).

getAuxData TypedReferenceCount *Texture::get_aux_data(string const &key) const; Description: Returns a record previously recorded via set_aux_data(). Returns NULL if there was no record associated with the indicated key.

getBorderColor LVecBase4f Texture::get_border_color(void) const; Description: Returns the solid color of the texture's border. Some OpenGL implementations use a border for tiling textures; in Panda, it is only used for specifying the clamp color.

getClassType static TypeHandle Texture::get_class_type(void); Undocumented function.

getComponentType Texture::ComponentType Texture::get_component_type(void) const; Description: Returns the numeric interpretation of each component of the texture.

getComponentWidth int Texture::get_component_width(void) const; Description: Returns the number of bytes stored for each color component of a texel. Typically this is 1, but it may be 2 for 16-bit texels.

getCompression Texture::CompressionMode Texture::get_compression(void) const; Description: Returns the compression mode requested for this particular texture, or CM_off if the texture is not to be compressed. If a value other than CM_off is returned, this is not a guarantee that the texture is actually successfully compressed on the GSG. It may be that the GSG does not support the requested compression mode, in which case the texture may actually be stored uncompressed in texture memory.

getExpectedMipmapXSize int Texture::get_expected_mipmap_x_size(int n) const; Description: Returns the x_size that the nth mipmap level should have, based on the texture's size.

getExpectedMipmapYSize int Texture::get_expected_mipmap_y_size(int n) const; Description: Returns the y_size that the nth mipmap level should have, based on the texture's size.

getExpectedMipmapZSize int Texture::get_expected_mipmap_z_size(int n) const; Description: Returns the z_size that the nth mipmap level should have, based on the texture's size.

getExpectedNumMipmapLevels int Texture::get_expected_num_mipmap_levels(void) const; Description: Returns the number of mipmap levels that should be defined for this texture, given the texture's size. Note that this returns a number appropriate for mipmapping, even if the texture does not currently have mipmapping enabled.

getExpectedRamImageSize unsigned int Texture::get_expected_ram_image_size(void) const; Description: Returns the number of bytes that *ought* to be used by the in-memory image, based on the texture parameters.

getExpectedRamMipmapImageSize unsigned int Texture::get_expected_ram_mipmap_image_size(int n) const; Description: Returns the number of bytes that *ought* to be used by the in-memory image for mipmap level n, based on the texture parameters.

getExpectedRamMipmapPageSize unsigned int Texture::get_expected_ram_mipmap_page_size(int n) const; Description: Returns the number of bytes that should be used per each Z page of the 3-d texture, for mipmap level n. For a 2-d or 1-d texture, this is the same as get_expected_ram_mipmap_image_size(n).

getExpectedRamPageSize unsigned int Texture::get_expected_ram_page_size(void) const; Description: Returns the number of bytes that should be used per each Z page of the 3-d texture. For a 2-d or 1-d texture, this is the same as get_expected_ram_image_size().

getFilename Filename const &Texture::get_filename(void) const; Description: Returns the filename that has been set. This is the name of the file as it was requested. Also see get_fullpath().

getFormat Texture::Format Texture::get_format(void) const; Description: Returns the format of the texture, which represents both the semantic meaning of the texels and, to some extent, their storage information.

getFullpath Filename const &Texture::get_fullpath(void) const; Description: Returns the fullpath that has been set. This is the full path to the file as it was found along the texture search path.

getImageModified UpdateSeq Texture::get_image_modified(void) const; Description: Returns a sequence number which is guaranteed to change at least every time the texture image data (including mipmap levels) are modified.

getKeepRamImage virtual bool Texture::get_keep_ram_image(void) const; Description: Returns the flag that indicates whether this Texture is eligible to have its main RAM copy of the texture memory dumped when the texture is prepared for rendering. See set_keep_ram_image().

getLoadedFromImage bool Texture::get_loaded_from_image(void) const; Description: Returns the flag that indicates the texture has been loaded from a disk file or PNMImage. See set_loaded_from_image().

getLoadedFromTxo bool Texture::get_loaded_from_txo(void) const; Description: Returns the flag that indicates the texture has been loaded from a txo file.

getMagfilter Texture::FilterType Texture::get_magfilter(void) const; Description: Returns the filter mode of the texture for magnification. The mipmap constants are invalid here.

getMatchFramebufferFormat bool Texture::get_match_framebuffer_format(void) const; Description: Returns true if the special flag was set that indicates to the GSG that the Texture's format should be chosen to exactly match the framebuffer's format, presumably because the application intends to copy image data from the framebuffer into the Texture (or vice-versa).

getMinfilter Texture::FilterType Texture::get_minfilter(void) const; Description: Returns the filter mode of the texture for minification. If this is one of the mipmap constants, then the texture requires mipmaps.

getNumComponents int Texture::get_num_components(void) const; Description: Returns the number of color components for each texel of the texture image. This is 3 for an rgb texture or 4 for an rgba texture; it may also be 1 or 2 for a grayscale texture.

getNumRamMipmapImages int Texture::get_num_ram_mipmap_images(void) const; Description: Returns the maximum number of mipmap level images available in system memory. The actual number may be less than this; use has_ram_mipmap_image() to verify each level.

getPropertiesModified UpdateSeq Texture::get_properties_modified(void) const; Description: Returns a sequence number which is guaranteed to change at least every time the texture properties (unrelated to the image) are modified.

getRamImage ConstPointerToArray< unsigned char > Texture::get_ram_image(void); Description: Returns the system-RAM image data associated with the texture. If the texture does not currently have an associated RAM image, and the texture was generated by loading an image from a disk file (the most common case), this forces the reload of the same texture. This can happen if keep_texture_ram is configured to false, and we have previously prepared this texture with a GSG. Note that it is not correct to call has_ram_image() first to test whether this function will fail. A false return value from has_ram_image() indicates only that get_ram_image() may need to reload the texture from disk, which it will do automatically. However, you can call might_have_ram_image(), which will return true if the ram image exists, or there is a reasonable reason to believe it can be loaded. On the other hand, it is possible that the texture cannot be found on disk or is otherwise unavailable. If that happens, this function will return NULL. There is no way to predict with 100% accuracy whether get_ram_image() will return NULL without calling it first; might_have_ram_image() is the closest.

getRamImageCompression Texture::CompressionMode Texture::get_ram_image_compression(void) const; Description: Returns the compression mode in which the ram image is already stored pre-compressed. If this is other than CM_off, you cannot rely on the contents of the ram image to be anything predicatable (it will not be an array of x by y pixels, and it probably won't have the same length as get_expected_ram_image_size()).

getRamImageSize unsigned int Texture::get_ram_image_size(void) const; Description: Returns the number of bytes used by the in-memory image, or 0 if there is no in-memory image.

getRamMipmapImage ConstPointerToArray< unsigned char > Texture::get_ram_mipmap_image(int n); Description: Returns the system-RAM image data associated with the nth mipmap level, if present. Returns NULL if the nth mipmap level is not present.

getRamMipmapImageSize unsigned int Texture::get_ram_mipmap_image_size(int n) const; Description: Returns the number of bytes used by the in-memory image for mipmap level n, or 0 if there is no in-memory image for this mipmap level.

getRamMipmapPageSize unsigned int Texture::get_ram_mipmap_page_size(int n) const; Description: Returns the number of bytes used by the in-memory image per page for mipmap level n, or 0 if there is no in-memory image for this mipmap level. For a non-compressed texture, this is the same as get_expected_ram_mipmap_page_size(). For a compressed texture, this may be a smaller value. (We do assume that all pages will be the same size on a compressed texture).

getRamPageSize unsigned int Texture::get_ram_page_size(void) const; Description: Returns the number of bytes used by the in-memory image per page, or 0 if there is no in-memory image. For a non-compressed texture, this is the same as get_expected_ram_page_size(). For a compressed texture, this may be a smaller value. (We do assume that all pages will be the same size on a compressed texture).

getRenderToTexture bool Texture::get_render_to_texture(void) const; Description:

getTextureType Texture::TextureType Texture::get_texture_type(void) const; Description: Returns the overall interpretation of the texture.

getWrapU Texture::WrapMode Texture::get_wrap_u(void) const; Description: Returns the wrap mode of the texture in the U direction.

getWrapV Texture::WrapMode Texture::get_wrap_v(void) const; Description: Returns the wrap mode of the texture in the V direction.

getWrapW Texture::WrapMode Texture::get_wrap_w(void) const; Description: Returns the wrap mode of the texture in the W direction. This is the depth direction of 3-d textures.

getXSize int Texture::get_x_size(void) const; Description: Returns the width of the texture image in texels.

getYSize int Texture::get_y_size(void) const; Description: Returns the height of the texture image in texels. For a 1-d texture, this will be 1.

getZSize int Texture::get_z_size(void) const; Description: Returns the depth of the texture image in texels. For a 1-d texture or 2-d texture, this will be 1. For a cube map texture, this will be 6.

hasAllRamMipmapImages bool Texture::has_all_ram_mipmap_images(void) const; Description: Returns true if all expected mipmap levels have been defined and exist in the system RAM, or false if even one mipmap level is missing.

hasAlphaFilename bool Texture::has_alpha_filename(void) const; Description: Returns true if the alpha_filename has been set and is available. See set_alpha_filename().

hasAlphaFullpath bool Texture::has_alpha_fullpath(void) const; Description: Returns true if the alpha_fullpath has been set and is available. See set_alpha_fullpath().

hasFilename bool Texture::has_filename(void) const; Description: Returns true if the filename has been set and is available. See set_filename().

hasFullpath bool Texture::has_fullpath(void) const; Description: Returns true if the fullpath has been set and is available. See set_fullpath().

hasRamImage virtual bool Texture::has_ram_image(void) const; Description: Returns true if the Texture has its image contents available in main RAM, false if it exists only in texture memory or in the prepared GSG context. Note that this has nothing to do with whether get_ram_image() will fail or not. Even if has_ram_image() returns false, get_ram_image() may still return a valid RAM image, because get_ram_image() will automatically load the texture from disk if necessary. The only thing has_ram_image() tells you is whether the texture is available right now without hitting the disk first. Note also that if an application uses only one GSG, it may appear that has_ram_image() returns true if the texture has not yet been loaded by the GSG, but this correlation is not true in general and should not be depended on. Specifically, if an application ever uses multiple GSG's in its lifetime (for instance, by opening more than one window, or by closing its window and opening another one later), then has_ram_image() may well return false on textures that have never been loaded on the current GSG.

hasRamMipmapImage bool Texture::has_ram_mipmap_image(int n) const; Description: Returns true if the Texture has the nth mipmap level available in system memory, false otherwise. If the texture's minfilter mode requires mipmapping (see uses_mipmaps()), and all the texture's mipmap levels are not available when the texture is rendered, they will be generated automatically.

isMipmap static bool Texture::is_mipmap(Texture::FilterType type); Description: Returns true if the indicated filter type requires the use of mipmaps, or false if it does not.

isPrepared bool Texture::is_prepared(PreparedGraphicsObjects *prepared_objects) const; Description: Returns true if the texture has already been prepared or enqueued for preparation on the indicated GSG, false otherwise.

load bool Texture::load(PNMImage const &pnmimage); Description: Replaces the texture with the indicated image. Description: Stores the indicated image in the given page and mipmap level. See read().

loadRelated Texture *Texture::load_related(InternalName const *suffix) const; Description: Loads a texture whose filename is derived by concatenating a suffix to the filename of this texture. May return NULL, for example, if this texture doesn't have a filename.

makeCopy virtual PointerTo< Texture > Texture::make_copy(void); Description: Returns a new copy of the same Texture. This copy, if applied to geometry, will be copied into texture as a separate texture from the original, so it will be duplicated in texture memory (and may be independently modified if desired). If the Texture is a VideoTexture, the resulting duplicate may be animated independently of the original.

makeRamImage PointerToArray< unsigned char > Texture::make_ram_image(void); Description: Discards the current system-RAM image for the texture, if any, and allocates a new buffer of the appropriate size. Returns the new buffer. This does *not* affect keep_ram_image.

makeRamMipmapImage PointerToArray< unsigned char > Texture::make_ram_mipmap_image(int n); Description: Discards the current system-RAM image for the nth mipmap level, if any, and allocates a new buffer of the appropriate size. Returns the new buffer. This does *not* affect keep_ram_image.

mightHaveRamImage bool Texture::might_have_ram_image(void) const; Description: Returns true if the texture's image contents are currently available in main RAM, or there is reason to believe it can be loaded on demand. That is, this function returns a "best guess" as to whether get_ram_image() will succeed without actually calling it first.

modifyRamImage PointerToArray< unsigned char > Texture::modify_ram_image(void); Description: Returns a modifiable pointer to the system-RAM image. This assumes the RAM image should be uncompressed. If the RAM image has been dumped, or is stored compressed, creates a new one. This does *not* affect keep_ram_image.

modifyRamMipmapImage PointerToArray< unsigned char > Texture::modify_ram_mipmap_image(int n); Description: Returns a modifiable pointer to the system-RAM image for the nth mipmap level. This assumes the RAM image is uncompressed; if this is not the case, raises an assertion. This does *not* affect keep_ram_image.

prepare void Texture::prepare(PreparedGraphicsObjects *prepared_objects); Description: 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.

prepareNow TextureContext *Texture::prepare_now(PreparedGraphicsObjects *prepared_objects, GraphicsStateGuardianBase *gsg); Description: Creates a context for the texture on the particular GSG, if it does not already exist. Returns the new (or old) TextureContext. This assumes that the GraphicsStateGuardian is the currently active rendering context and that it is ready to accept new textures. If this is not necessarily the case, you should use prepare() instead. Normally, this is not called directly except by the GraphicsStateGuardian; a texture does not need to be explicitly prepared by the user before it may be rendered.

read bool Texture::read(Filename const &fullpath); Description: Reads the named filename into the texture. Description: Combine a 3-component image with a grayscale image to get a 4-component image. See the description of the full-parameter read() method for the meaning of the primary_file_num_channels and alpha_file_channel parameters. Description: Reads a single file into a single page or mipmap level, or automatically reads a series of files into a series of pages and/or mipmap levels. See the description of the full-parameter read() method for the meaning of the various parameters. Description: Reads the texture from the indicated filename. If primary_file_num_channels is not 0, it specifies the number of components to downgrade the image to if it is greater than this number. If the filename has the extension .txo, this implicitly reads a texture object instead of a filename (which replaces all of the texture properties). In this case, all the rest of the parameters are ignored, and the filename should not contain any hash marks; just the one named file will be read, since a single .txo file can contain all pages and mipmaps necessary to define a texture. If alpha_fullpath is not empty, it specifies the name of a file from which to retrieve the alpha. In this case, alpha_file_channel represents the numeric channel of this image file to use as the resulting texture's alpha channel; usually, this is 0 to indicate the grayscale combination of r, g, b; or it may be a one-based channel number, e.g. 1 for the red channel, 2 for the green channel, and so on. If read pages is false, then z indicates the page number into which this image will be assigned. Normally this is 0 for the first (or only) page of the texture. 3-D textures have one page for each level of depth, and cube map textures always have six pages. If read_pages is true, multiple images will be read at once, one for each page of a cube map or a 3-D texture. In this case, the filename should contain a sequence of one or more hash marks ("#") which will be filled in with the z value of each page, zero-based. In this case, the z parameter indicates the maximum z value that will be loaded, or 0 to load all filenames that exist. If read_mipmaps is false, then n indicates the mipmap level to which this image will be assigned. Normally this is 0 for the base texture image, but it is possible to load custom mipmap levels into the later images. After the base texture image is loaded (thus defining the size of the texture), you can call get_expected_num_mipmap_levels() to determine the maximum sensible value for n. If read_mipmaps is true, multiple images will be read as above, but this time the images represent the different mipmap levels of the texture image. In this case, the n parameter indicates the maximum n value that will be loaded, or 0 to load all filenames that exist (up to the expected number of mipmap levels). If both read_pages and read_mipmaps is true, then both sequences will be read; the filename should contain two sequences of hash marks, separated by some character such as a hyphen, underscore, or dot. The first hash mark sequence will be filled in with the mipmap level, while the second hash mark sequence will be the page index. This method implicitly sets keep_ram_image to false.

readTxo bool Texture::read_txo(istream &in, string const &filename = ("stream")); Description: Reads the texture from a Panda texture object. This defines the complete Texture specification, including the image data as well as all texture properties. The filename is just for reference.

release bool Texture::release(PreparedGraphicsObjects *prepared_objects); Description: Frees the texture context only on the indicated object, if it exists there. Returns true if it was released, false if it had not been prepared.

releaseAll int Texture::release_all(void); Description: Frees the context allocated on all objects for which the texture has been declared. Returns the number of contexts which have been freed.

reload bool Texture::reload(void); Description: Re-reads the Texture from its disk file. Useful when you know the image on disk has recently changed, and you want to update the Texture image. Returns true on success, false on failure (in which case, the Texture may or may not still be valid).

setAlphaFilename void Texture::set_alpha_filename(Filename const &alpha_filename); Description: Sets the name of the file that contains the image's alpha channel contents. Normally, this is set automatically when the image is loaded, for instance via Texture::read(). The Texture's get_filename() function returns the name of the image file that was loaded into the buffer. In the case where a texture specified two separate files to load, a 1- or 3-channel color image and a 1-channel alpha image, this Filename is update to contain the name of the image file that was loaded into the buffer's alpha channel.

setAlphaFullpath void Texture::set_alpha_fullpath(Filename const &alpha_fullpath); Description: Sets the full pathname to the file that contains the image's alpha channel contents, as found along the search path. Normally, this is set automatically when the image is loaded, for instance via Texture::read().

setAnisotropicDegree void Texture::set_anisotropic_degree(int anisotropic_degree); Description: Specifies the level of anisotropic filtering to apply to the texture. Normally, this is 1, to indicate anisotropic filtering is disabled. This may be set to a number higher than one to enable anisotropic filtering, if the rendering backend supports this.

setAuxData void Texture::set_aux_data(string const &key, TypedReferenceCount *aux_data); Description: Records an arbitrary object in the Texture, associated with a specified key. The object may later be retrieved by calling get_aux_data() with the same key. These data objects are not recorded to a bam or txo file.

setBorderColor void Texture::set_border_color(LVecBase4f const &color); Description: Specifies the solid color of the texture's border. Some OpenGL implementations use a border for tiling textures; in Panda, it is only used for specifying the clamp color.

setComponentType void Texture::set_component_type(Texture::ComponentType component_type); Description: Changes the data value for the texture components. This implicitly sets component_width as well.

setCompression void Texture::set_compression(Texture::CompressionMode compression); Description: Requests that this particular Texture be compressed when it is loaded into texture memory. This refers to the internal compression of the texture image within texture memory; it is not related to jpeg or png compression, which are disk file compression formats. The actual disk file that generated this texture may be stored in a compressed or uncompressed format supported by Panda; it will be decompressed on load, and then recompressed by the graphics API if this parameter is not CM_off. If the GSG does not support this texture compression mode, the texture will silently be loaded uncompressed.

setFilename void Texture::set_filename(Filename const &filename); These are published, but in general, you shouldn't be mucking with these values; they are set automatically when a texture is loaded. Description: Sets the name of the file that contains the image's contents. Normally, this is set automatically when the image is loaded, for instance via Texture::read(). The Texture's get_name() function used to return the filename, but now returns just the basename (without the extension), which is a more useful name for identifying an image in show code.

setFormat void Texture::set_format(Texture::Format format); Description: Changes the format value for the texture components. This implicitly sets num_components as well.

setFullpath void Texture::set_fullpath(Filename const &fullpath); Description: Sets the full pathname to the file that contains the image's contents, as found along the search path. Normally, this is set automatically when the image is loaded, for instance via Texture::read().

setKeepRamImage void Texture::set_keep_ram_image(bool keep_ram_image); Description: Sets the flag that indicates whether this Texture is eligible to have its main RAM copy of the texture memory dumped when the texture is prepared for rendering. This will be true for most textures, which can reload their images if needed by rereading the input file. However, textures that were generated dynamically and cannot be easily reloaded will want to set this flag to true, so that the texture will always keep its image copy around.

setLoadedFromImage void Texture::set_loaded_from_image(void); Description: Sets the flag that indicates the texture has been loaded from a disk file or PNMImage. You should also ensure the filename has been set correctly. When this flag is true, the texture may be automatically reloaded when its ram image needs to be replaced.

setLoadedFromTxo void Texture::set_loaded_from_txo(void); Description: Sets the flag that indicates the texture has been loaded from a txo file. You probably shouldn't be setting this directly; it is set automatically when a Texture is loaded.

setMagfilter void Texture::set_magfilter(Texture::FilterType filter); Description:

setMatchFramebufferFormat void Texture::set_match_framebuffer_format(bool flag); Description: Sets the special flag that, if true, indicates to the GSG that the Texture's format should be chosen to exactly match the framebuffer's format, presumably because the application intends to copy image data from the framebuffer into the Texture (or vice-versa). This sets only the graphics card's idea of the texture format; it is not related to the system-memory format.

setMinfilter void Texture::set_minfilter(Texture::FilterType filter); Description:

setRamImage void Texture::set_ram_image(PointerToArray< unsigned char > image, Texture::CompressionMode compression = (CM_off), unsigned int page_size = (0)); Description: Replaces the current system-RAM image with the new data. If compression is not CM_off, it indicates that the new data is already pre-compressed in the indicated format. This does *not* affect keep_ram_image.

setRamMipmapImage void Texture::set_ram_mipmap_image(int n, PointerToArray< unsigned char > image, unsigned int page_size = (0)); Description: Replaces the current system-RAM image for the indicated mipmap level with the new data. If compression is not CM_off, it indicates that the new data is already pre-compressed in the indicated format. This does *not* affect keep_ram_image.

setRenderToTexture void Texture::set_render_to_texture(bool render_to_texture); Description:

setup1dTexture void Texture::setup_1d_texture(void); Filename: texture.I Created by: drose (05Feb99) PANDA 3D SOFTWARE Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved All use of this software is subject to the terms of the Panda 3d Software license. You should have received a copy of this license along with this source code; you will also find a current copy of the license at http://etc.cmu.edu/panda3d/docs/license/ . To contact the maintainers of this program write to panda3d-general@lists.sourceforge.net . Description: Sets the texture as an empty 1-d texture with no dimensions. Follow up with read() or load() to fill the texture properties and image data. Description: Sets the texture as an empty 1-d texture with the specified dimensions and properties. Follow up with set_ram_image() or modify_ram_image() to fill the image data.

setup2dTexture void Texture::setup_2d_texture(void); Description: Sets the texture as an empty 2-d texture with no dimensions. Follow up with read() or load() to fill the texture properties and image data. Description: Sets the texture as an empty 2-d texture with the specified dimensions and properties. Follow up with set_ram_image() or modify_ram_image() to fill the image data.

setup3dTexture void Texture::setup_3d_texture(int z_size = (1)); Description: Sets the texture as an empty 3-d texture with no dimensions (though if you know the depth ahead of time, it saves a bit of reallocation later). Follow up with read() or load() to fill the texture properties and image data. Description: Sets the texture as an empty 3-d texture with the specified dimensions and properties. Follow up with set_ram_image() or modify_ram_image() to fill the image data.

setupCubeMap void Texture::setup_cube_map(void); Description: Sets the texture as an empty cube map texture with no dimensions. Follow up with read() or load() to fill the texture properties and image data. Description: Sets the texture as an empty cube map texture with the specified dimensions and properties. Follow up with set_ram_image() or modify_ram_image() to fill the image data. Note that a cube map should always consist of six square images, so x_size and y_size will be the same, and z_size is always 6.

setupTexture void Texture::setup_texture(Texture::TextureType texture_type, int x_size, int y_size, int z_size, Texture::ComponentType component_type, Texture::Format format); Description: Sets the texture to the indicated type and dimensions, presumably in preparation for calling read() or load(), or set_ram_image() or modify_ram_image().

setWrapU void Texture::set_wrap_u(Texture::WrapMode wrap); Description:

setWrapV void Texture::set_wrap_v(Texture::WrapMode wrap); Description:

setWrapW void Texture::set_wrap_w(Texture::WrapMode wrap); Description: The W wrap direction is only used for 3-d textures.

setXSize void Texture::set_x_size(int x_size); Description: Changes the x size indicated for the texture. This also implicitly unloads the texture if it has already been loaded.

setYSize void Texture::set_y_size(int y_size); Description: Changes the y size indicated for the texture. This also implicitly unloads the texture if it has already been loaded.

setZSize void Texture::set_z_size(int z_size); Description: Changes the z size indicated for the texture. This also implicitly unloads the texture if it has already been loaded.

store bool Texture::store(PNMImage &pnmimage) const; Description: Saves the texture to the indicated PNMImage, but does not write it to disk. Description: Saves the indicated page and mipmap level of the texture to the PNMImage.

usesMipmaps bool Texture::uses_mipmaps(void) const; Description: Returns true if the minfilter settings on this texture indicate the use of mipmapping, false otherwise.

write bool Texture::write(Filename const &fullpath); Description: Writes the texture to the named filename. Description: Writes a single page or mipmap level to a single file, or automatically writes a series of pages and/or mipmap levels to a numbered series of files. If the filename ends in the extension .txo, this implicitly writes a Panda texture object (.txo) instead of an image file. In this case, the remaining parameters are ignored, and only one file is written, which will contain all of the pages and resident mipmap levels in the texture. If write_pages is false, then z indicates the page number to write. 3-D textures have one page number for each level of depth; cube maps have six pages number 0 through 5. Other kinds of textures have only one page, numbered 0. If write_pages is true, then all pages of the texture will be written. In this case z is ignored, and the filename should contain a sequence of hash marks ("#") which will be filled in with the page index number. If write_mipmaps is false, then n indicates the mipmap level number to write. Normally, this is 0, for the base texture image. Normally, the mipmap levels of a texture are not available in RAM (they are generated automatically by the graphics card). However, if you have the mipmap levels available, for instance because you called generate_ram_mipmap_images() to generate them internally, or you called GraphicsEngine::extract_texture_data() to retrieve them from the graphics card, then you may write out each mipmap level with this parameter. If write_mipmaps is true, then all mipmap levels of the texture will be written. In this case n is ignored, and the filename should contain a sequence of hash marks ("#") which will be filled in with the mipmap level number. If both write_pages and write_mipmaps is true, then all pages and all mipmap levels will be written. In this case, the filename should contain two different sequences of hash marks, separated by a character such as a hyphen, underscore, or dot. The first hash mark sequence will be filled in with the mipmap level, while the second hash mark sequence will be the page index. Description: Not to be confused with write(Filename), this method simply describes the texture properties.

writeTxo bool Texture::write_txo(ostream &out, string const &filename = ("stream")) const; Description: Writes the texture to a Panda texture object. This defines the complete Texture specification, including the image data as well as all texture properties. The filename is just for reference.

getClassType static TypeHandle TypedWritableReferenceCount::get_class_type(void); Undocumented function.

getClassType static TypeHandle TypedWritable::get_class_type(void); Undocumented function.

getClassType static TypeHandle TypedObject::get_class_type(void); Undocumented function.

getType virtual TypeHandle TypedObject::get_type(void) const = 0; Derived classes should override this function to return get_class_type().

getTypeIndex int TypedObject::get_type_index(void) const; Description: Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index().

isExactType bool TypedObject::is_exact_type(TypeHandle handle) const; Description: Returns true if the current object is the indicated type exactly.

isOfType bool TypedObject::is_of_type(TypeHandle handle) const; Description: Returns true if the current object is or derives from the indicated type.

getClassType static TypeHandle ReferenceCount::get_class_type(void); Undocumented function.

getRefCount int ReferenceCount::get_ref_count(void) const; Description: Returns the current reference count.

ref void ReferenceCount::ref(void) const; Description: Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

testRefCountIntegrity bool ReferenceCount::test_ref_count_integrity(void) const; Description: Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise.

testRefCountNonzero bool ReferenceCount::test_ref_count_nonzero(void) const; Description: Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise.

unref bool ReferenceCount::unref(void) const; Description: Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete(). User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is true if the new reference count is nonzero, false if it is zero.

clearName void Namable::clear_name(void); Description: Resets the Namable's name to empty.

getClassType static TypeHandle Namable::get_class_type(void); Undocumented function.

getName string const &Namable::get_name(void) const; Description:

hasName bool Namable::has_name(void) const; Description: Returns true if the Namable has a nonempty name set, false if the name is empty.

operator = Namable &Namable::operator =(Namable const &other); Description:

output void Namable::output(ostream &out) const; In the absence of any definition to the contrary, outputting a Namable will write out its name. Description: Outputs the Namable. This function simply writes the name to the output stream; most Namable derivatives will probably redefine this.

setName void Namable::set_name(string const &name); Description:

getClassType static TypeHandle AnimInterface::get_class_type(void); Undocumented function.

getFrac double AnimInterface::get_frac(void) const; Description: Returns the fractional part of the current frame. Normally, this is in the range 0.0 <= f < 1.0, but in the one special case of an animation playing to its end frame and stopping, it might exactly equal 1.0. It will always be true that get_full_frame() + get_frac() == get_full_fframe().

getFrame int AnimInterface::get_frame(void) const; Description: Returns the current integer frame number. This number will be in the range 0 <= f < get_num_frames().

getFrameRate double AnimInterface::get_frame_rate(void) const; Description: Returns the native frame rate of the animation. This is the number of frames per second that will elapse when the play_rate is set to 1.0. It is a fixed property of the animation and may not be adjusted by the user.

getFullFframe double AnimInterface::get_full_fframe(void) const; Description: Returns the current floating-point frame number. Unlike the value returned by get_frame(), this frame number may extend beyond the range of get_num_frames() if the frame range passed to play(), loop(), etc. did. Unlike the value returned by get_full_frame(), this return value may equal (to_frame + 1.0), when the animation has played to its natural end. However, in this case the return value of get_full_frame() will be to_frame, not (to_frame + 1).

getFullFrame int AnimInterface::get_full_frame(void) const; Description: Returns the current integer frame number. Unlike the value returned by get_frame(), this frame number may extend beyond the range of get_num_frames() if the frame range passed to play(), loop(), etc. did. Unlike the value returned by get_full_fframe(), this return value will never exceed the value passed to to_frame in the play() method.

getNextFrame int AnimInterface::get_next_frame(void) const; Description: Returns the current integer frame number + 1, constrained to the range 0 <= f < get_num_frames(). If the play mode is PM_play, this will clamp to the same value as get_frame() at the end of the animation. If the play mode is any other value, this will wrap around to frame 0 at the end of the animation.

getNumFrames virtual int AnimInterface::get_num_frames(void) const; Description: Returns the number of frames in the animation. This is a property of the animation and may not be directly adjusted by the user (although it may change without warning with certain kinds of animations, since this is a virtual method that may be overridden).

getPlayRate double AnimInterface::get_play_rate(void) const; Description: Returns the rate at which the animation plays. See set_play_rate().

isPlaying bool AnimInterface::is_playing(void) const; Description: Returns true if the animation is currently playing, false if it is stopped (e.g. because stop() or pose() was called, or because it reached the end of the animation after play() was called).

loop void AnimInterface::loop(bool restart); Description: Starts the entire animation looping. If restart is true, the animation is restarted from the beginning; otherwise, it continues from the current frame. Description: Loops the animation from the frame "from" to and including the frame "to", indefinitely. If restart is true, the animation is restarted from the beginning; otherwise, it continues from the current frame.

output virtual void AnimInterface::output(ostream &out) const; Description:

pingpong void AnimInterface::pingpong(bool restart); Description: Starts the entire animation bouncing back and forth between its first frame and last frame. If restart is true, the animation is restarted from the beginning; otherwise, it continues from the current frame. Description: Loops the animation from the frame "from" to and including the frame "to", and then back in the opposite direction, indefinitely.

play void AnimInterface::play(void); Filename: animInterface.I Created by: drose (20Sep05) PANDA 3D SOFTWARE Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved All use of this software is subject to the terms of the Panda 3d Software license. You should have received a copy of this license along with this source code; you will also find a current copy of the license at http://etc.cmu.edu/panda3d/docs/license/ . To contact the maintainers of this program write to panda3d-general@lists.sourceforge.net . Description: Runs the entire animation from beginning to end and stops. Description: Runs the animation from the frame "from" to and including the frame "to", at which point the animation is stopped. Both "from" and "to" frame numbers may be outside the range (0, get_num_frames()) and the animation will follow the range correctly, reporting numbers modulo get_num_frames(). For instance, play(0, get_num_frames() * 2) will play the animation twice and then stop.

pose void AnimInterface::pose(double frame); Description: Sets the animation to the indicated frame and holds it there.

setPlayRate void AnimInterface::set_play_rate(double play_rate); Description: Changes the rate at which the animation plays. 1.0 is the normal speed, 2.0 is twice normal speed, and 0.5 is half normal speed. 0.0 is legal to pause the animation, and a negative value will play the animation backwards.

stop void AnimInterface::stop(void); Description: Stops a currently playing or looping animation right where it is. The animation remains posed at the current frame.