18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 04:47:06 +01:00

Textures with the trait r are kept as they are; the scene block carries the place of the camera of the pass

A texture named with :r (the frames of the animations baked into textures, mat_vat) is never scaled down to maxtexturesize
nor compressed by the driver with compresstex: its texels are data, not a picture.

gl::scene_ubs::camera_hi, camera_lo: the place of the camera of the pass in the world, which the models are drawn relative
to, split so both parts are exact in floats. Set with inv_view in every pass that has it (the color pass, the faces of the
environment map, the sun cascades, the headlight shadows, the previews). mat_vat.vert takes the place of a model in the world
from them, so models standing turned the same way still get a moment of the animation of their own, the same in every pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXgG7F4L42c2F9sDSAJbT2
This commit is contained in:
lcddisplay
2026-11-02 16:37:48 +01:00
parent e85f09e8b0
commit 467e850a4e
3 changed files with 39 additions and 4 deletions
+7 -2
View File
@@ -1121,7 +1121,8 @@ texture_source::load_TGA() {
}
downsize( GL_BGRA );
if( data_width > Global.CurrentMaxTextureSize || data_height > Global.CurrentMaxTextureSize ) {
if( ( false == contains( traits, 'r' ) )
&& ( data_width > Global.CurrentMaxTextureSize || data_height > Global.CurrentMaxTextureSize ) ) {
// for non-square textures there's currently possibility the scaling routine will have to abort
// before it gets all work done
data_state = resource_state::failed;
@@ -1292,7 +1293,7 @@ opengl_texture::create( bool const Static ) {
// uncompressed texture data. have the gfx card do the compression as it sees fit
::glTexImage2D(
target, 0,
Global.compress_tex ? compressed_format : internal_format,
( Global.compress_tex && ( false == contains( traits, 'r' ) ) ) ? compressed_format : internal_format,
data_width, data_height, 0,
data_format, data_type, (GLubyte *)&data[ 0 ] );
}
@@ -1491,6 +1492,10 @@ opengl_texture::set_filtering() const
void
texture_source::downsize( GLuint const Format ) {
if( contains( traits, 'r' ) ) {
// raw data (trait r: the frames of the animations baked into textures, mat_vat): never scaled down
return;
}
while( data_width > Global.CurrentMaxTextureSize || data_height > Global.CurrentMaxTextureSize ) {
// scale down the base texture, if it's larger than allowed maximum
// NOTE: scaling is uniform along both axes, meaning non-square textures can drop below the maximum