mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 18:03:56 -04:00
publish Textures::up/down_to_power_2()
This commit is contained in:
parent
aca2606187
commit
86409f66e4
@ -1530,6 +1530,36 @@ prepare_now(PreparedGraphicsObjects *prepared_objects,
|
||||
return tc;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Texture::up_to_power_2
|
||||
// Access: Published, Static
|
||||
// Description: Returns the smallest power of 2 greater than or equal
|
||||
// to value.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int Texture::
|
||||
up_to_power_2(int value) {
|
||||
if (value <= 1) {
|
||||
return 1;
|
||||
}
|
||||
int bit = get_next_higher_bit(((unsigned int)value) - 1);
|
||||
return (1 << bit);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Texture::down_to_power_2
|
||||
// Access: Published, Static
|
||||
// Description: Returns the largest power of 2 less than or equal
|
||||
// to value.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int Texture::
|
||||
down_to_power_2(int value) {
|
||||
if (value <= 1) {
|
||||
return 1;
|
||||
}
|
||||
int bit = get_next_higher_bit(((unsigned int)value) >> 1);
|
||||
return (1 << bit);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Texture::texture_uploaded
|
||||
@ -1660,36 +1690,6 @@ make_texture() {
|
||||
return new Texture;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Texture::up_to_power_2
|
||||
// Access: Public, Static
|
||||
// Description: Returns the smallest power of 2 greater than or equal
|
||||
// to value.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int Texture::
|
||||
up_to_power_2(int value) {
|
||||
int x = 1;
|
||||
while (x < value) {
|
||||
x = (x << 1);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Texture::down_to_power_2
|
||||
// Access: Public, Static
|
||||
// Description: Returns the largest power of 2 less than or equal
|
||||
// to value.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int Texture::
|
||||
down_to_power_2(int value) {
|
||||
int x = 1;
|
||||
while ((x << 1) <= value) {
|
||||
x = (x << 1);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Texture::is_specific
|
||||
// Access: Public, Static
|
||||
|
@ -424,6 +424,9 @@ PUBLISHED:
|
||||
TextureContext *prepare_now(PreparedGraphicsObjects *prepared_objects,
|
||||
GraphicsStateGuardianBase *gsg);
|
||||
|
||||
static int up_to_power_2(int value);
|
||||
static int down_to_power_2(int value);
|
||||
|
||||
public:
|
||||
void texture_uploaded(GraphicsStateGuardianBase *gsg);
|
||||
|
||||
@ -436,9 +439,6 @@ public:
|
||||
static PT(Texture) make_texture();
|
||||
|
||||
public:
|
||||
static int up_to_power_2(int value);
|
||||
static int down_to_power_2(int value);
|
||||
|
||||
static bool is_specific(CompressionMode compression);
|
||||
static bool has_alpha(Format format);
|
||||
static bool has_binary_alpha(Format format);
|
||||
|
Loading…
x
Reference in New Issue
Block a user