RE: LDCad 1.6 Alpha 2 (win+linux)
2016-05-10, 19:17 (This post was last modified: 2016-05-10, 19:30 by Roland Melkert.)
2016-05-10, 19:17 (This post was last modified: 2016-05-10, 19:30 by Roland Melkert.)
(2016-05-10, 17:43)Travis Cobbs Wrote: Given that many Lego blocks are rectangular, I think adding a bounding box check for all parts that pass the bounding sphere check would be relatively fast, and improve things a lot. You can always add tighter checks later for parts that pass the bounding box check.
Another alternative is to do pixel-accurate tests, but this will only work if you are using old enough OpenGL for picking mode to be supported. I'm pretty sure that as long as you don't enable Z buffer, then picking mode can be used to find everything in the rectangle, even parts that are hidden by closer parts. But if picking mode isn't present, the pixel-color-based alternatives won't work, since they'll only tell you about the objects that aren't hidden by closer objects.
Yes, I was looking at this
http://www.lighthouse3d.com/tutorials/vi...ing-boxes/
But it could still give false positives. That wouldn't be a big problem when doing rendering culling but in the this usage case it is unwanted.
Final stage would be to test all the part's vertices to see if at least one of them is inside the region, but again it might be overlapping without any of them actually inside.
Fun stuff
edit: edit: never mind.