Skip to content

Commit

Permalink
rayshader v0.38.6: Update rayimage dependency to fix text in HQ rende…
Browse files Browse the repository at this point in the history
…rs and scalebars
  • Loading branch information
tylermorganwall committed Dec 24, 2024
1 parent 368457a commit 206b27f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 23 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: rayshader
Type: Package
Title: Create Maps and Visualize Data in 2D and 3D
Version: 0.38.5
Date: 2024-12-22
Version: 0.38.6
Date: 2024-12-23
Authors@R:
person("Tyler", "Morgan-Wall", email = "[email protected]",role = c("aut", "cph", "cre"),
comment = c(ORCID = "0000-0002-3131-3814"))
Expand All @@ -26,7 +26,7 @@ Imports: doParallel,
utils,
methods,
terrainmeshr,
rayimage (>= 0.12.1),
rayimage (>= 0.14.4),
rayvertex (>= 0.11.4),
rayrender (>= 0.36.5)
Suggests:
Expand Down
23 changes: 9 additions & 14 deletions R/render_highquality.R
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ render_highquality = function(filename = NA, samples = 128,
override_material = FALSE,
cache_scene = FALSE, reset_scene_cache = FALSE,
width = NULL, height = NULL,
text_angle = NULL, text_size = 6, text_offset = c(0,0,0),
text_angle = NULL, text_size = 12, text_offset = c(0,text_size/2,0),
line_radius=0.5, point_radius = 0.5, smooth_line = FALSE,
use_extruded_paths = FALSE,
scale_text_angle = NULL, scale_text_size = 6, scale_text_offset = c(0,0,0),
scale_text_angle = NULL, scale_text_size = 12, scale_text_offset = c(0,scale_text_size/2,0),
title_text = NULL, title_offset = c(20,20),
title_color = "black", title_size = 30, title_font = "sans",
title_bar_color = NULL, title_bar_alpha = 0.5,
Expand Down Expand Up @@ -434,9 +434,8 @@ render_highquality = function(filename = NA, samples = 128,
x=temp_center[j,1] - bbox_center[1] + text_offset[1],
y=temp_center[j,2] - bbox_center[2] + text_offset[2],
z=temp_center[j,3] - bbox_center[3] + text_offset[3],
angle = anglevec,
text_height = text_size,
material = rayrender::diffuse(color = temp_color[j,1:3]))
angle = anglevec,
text_height = text_size, font_color = temp_color[j,1:3])
counter = counter + 1
}
}
Expand Down Expand Up @@ -528,11 +527,6 @@ render_highquality = function(filename = NA, samples = 128,
temp_center = rgl.attrib(scalelabelids[i], "centers")
temp_color = rgl.attrib(scalelabelids[i], "colors")
for(j in seq_len(nrow(temp_label))) {
scalelabelfile = tempfile(fileext = ".png")
rayimage::add_title(matrix(0,ncol = nchar(temp_label[j,1])*60, nrow=60),
title_size = 60,
title_offset = c(0,0),title_text = temp_label, title_color = "white",
title_position = "center", filename = scalelabelfile)
if(is.null(text_angle)) {
anglevec = c(-phi,theta,0)
} else {
Expand All @@ -542,12 +536,11 @@ render_highquality = function(filename = NA, samples = 128,
anglevec = text_angle
}
}
scalelabels[[counter]] = rayrender::xy_rect(x=temp_center[j,1] - bbox_center[1] + scale_text_offset[1],
scalelabels[[counter]] = rayrender::text3d(x=temp_center[j,1] - bbox_center[1] + scale_text_offset[1],
y=temp_center[j,2] - bbox_center[2] + scale_text_offset[2],
z=temp_center[j,3] - bbox_center[3] + scale_text_offset[3],
angle = anglevec,
xwidth = nchar(temp_label[j,1])*scale_text_size, ywidth = scale_text_size,
material = rayrender::diffuse(color = temp_color[j,1:3], alpha_texture = scalelabelfile))
angle = anglevec, label = temp_label,
text_height = scale_text_size, font_color = temp_color[j,1:3])
counter = counter + 1
}
}
Expand Down Expand Up @@ -646,11 +639,13 @@ render_highquality = function(filename = NA, samples = 128,
clamp_value = clamp_value, ...)
if(has_title) {
if(is.na(filename)) {
temp = rayimage::ray_read_image(temp)
rayimage::add_title(temp, title_text = title_text, title_color = title_color,
title_font = title_font, title_offset = title_offset,
title_bar_alpha = title_bar_alpha, title_bar_color = title_bar_color,
title_size = title_size, preview = TRUE)
} else {
temp = rayimage::ray_read_image(temp)
rayimage::add_title(temp, title_text = title_text, title_color = title_color,
title_font = title_font, title_offset = title_offset,
title_bar_alpha = title_bar_alpha, title_bar_color = title_bar_color,
Expand Down
2 changes: 1 addition & 1 deletion R/render_scalebar.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#'if(run_documentation()) {
#'#This function works with `render_highquality()`
#'render_highquality(lightdirection = 250, lightaltitude = 40,
#' scale_text_size = 24, clamp_value = 10,
#' scale_text_size = 36, clamp_value = 10,
#' sample_method = "sobol_blue", samples = 128)
#'render_scalebar(clear_scalebar = TRUE)
#'}
Expand Down
8 changes: 4 additions & 4 deletions man/render_highquality.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/render_scalebar.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 206b27f

Please sign in to comment.