forked from 1b-agent/opencadstudio-upstream
View backgrounds: image colours as stored, viewport style name, adjust automation
- The background image texture is not an sRGB view: the image is drawn with its own colours, as the solid and gradient colours are. - An entered paper-space viewport shows its named visual style (Realistic, ...) in the render-mode picker, and a mode picked there is recorded as the viewport's visual style. - The view_background automation action takes offset=x,y and scale=x,y. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b5b505ee9d
commit
064da8829e
8 files changed
+80
-19
No files matched your search
@@ -3996,7 +3996,8 @@ analytic={:.1} regular={:.1} blocks={:.1}",
|
||||
}
|
||||
let upload = |label: &'static str,
|
||||
image: Option<&crate::scene::model::image_model::DecodedImage>,
|
||||
fallback: [u8; 4]| {
|
||||
fallback: [u8; 4],
|
||||
format: wgpu::TextureFormat| {
|
||||
let (width, height, pixels) = image
|
||||
.map(|image| (image.width, image.height, image.pixels.as_slice()))
|
||||
.unwrap_or((1, 1, fallback.as_slice()));
|
||||
@@ -4010,7 +4011,7 @@ analytic={:.1} regular={:.1} blocks={:.1}",
|
||||
mip_level_count: 1,
|
||||
sample_count: 1,
|
||||
dimension: wgpu::TextureDimension::D2,
|
||||
format: wgpu::TextureFormat::Rgba8UnormSrgb,
|
||||
format,
|
||||
usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,
|
||||
view_formats: &[],
|
||||
});
|
||||
@@ -4030,8 +4031,21 @@ analytic={:.1} regular={:.1} blocks={:.1}",
|
||||
);
|
||||
texture
|
||||
};
|
||||
self.background_texture = upload("background.texture", background, [0, 0, 0, 255]);
|
||||
self.environment_texture = upload("environment.texture", environment, [128, 128, 128, 255]);
|
||||
// The background image is drawn as it is, like the solid and gradient
|
||||
// colours (an sRGB view would darken it a second time); the
|
||||
// environment map stays sRGB for lighting.
|
||||
self.background_texture = upload(
|
||||
"background.texture",
|
||||
background,
|
||||
[0, 0, 0, 255],
|
||||
wgpu::TextureFormat::Rgba8Unorm,
|
||||
);
|
||||
self.environment_texture = upload(
|
||||
"environment.texture",
|
||||
environment,
|
||||
[128, 128, 128, 255],
|
||||
wgpu::TextureFormat::Rgba8UnormSrgb,
|
||||
);
|
||||
self.rebuild_frame_bind_group(device);
|
||||
self.background_source_id = background_id;
|
||||
self.environment_source_id = environment_id;
|
||||
|
||||
Reference in new issue
Block a user