Panda3D
|
An instance of this object is returned by Texture::peek(). More...
#include "texturePeeker.h"
Public Member Functions | |
void | fetch_pixel (LColor &color, int x, int y) const |
Works like TexturePeeker::lookup(), but instead of uv-coordinates, integer coordinates are used. | |
void | fetch_pixel (LColor &color, int x, int y, int z) const |
Works like TexturePeeker::lookup(), but instead of uv-coordinates, integer coordinates are used. | |
void | filter_rect (LColor &color, PN_stdfloat min_u, PN_stdfloat min_v, PN_stdfloat max_u, PN_stdfloat max_v) const |
Fills "color" with the average RGBA color of the texels within the rectangle defined by the specified coordinate range. | |
void | filter_rect (LColor &color, PN_stdfloat min_u, PN_stdfloat min_v, PN_stdfloat min_w, PN_stdfloat max_u, PN_stdfloat max_v, PN_stdfloat max_w) const |
Fills "color" with the average RGBA color of the texels within the rectangle defined by the specified coordinate range. | |
int | get_x_size () const |
Returns the width of the texture image that is contributing to the TexturePeeker's information. | |
int | get_y_size () const |
Returns the height of the texture image that is contributing to the TexturePeeker's information. | |
int | get_z_size () const |
Returns the depth of the texture image that is contributing to the TexturePeeker's information. | |
bool | has_pixel (int x, int y) const |
Returns whether a given coordinate is inside of the texture dimensions. | |
bool | has_pixel (int x, int y, int z) const |
Returns whether a given coordinate is inside of the texture dimensions. | |
bool | is_valid () const |
Returns true if the TexturePeeker was able to initialize itself and is ready to return texel colors. | |
void | lookup (LColor &color, PN_stdfloat u, PN_stdfloat v) const |
Fills "color" with the RGBA color of the texel at point (u, v). | |
void | lookup (LColor &color, PN_stdfloat u, PN_stdfloat v, PN_stdfloat w) const |
Fills "color" with the RGBA color of the texel at point (u, v, w). | |
bool | lookup_bilinear (LColor &color, PN_stdfloat u, PN_stdfloat v) const |
Performs a bilinear lookup to retrieve the color value stored at the uv coordinate (u, v). | |
![]() | |
int | get_ref_count () const |
WeakReferenceList * | get_weak_list () const |
Returns the WeakReferenceList associated with this ReferenceCount object. | |
bool | has_weak_list () const |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. | |
void | local_object () |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. | |
void | ref () const |
Explicitly increments the reference count. | |
bool | ref_if_nonzero () const |
Atomically increases the reference count of this object if it is not zero. | |
bool | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | test_ref_count_nonzero () const |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. | |
virtual bool | unref () const |
Explicitly decrements the reference count. | |
bool | unref_if_one () const |
Atomically decreases the reference count of this object if it is one. | |
WeakReferenceList * | weak_ref () |
Adds the indicated PointerToVoid as a weak reference to this object. | |
void | weak_unref () |
Removes the indicated PointerToVoid as a weak reference to this object. | |
![]() | |
void | operator delete (void *, void *) |
void | operator delete (void *ptr) |
void | operator delete[] (void *, void *) |
void | operator delete[] (void *ptr) |
void * | operator new (size_t size) |
void * | operator new (size_t size, void *ptr) |
void * | operator new[] (size_t size) |
void * | operator new[] (size_t size, void *ptr) |
Friends | |
class | Texture |
Additional Inherited Members | |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
get_ref_count | |
Returns the current reference count. | |
An instance of this object is returned by Texture::peek().
This object allows quick and easy inspection of a texture's texels by (u, v) coordinates.
Definition at line 27 of file texturePeeker.h.
void TexturePeeker::fetch_pixel | ( | LColor & | color, |
int | x, | ||
int | y ) const |
Works like TexturePeeker::lookup(), but instead of uv-coordinates, integer coordinates are used.
Definition at line 367 of file texturePeeker.cxx.
References ConstPointerToArray< Element >::p().
Referenced by lookup(), lookup(), and lookup_bilinear().
void TexturePeeker::fetch_pixel | ( | LColor & | color, |
int | x, | ||
int | y, | ||
int | z ) const |
Works like TexturePeeker::lookup(), but instead of uv-coordinates, integer coordinates are used.
Definition at line 378 of file texturePeeker.cxx.
References ConstPointerToArray< Element >::p().
void TexturePeeker::filter_rect | ( | LColor & | color, |
PN_stdfloat | min_u, | ||
PN_stdfloat | min_v, | ||
PN_stdfloat | max_u, | ||
PN_stdfloat | max_v ) const |
Fills "color" with the average RGBA color of the texels within the rectangle defined by the specified coordinate range.
The texel color is linearly filtered over the entire region. u, v, and w must be in the range [0, 1].
Definition at line 441 of file texturePeeker.cxx.
void TexturePeeker::filter_rect | ( | LColor & | color, |
PN_stdfloat | min_u, | ||
PN_stdfloat | min_v, | ||
PN_stdfloat | min_w, | ||
PN_stdfloat | max_u, | ||
PN_stdfloat | max_v, | ||
PN_stdfloat | max_w ) const |
Fills "color" with the average RGBA color of the texels within the rectangle defined by the specified coordinate range.
The texel color is linearly filtered over the entire region. u, v, and w must be in the range [0, 1].
Definition at line 469 of file texturePeeker.cxx.
|
inline |
Returns the width of the texture image that is contributing to the TexturePeeker's information.
This may be either the Texture's full width, or its simple ram image's width.
Definition at line 28 of file texturePeeker.I.
|
inline |
Returns the height of the texture image that is contributing to the TexturePeeker's information.
This may be either the Texture's full height, or its simple ram image's height.
Definition at line 38 of file texturePeeker.I.
|
inline |
Returns the depth of the texture image that is contributing to the TexturePeeker's information.
Definition at line 47 of file texturePeeker.I.
|
inline |
Returns whether a given coordinate is inside of the texture dimensions.
Definition at line 55 of file texturePeeker.I.
Referenced by lookup_bilinear().
|
inline |
Returns whether a given coordinate is inside of the texture dimensions.
Definition at line 63 of file texturePeeker.I.
|
inline |
Returns true if the TexturePeeker was able to initialize itself and is ready to return texel colors.
Definition at line 18 of file texturePeeker.I.
References PointerToVoid::is_null().
void TexturePeeker::lookup | ( | LColor & | color, |
PN_stdfloat | u, | ||
PN_stdfloat | v ) const |
Fills "color" with the RGBA color of the texel at point (u, v).
The texel color is determined via nearest-point sampling (no filtering of adjacent pixels), regardless of the filter type associated with the texture. u, v, and w will wrap around regardless of the texture's wrap mode.
Definition at line 293 of file texturePeeker.cxx.
References fetch_pixel(), and lookup().
Referenced by lookup().
void TexturePeeker::lookup | ( | LColor & | color, |
PN_stdfloat | u, | ||
PN_stdfloat | v, | ||
PN_stdfloat | w ) const |
Fills "color" with the RGBA color of the texel at point (u, v, w).
The texel color is determined via nearest-point sampling (no filtering of adjacent pixels), regardless of the filter type associated with the texture. u, v, and w will wrap around regardless of the texture's wrap mode.
Definition at line 313 of file texturePeeker.cxx.
References fetch_pixel(), and ConstPointerToArray< Element >::p().
bool TexturePeeker::lookup_bilinear | ( | LColor & | color, |
PN_stdfloat | u, | ||
PN_stdfloat | v ) const |
Performs a bilinear lookup to retrieve the color value stored at the uv coordinate (u, v).
In case the point is outside of the uv range, color is set to zero, and false is returned. Otherwise true is returned.
Definition at line 392 of file texturePeeker.cxx.
References fetch_pixel(), and has_pixel().
|
friend |
Definition at line 101 of file texturePeeker.h.