mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 00:06:44 -04:00
Merge branch 'release/1.10.x'
This commit is contained in:
commit
199b797d72
@ -1170,7 +1170,7 @@ find_display_modes(int width, int height) {
|
|||||||
|
|
||||||
// Get the current refresh rate and pixel encoding.
|
// Get the current refresh rate and pixel encoding.
|
||||||
CFStringRef current_pixel_encoding;
|
CFStringRef current_pixel_encoding;
|
||||||
int refresh_rate;
|
double refresh_rate;
|
||||||
mode = CGDisplayCopyDisplayMode(_display);
|
mode = CGDisplayCopyDisplayMode(_display);
|
||||||
|
|
||||||
// First check if the current mode is adequate.
|
// First check if the current mode is adequate.
|
||||||
@ -1204,7 +1204,7 @@ find_display_modes(int width, int height) {
|
|||||||
// the mode width and height but also actual pixel widh and height.
|
// the mode width and height but also actual pixel widh and height.
|
||||||
if (CGDisplayModeGetWidth(mode) == width &&
|
if (CGDisplayModeGetWidth(mode) == width &&
|
||||||
CGDisplayModeGetHeight(mode) == height &&
|
CGDisplayModeGetHeight(mode) == height &&
|
||||||
CGDisplayModeGetRefreshRate(mode) == refresh_rate &&
|
(int)(CGDisplayModeGetRefreshRate(mode) + 0.5) == (int)(refresh_rate + 0.5) &&
|
||||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
|
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
|
||||||
(floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_14 ||
|
(floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_14 ||
|
||||||
(CGDisplayModeGetPixelWidth(mode) == expected_pixel_width &&
|
(CGDisplayModeGetPixelWidth(mode) == expected_pixel_width &&
|
||||||
@ -1212,7 +1212,12 @@ find_display_modes(int width, int height) {
|
|||||||
#endif
|
#endif
|
||||||
CFStringCompare(pixel_encoding, current_pixel_encoding, 0) == kCFCompareEqualTo) {
|
CFStringCompare(pixel_encoding, current_pixel_encoding, 0) == kCFCompareEqualTo) {
|
||||||
|
|
||||||
CFArrayAppendValue(valid_modes, mode);
|
if (CGDisplayModeGetRefreshRate(mode) == refresh_rate) {
|
||||||
|
// Exact match for refresh rate, prioritize this.
|
||||||
|
CFArrayInsertValueAtIndex(valid_modes, 0, mode);
|
||||||
|
} else {
|
||||||
|
CFArrayAppendValue(valid_modes, mode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CFRelease(pixel_encoding);
|
CFRelease(pixel_encoding);
|
||||||
}
|
}
|
||||||
|
@ -13074,22 +13074,22 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
|
|||||||
image = tex->get_uncompressed_ram_image();
|
image = tex->get_uncompressed_ram_image();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Texture::TextureType texture_type = tex->get_texture_type();
|
||||||
Texture::CompressionMode image_compression;
|
Texture::CompressionMode image_compression;
|
||||||
if (image.is_null()) {
|
if (image.is_null()) {
|
||||||
image_compression = Texture::CM_off;
|
image_compression = Texture::CM_off;
|
||||||
} else {
|
} else {
|
||||||
image_compression = tex->get_ram_image_compression();
|
image_compression = tex->get_ram_image_compression();
|
||||||
}
|
|
||||||
|
|
||||||
bool is_buffer_texture = tex->get_texture_type() == Texture::TT_buffer_texture;
|
if (texture_type == Texture::TT_buffer_texture ||
|
||||||
if (is_buffer_texture ||
|
!get_supports_compressed_texture_format(image_compression)) {
|
||||||
!get_supports_compressed_texture_format(image_compression)) {
|
image = tex->get_uncompressed_ram_image();
|
||||||
image = tex->get_uncompressed_ram_image();
|
image_compression = Texture::CM_off;
|
||||||
image_compression = Texture::CM_off;
|
|
||||||
|
|
||||||
// If this triggers, Panda cannot decompress the texture. Compile with
|
// If this triggers, Panda cannot decompress the texture. Compile with
|
||||||
// libsquish support or precompress the texture.
|
// libsquish support or precompress the texture.
|
||||||
nassertr(!image.is_null(), false);
|
nassertr(!image.is_null(), false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int mipmap_bias = 0;
|
int mipmap_bias = 0;
|
||||||
@ -13101,7 +13101,7 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
|
|||||||
// If we'll use immutable texture storage, we have to pick a sized image
|
// If we'll use immutable texture storage, we have to pick a sized image
|
||||||
// format.
|
// format.
|
||||||
bool force_sized = (gl_immutable_texture_storage && _supports_tex_storage) ||
|
bool force_sized = (gl_immutable_texture_storage && _supports_tex_storage) ||
|
||||||
(is_buffer_texture);
|
(texture_type == Texture::TT_buffer_texture);
|
||||||
|
|
||||||
GLint internal_format = get_internal_image_format(tex, force_sized);
|
GLint internal_format = get_internal_image_format(tex, force_sized);
|
||||||
GLint external_format = get_external_image_format(tex);
|
GLint external_format = get_external_image_format(tex);
|
||||||
@ -13130,7 +13130,7 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
|
|||||||
int max_dimension_y;
|
int max_dimension_y;
|
||||||
int max_dimension_z;
|
int max_dimension_z;
|
||||||
|
|
||||||
switch (tex->get_texture_type()) {
|
switch (texture_type) {
|
||||||
case Texture::TT_3d_texture:
|
case Texture::TT_3d_texture:
|
||||||
max_dimension_x = _max_3d_texture_dimension;
|
max_dimension_x = _max_3d_texture_dimension;
|
||||||
max_dimension_y = _max_3d_texture_dimension;
|
max_dimension_y = _max_3d_texture_dimension;
|
||||||
@ -13235,7 +13235,7 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
|
|||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
|
||||||
GLenum target = get_texture_target(tex->get_texture_type());
|
GLenum target = get_texture_target(texture_type);
|
||||||
uses_mipmaps = (uses_mipmaps && !gl_ignore_mipmaps) || gl_force_mipmaps;
|
uses_mipmaps = (uses_mipmaps && !gl_ignore_mipmaps) || gl_force_mipmaps;
|
||||||
#ifndef OPENGLES
|
#ifndef OPENGLES
|
||||||
if (target == GL_TEXTURE_BUFFER) {
|
if (target == GL_TEXTURE_BUFFER) {
|
||||||
@ -13411,7 +13411,7 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
|
|||||||
<< ", uses_mipmaps = " << uses_mipmaps << "\n";
|
<< ", uses_mipmaps = " << uses_mipmaps << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (tex->get_texture_type()) {
|
switch (texture_type) {
|
||||||
case Texture::TT_buffer_texture:
|
case Texture::TT_buffer_texture:
|
||||||
// Won't get here, but squelch compiler warning
|
// Won't get here, but squelch compiler warning
|
||||||
case Texture::TT_1d_texture:
|
case Texture::TT_1d_texture:
|
||||||
@ -13459,7 +13459,7 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool success = true;
|
bool success = true;
|
||||||
if (tex->get_texture_type() == Texture::TT_cube_map) {
|
if (texture_type == Texture::TT_cube_map) {
|
||||||
// A cube map must load six different 2-d images (which are stored as the
|
// A cube map must load six different 2-d images (which are stored as the
|
||||||
// six pages of the system ram image).
|
// six pages of the system ram image).
|
||||||
if (!_supports_cube_map) {
|
if (!_supports_cube_map) {
|
||||||
|
@ -5,30 +5,6 @@ from panda3d import core
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
def test_round():
|
|
||||||
original_vector = Vec2(2.3, -2.6)
|
|
||||||
|
|
||||||
rounded_vector = round(original_vector)
|
|
||||||
assert rounded_vector.x == 2
|
|
||||||
assert rounded_vector.y == -3
|
|
||||||
|
|
||||||
|
|
||||||
def test_floor():
|
|
||||||
original_vector = Vec2(2.3, -2.6)
|
|
||||||
|
|
||||||
rounded_vector = floor(original_vector)
|
|
||||||
assert rounded_vector.x == 2
|
|
||||||
assert rounded_vector.y == -3
|
|
||||||
|
|
||||||
|
|
||||||
def test_ceil():
|
|
||||||
original_vector = Vec2(2.3, -2.6)
|
|
||||||
|
|
||||||
rounded_vector = ceil(original_vector)
|
|
||||||
assert rounded_vector.x == 3
|
|
||||||
assert rounded_vector.y == -2
|
|
||||||
|
|
||||||
|
|
||||||
def test_vec2_creation():
|
def test_vec2_creation():
|
||||||
assert Vec2(x=1, y=2) == Vec2(1, 2) == Vec2((1, 2))
|
assert Vec2(x=1, y=2) == Vec2(1, 2) == Vec2((1, 2))
|
||||||
|
|
||||||
@ -120,8 +96,32 @@ def test_vec2_nan():
|
|||||||
assert not Vec2D(-inf, 0).is_nan()
|
assert not Vec2D(-inf, 0).is_nan()
|
||||||
|
|
||||||
|
|
||||||
|
def test_vec2_round():
|
||||||
|
original_vector = Vec2(2.3, -2.6)
|
||||||
|
|
||||||
|
rounded_vector = round(original_vector)
|
||||||
|
assert rounded_vector.x == 2
|
||||||
|
assert rounded_vector.y == -3
|
||||||
|
|
||||||
|
|
||||||
|
def test_vec2_floor():
|
||||||
|
original_vector = Vec2(2.3, -2.6)
|
||||||
|
|
||||||
|
rounded_vector = floor(original_vector)
|
||||||
|
assert rounded_vector.x == 2
|
||||||
|
assert rounded_vector.y == -3
|
||||||
|
|
||||||
|
|
||||||
|
def test_vec2_ceil():
|
||||||
|
original_vector = Vec2(2.3, -2.6)
|
||||||
|
|
||||||
|
rounded_vector = ceil(original_vector)
|
||||||
|
assert rounded_vector.x == 3
|
||||||
|
assert rounded_vector.y == -2
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("type", (core.LVecBase2f, core.LVecBase2d, core.LVecBase2i))
|
@pytest.mark.parametrize("type", (core.LVecBase2f, core.LVecBase2d, core.LVecBase2i))
|
||||||
def test_vec4_floordiv(type):
|
def test_vec2_floordiv(type):
|
||||||
with pytest.raises(ZeroDivisionError):
|
with pytest.raises(ZeroDivisionError):
|
||||||
type(1, 2) // 0
|
type(1, 2) // 0
|
||||||
|
|
||||||
|
@ -5,33 +5,6 @@ from panda3d import core
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
def test_round():
|
|
||||||
original_vector = Vec3(2.3, -2.6, 3.5)
|
|
||||||
|
|
||||||
rounded_vector = round(original_vector)
|
|
||||||
assert rounded_vector.x == 2
|
|
||||||
assert rounded_vector.y == -3
|
|
||||||
assert rounded_vector.z == 4
|
|
||||||
|
|
||||||
|
|
||||||
def test_floor():
|
|
||||||
original_vector = Vec3(2.3, -2.6, 3.5)
|
|
||||||
|
|
||||||
rounded_vector = floor(original_vector)
|
|
||||||
assert rounded_vector.x == 2
|
|
||||||
assert rounded_vector.y == -3
|
|
||||||
assert rounded_vector.z == 3
|
|
||||||
|
|
||||||
|
|
||||||
def test_ceil():
|
|
||||||
original_vector = Vec3(2.3, -2.6, 3.5)
|
|
||||||
|
|
||||||
rounded_vector = ceil(original_vector)
|
|
||||||
assert rounded_vector.x == 3
|
|
||||||
assert rounded_vector.y == -2
|
|
||||||
assert rounded_vector.z == 4
|
|
||||||
|
|
||||||
|
|
||||||
def test_vec3_creation():
|
def test_vec3_creation():
|
||||||
assert Vec3(x=1, y=2, z=1) == Vec3(1, 2, 1) == Vec3((1, 2, 1))
|
assert Vec3(x=1, y=2, z=1) == Vec3(1, 2, 1) == Vec3((1, 2, 1))
|
||||||
|
|
||||||
@ -105,6 +78,33 @@ def test_vec3_compare():
|
|||||||
assert Vec3(0, 0, 1).compare_to(Vec3(0, 0, 1)) == 0
|
assert Vec3(0, 0, 1).compare_to(Vec3(0, 0, 1)) == 0
|
||||||
|
|
||||||
|
|
||||||
|
def test_vec3_round():
|
||||||
|
original_vector = Vec3(2.3, -2.6, 3.5)
|
||||||
|
|
||||||
|
rounded_vector = round(original_vector)
|
||||||
|
assert rounded_vector.x == 2
|
||||||
|
assert rounded_vector.y == -3
|
||||||
|
assert rounded_vector.z == 4
|
||||||
|
|
||||||
|
|
||||||
|
def test_vec3_floor():
|
||||||
|
original_vector = Vec3(2.3, -2.6, 3.5)
|
||||||
|
|
||||||
|
rounded_vector = floor(original_vector)
|
||||||
|
assert rounded_vector.x == 2
|
||||||
|
assert rounded_vector.y == -3
|
||||||
|
assert rounded_vector.z == 3
|
||||||
|
|
||||||
|
|
||||||
|
def test_vec3_ceil():
|
||||||
|
original_vector = Vec3(2.3, -2.6, 3.5)
|
||||||
|
|
||||||
|
rounded_vector = ceil(original_vector)
|
||||||
|
assert rounded_vector.x == 3
|
||||||
|
assert rounded_vector.y == -2
|
||||||
|
assert rounded_vector.z == 4
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("type", (core.LVecBase3f, core.LVecBase3d, core.LVecBase3i))
|
@pytest.mark.parametrize("type", (core.LVecBase3f, core.LVecBase3d, core.LVecBase3i))
|
||||||
def test_vec3_floordiv(type):
|
def test_vec3_floordiv(type):
|
||||||
with pytest.raises(ZeroDivisionError):
|
with pytest.raises(ZeroDivisionError):
|
||||||
|
@ -5,36 +5,6 @@ from panda3d import core
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
def test_round():
|
|
||||||
original_vector = Vec4(2.3, -2.6, 3.5, 1)
|
|
||||||
|
|
||||||
rounded_vector = round(original_vector)
|
|
||||||
assert rounded_vector.x == 2
|
|
||||||
assert rounded_vector.y == -3
|
|
||||||
assert rounded_vector.z == 4
|
|
||||||
assert rounded_vector.w == 1
|
|
||||||
|
|
||||||
|
|
||||||
def test_floor():
|
|
||||||
original_vector = Vec4(2.3, -2.6, 3.5, 1)
|
|
||||||
|
|
||||||
rounded_vector = floor(original_vector)
|
|
||||||
assert rounded_vector.x == 2
|
|
||||||
assert rounded_vector.y == -3
|
|
||||||
assert rounded_vector.z == 3
|
|
||||||
assert rounded_vector.w == 1
|
|
||||||
|
|
||||||
|
|
||||||
def test_ceil():
|
|
||||||
original_vector = Vec4(2.3, -2.6, 3.5, 1)
|
|
||||||
|
|
||||||
rounded_vector = ceil(original_vector)
|
|
||||||
assert rounded_vector.x == 3
|
|
||||||
assert rounded_vector.y == -2
|
|
||||||
assert rounded_vector.z == 4
|
|
||||||
assert rounded_vector.w == 1
|
|
||||||
|
|
||||||
|
|
||||||
def test_vec4_creation():
|
def test_vec4_creation():
|
||||||
assert Vec4(x=1, y=2, z=1, w=7) == Vec4(1, 2, 1, 7) == Vec4((1, 2, 1, 7))
|
assert Vec4(x=1, y=2, z=1, w=7) == Vec4(1, 2, 1, 7) == Vec4((1, 2, 1, 7))
|
||||||
|
|
||||||
@ -121,6 +91,36 @@ def test_vec4_compare():
|
|||||||
assert Vec4(0, 0, 0, 1).compare_to(Vec4(0, 0, 0, 1)) == 0
|
assert Vec4(0, 0, 0, 1).compare_to(Vec4(0, 0, 0, 1)) == 0
|
||||||
|
|
||||||
|
|
||||||
|
def test_vec4_round():
|
||||||
|
original_vector = Vec4(2.3, -2.6, 3.5, 1)
|
||||||
|
|
||||||
|
rounded_vector = round(original_vector)
|
||||||
|
assert rounded_vector.x == 2
|
||||||
|
assert rounded_vector.y == -3
|
||||||
|
assert rounded_vector.z == 4
|
||||||
|
assert rounded_vector.w == 1
|
||||||
|
|
||||||
|
|
||||||
|
def test_vec4_floor():
|
||||||
|
original_vector = Vec4(2.3, -2.6, 3.5, 1)
|
||||||
|
|
||||||
|
rounded_vector = floor(original_vector)
|
||||||
|
assert rounded_vector.x == 2
|
||||||
|
assert rounded_vector.y == -3
|
||||||
|
assert rounded_vector.z == 3
|
||||||
|
assert rounded_vector.w == 1
|
||||||
|
|
||||||
|
|
||||||
|
def test_vec4_ceil():
|
||||||
|
original_vector = Vec4(2.3, -2.6, 3.5, 1)
|
||||||
|
|
||||||
|
rounded_vector = ceil(original_vector)
|
||||||
|
assert rounded_vector.x == 3
|
||||||
|
assert rounded_vector.y == -2
|
||||||
|
assert rounded_vector.z == 4
|
||||||
|
assert rounded_vector.w == 1
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("type", (core.LVecBase4f, core.LVecBase4d, core.LVecBase4i))
|
@pytest.mark.parametrize("type", (core.LVecBase4f, core.LVecBase4d, core.LVecBase4i))
|
||||||
def test_vec4_floordiv(type):
|
def test_vec4_floordiv(type):
|
||||||
with pytest.raises(ZeroDivisionError):
|
with pytest.raises(ZeroDivisionError):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user