Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix background issues #422

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: rgl
Version: 1.3.5
Version: 1.3.6
Title: 3D Visualization Using OpenGL
Authors@R: c(person("Duncan", "Murdoch", role = c("aut", "cre"),
email = "[email protected]"),
Expand Down
8 changes: 7 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# rgl 1.3.5
# rgl 1.3.6

## Minor changes

* `readSTL()` can now read (some) ASCII format STL files.

## Bug fixes

* Background plots did not always appear (issue #421).
* Changing the background resulted in an additional background
object instead of replacing the current one.

# rgl 1.3.4

## Bug fixes
Expand Down
3 changes: 2 additions & 1 deletion R/bgplot3d.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ bgplot3d <- function(expression, bg.color = getr3dDefaults("bg", "color"),
grDevices::devAskNewPage(FALSE)
value <- try(expression)
safe.dev.off()
result <- bg3d(texture = filename, col = "white", lit = FALSE, ...)
result <- bg3d(texture = filename, col = "white", lit = FALSE,
front = "filled", back = "filled", ...)
} else {
value <- NULL
result <- bg3d(col = bg.color, ...)
Expand Down
1 change: 1 addition & 0 deletions R/r3d.rgl.R
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ bg3d <- function(color,
else if (flags["exp_fog", 1]) "exp"
else if (flags["exp2_fog", 1]) "exp2"
else "none"
pop3d(type = "background", id = bgid)
}
dots <- list(...)

Expand Down
3 changes: 3 additions & 0 deletions inst/htmlwidgets/lib/rglClass/draw.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -1167,14 +1167,17 @@
savepr = this.prMatrix;
saveinvpr = this.invPrMatrix;
savemv = this.mvMatrix;
savenorm = this.normMatrix;
this.prMatrix = new CanvasMatrix4();
this.invPrMatrix = new CanvasMatrix4();
this.mvMatrix = new CanvasMatrix4();
this.normMatrix = new CanvasMatrix4();
for (i=0; i < obj.quad.length; i++)
result = result.concat(this.drawObjId(obj.quad[i], subsceneid));
this.prMatrix = savepr;
this.invPrMatrix = saveinvpr;
this.mvMatrix = savemv;
this.normMatrix = savenorm;

} else if (obj.sphere) {
subscene = this.getObj(subsceneid);
Expand Down
Binary file modified tests/testthat/testdata/mergeVertices.rds
Binary file not shown.
Binary file modified tests/testthat/testdata/obj.rds
Binary file not shown.
Binary file modified tests/testthat/testdata/qmesh3d.rds
Binary file not shown.
Binary file modified tests/testthat/testdata/r3d.rds
Binary file not shown.
Binary file modified tests/testthat/testdata/shade3detc.rds
Binary file not shown.
Binary file modified tests/testthat/testdata/subscenes.rds
Binary file not shown.
Binary file modified tests/testthat/testdata/tmesh3d.rds
Binary file not shown.
Binary file modified tests/testthat/testdata/transformations.rds
Binary file not shown.
Loading