Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
NiranV
Black Dragon Viewer
Commits
558c5d30
Commit
558c5d30
authored
Feb 06, 2021
by
NiranV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed: Snapshots sometimes tiling weirdly and inventory snapshots being broken.
parent
b5e8d29a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
21 deletions
+37
-21
indra/newview/llviewerwindow.cpp
indra/newview/llviewerwindow.cpp
+37
-21
No files found.
indra/newview/llviewerwindow.cpp
View file @
558c5d30
...
...
@@ -4982,15 +4982,19 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
F32
scale_factor
=
1.0
f
;
if
(
!
keep_window_aspect
||
(
image_width
>
window_width
)
||
(
image_height
>
window_height
))
{
//BD - Always update our view rect and aspect ratio to match our desired snapshot resolution.
// Should the snapshot fail our main camera and render loop will automatically return us
// to the proper values again anyway.
mWorldViewRectRaw
.
set
(
0
,
image_height
,
image_width
,
0
);
LLViewerCamera
::
getInstance
()
->
setViewHeightInPixels
(
mWorldViewRectRaw
.
getHeight
());
LLViewerCamera
::
getInstance
()
->
setAspect
(
getWorldViewAspectRatio
());
if
((
image_width
<=
gGLManager
.
mGLMaxTextureSize
&&
image_height
<=
gGLManager
.
mGLMaxTextureSize
)
&&
(
image_width
>
window_width
||
image_height
>
window_height
)
&&
LLPipeline
::
sRenderDeferred
&&
!
show_ui
)
{
//BD - Always update our view rect and aspect ratio to match our desired snapshot resolution.
// Should the snapshot fail our main camera and render loop will automatically return us
// to the proper values again anyway.
if
(
type
==
LLSnapshotModel
::
SNAPSHOT_TYPE_DEPTH
)
{
mWorldViewRectRaw
.
set
(
0
,
image_height
,
image_width
,
0
);
LLViewerCamera
::
getInstance
()
->
setViewHeightInPixels
(
mWorldViewRectRaw
.
getHeight
());
LLViewerCamera
::
getInstance
()
->
setAspect
(
getWorldViewAspectRatio
());
}
//BD - Don't attempt to allocate scratch space when we take depth shots as it fails to allocate
// the color buffer in llrendertarget.cpp. This leads to depth essentially not getting
// a view rect and aspect ratio update, resulting in the final image being "zoomed in".
...
...
@@ -5021,23 +5025,35 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
{
LL_WARNS
()
<<
"Failed to allocate scratch space. "
<<
LL_ENDL
;
}
if
(
type
!=
LLSnapshotModel
::
SNAPSHOT_TYPE_DEPTH
)
{
if
(
reset_deferred
)
{
//BD - Always update our view rect and aspect ratio to match our desired snapshot resolution.
// Should the snapshot fail our main camera and render loop will automatically return us
// to the proper values again anyway.
mWorldViewRectRaw
.
set
(
0
,
image_height
,
image_width
,
0
);
LLViewerCamera
::
getInstance
()
->
setViewHeightInPixels
(
mWorldViewRectRaw
.
getHeight
());
LLViewerCamera
::
getInstance
()
->
setAspect
(
getWorldViewAspectRatio
());
}
else
{
//BD - As mentioned above, this is part of the issue that makes depth shots zoomed in.
// Due to the above scratch space allocation failing and thus reset_deferred never
// getting set to true, we end up in here.
// This causes differences between how the final depth shot looks compared to the
// same color snapshot. Make it an option to both depth and color shots can either
// allow cropping or not.
// if image cropping or need to enlarge the scene, compute a scale_factor
F32
ratio
=
llmin
((
F32
)
window_width
/
image_width
,
(
F32
)
window_height
/
image_height
);
snapshot_width
=
(
S32
)(
ratio
*
image_width
);
snapshot_height
=
(
S32
)(
ratio
*
image_height
);
scale_factor
=
llmax
(
1.0
f
,
1.0
f
/
ratio
);
}
}
}
}
//BD - As mentioned above, this is part of the issue that makes depth shots zoomed in.
// Due to the above scratch space allocation failing and thus reset_deferred never
// getting set to true, we end up in here.
// This causes differences between how the final depth shot looks compared to the
// same color snapshot. Make it an option to both depth and color shots can either
// allow cropping or not.
/*if (!reset_deferred &&)
{
// if image cropping or need to enlarge the scene, compute a scale_factor
F32 ratio = llmin( (F32)window_width / image_width , (F32)window_height / image_height) ;
snapshot_width = (S32)(ratio * image_width) ;
snapshot_height = (S32)(ratio * image_height) ;
scale_factor = llmax(1.0f, 1.0f / ratio) ;
}*/
}
if
(
show_ui
&&
scale_factor
>
1.
f
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment