Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/master' into parts
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanmaierhofer committed Oct 4, 2023
2 parents 1695019 + fcfd3e1 commit 3498aca
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 5.2.27
- [LodTreeInstance] intersect view frustum depth range to -1 +1

### 5.2.26
- [LodTreeInstance] ShouldSplit vfc

Expand Down
42 changes: 40 additions & 2 deletions src/Aardvark.Rendering.PointSet/LodTreeInstance.fs
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,51 @@ module LodTreeInstance =
else
0.0


let intersectsFrustum (vp : M44d) (box : Box3d) =
let r0 = vp.R0
let r1 = vp.R1
let r2 = vp.R2
let r3 = vp.R3
let plane = r3 + r0
let mutable min = V3d.Zero
let mutable max = V3d.Zero
box.GetMinMaxInDirection(plane.XYZ, &min, &max)
if max.Dot(plane.XYZ) + plane.W < 0 then
false
else
let plane = r3 - r0
box.GetMinMaxInDirection(plane.XYZ, &min, &max)
if max.Dot(plane.XYZ) + plane.W < 0 then
false
else
let plane = r3 + r1
box.GetMinMaxInDirection(plane.XYZ, &min, &max)
if max.Dot(plane.XYZ) + plane.W < 0 then
false
else
let plane = r3 - r1
box.GetMinMaxInDirection(plane.XYZ, &min, &max)
if max.Dot(plane.XYZ) + plane.W < 0 then
false
else
let plane = r3 + r2
box.GetMinMaxInDirection(plane.XYZ, &min, &max)
if max.Dot(plane.XYZ) + plane.W < 0 then
false
else
let plane = r3 - r2
box.GetMinMaxInDirection(plane.XYZ, &min, &max)
if max.Dot(plane.XYZ) + plane.W < 0 then
false
else
true

let fov (proj : Trafo3d) =
2.0 * atan(proj.Backward.M00) * Constant.DegreesPerRadian

let equivalentAngle60 (view : Trafo3d) (proj : Trafo3d) =
if localCellBounds.IntersectsFrustum((view * proj).Forward) then
let vp = (view * proj).Forward
if intersectsFrustum vp localCellBounds then

if isOrtho proj then
let width = proj.Backward.M00 * 2.0
Expand Down

0 comments on commit 3498aca

Please sign in to comment.