diff --git a/R/plot_3d.R b/R/plot_3d.R index d781291f..76b0aefc 100644 --- a/R/plot_3d.R +++ b/R/plot_3d.R @@ -34,13 +34,13 @@ #'#Plotting a spherical texture map of the built-in `montereybay` dataset. #'montereybay %>% #' sphere_shade(texture="desert") %>% -#' plot_3d(montereybay,waterdepth=0) +#' plot_3d(montereybay,zscale=50) #' #'#With a water layer #'montereybay %>% #' sphere_shade(texture="imhof2") %>% #' plot_3d(montereybay, zscale=50, water = TRUE, watercolor="imhof2", -#' waterlinecolor="white", waterlinealpha=0.5, windowsize=c(1000,1000)) +#' waterlinecolor="white", waterlinealpha=0.5) plot_3d = function(hillshade, heightmap, zscale=1, solid = TRUE, soliddepth="auto", solidcolor="grey20",solidlinecolor="grey40", shadow = TRUE, shadowdepth = "auto", shadowwidth = "auto", shadowalpha=1, @@ -52,7 +52,7 @@ plot_3d = function(hillshade, heightmap, zscale=1, #setting default zscale if montereybay is used and tell user about zscale argnameschar = unlist(lapply(as.list(sys.call()),as.character))[-1] argnames = as.list(sys.call()) - if(argnameschar[2] == "montereybay" || argnameschar["heightmap"] == "montereybay") { + if(argnameschar[2] == "montereybay" || (!is.na(argnameschar["heightmap"]) && argnameschar["heightmap"] == "montereybay")) { if (!("zscale" %in% as.character(names(argnames)))) { if(length(argnames) <= 3) { zscale = 200 diff --git a/R/ray_shade.R b/R/ray_shade.R index b4b04369..d1c71879 100644 --- a/R/ray_shade.R +++ b/R/ray_shade.R @@ -77,7 +77,7 @@ ray_shade = function(heightmap, anglebreaks=seq(40,50,1), sunangle=315, maxsearc doParallel::registerDoParallel(cl, cores = numbercores) shadowmatrixlist = tryCatch({ foreach::foreach(i=1:nrow(heightmap), .packages = c("rayshader")) %dopar% { - rayshade_multicore(sunangle = sunangle_rad, anglebreaks = anglebreaks_rad, + rayshader:::rayshade_multicore(sunangle = sunangle_rad, anglebreaks = anglebreaks_rad, heightmap = flipud(heightmap), zscale = zscale, maxsearch = maxsearch, row = i-1, cache_mask = cache_mask[i,]) } diff --git a/man/plot_3d.Rd b/man/plot_3d.Rd index fb272904..64988c65 100644 --- a/man/plot_3d.Rd +++ b/man/plot_3d.Rd @@ -71,11 +71,11 @@ Displays the shaded map in 3D with the `rgl` package. #Plotting a spherical texture map of the built-in `montereybay` dataset. montereybay \%>\% sphere_shade(texture="desert") \%>\% - plot_3d(montereybay, zscale=50) + plot_3d(montereybay,zscale=50) #With a water layer montereybay \%>\% - sphere_shade(texture="desert") \%>\% - plot_3d(montereybay, zscale=50, water = TRUE, watercolor="desert", + sphere_shade(texture="imhof2") \%>\% + plot_3d(montereybay, zscale=50, water = TRUE, watercolor="imhof2", waterlinecolor="white", waterlinealpha=0.5) }