TexturePeeker
-
class TexturePeeker
Bases:
ReferenceCount
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.Inheritance diagram
-
TexturePeeker(TexturePeeker const&) = default
Use
Texture::peek()
to construct aTexturePeeker
.This constructor is called only by
Texture::peek()
, and assumes the texture’s lock is already held.
-
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
-
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.
The texel color is linearly filtered over the entire region. u, v, and w must be in the range [0, 1].
-
int get_x_size(void) const
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.
-
int get_y_size(void) const
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.
-
int get_z_size(void) const
Returns the depth of the texture image that is contributing to the TexturePeeker’s information.
-
bool has_pixel(int x, int y) const
-
bool has_pixel(int x, int y, int z) const
Returns whether a given coordinate is inside of the texture dimensions.
-
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).
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.
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.
-
TexturePeeker(TexturePeeker const&) = default