tylermorganwall / rayrender

A pathtracer for R. Build and render complex scenes and 3D data visualizations directly from R
http://www.rayrender.net
622 stars 43 forks source link

maybe be quads and no triangles #22

Closed mdsumner closed 3 years ago

mdsumner commented 3 years ago

current code assumes triangles always present, but they might not be

mdsumner commented 3 years ago

any chance to get this in, maybe dropped off the radar?

tylermorganwall commented 3 years ago

Do you have a test case I can run this on before merging? Just a few lines that generates a quad-only mesh so I can add it to my tests.

mdsumner commented 3 years ago

oh dang can't believe I didn't do that ...

qm <- 
structure(list(vb = structure(c(0, 3, 100, 1, 1, 3, 100, 1, 2, 
3, 100.5, 1, 3, 3, 101, 1, 4, 3, 101, 1, 0, 2, 100.5, 1, 1, 2, 
100.5, 1, 2, 2, 101, 1, 3, 2, 101.5, 1, 4, 2, 101.5, 1, 0, 1, 
101.5, 1, 1, 1, 101.5, 1, 2, 1, 102, 1, 3, 1, 102.5, 1, 4, 1, 
102.5, 1, 0, 0, 102, 1, 1, 0, 102, 1, 2, 0, 102.5, 1, 3, 0, 103, 
1, 4, 0, 103, 1), .Dim = c(4L, 20L)), ib = structure(c(1, 2, 
7, 6, 2, 3, 8, 7, 3, 4, 9, 8, 4, 5, 10, 9, 6, 7, 12, 11, 7, 8, 
13, 12, 8, 9, 14, 13, 9, 10, 15, 14, 11, 12, 17, 16, 12, 13, 
18, 17, 13, 14, 19, 18, 14, 15, 20, 19), .Dim = c(4L, 12L)), 
    material = list(), normals = NULL, texcoords = NULL, meshColor = "vertices"), class = c("mesh3d", 
"shape3d"))
tylermorganwall commented 3 years ago

Great, thanks for the fix!