From 5804ee53d3dab3e1a6c01479c349ca37d214b12c Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 8 Sep 2019 10:32:44 -0500 Subject: [PATCH] render distant nodes behind closer nodes (#220) * render distant nodes behind closer nodes * Use common code to calculate rendering order Code style changes to match rest of code base * Method comments get the triple slash treatment * Update changelog --- .../Extensions/SCNNode+Extensions.swift | 1 + .../Nodes/LocationAnnotationNode.swift | 2 ++ Sources/ARKit-CoreLocation/Nodes/LocationNode.swift | 12 ++++++++++++ changelog.md | 1 + 4 files changed, 16 insertions(+) diff --git a/Sources/ARKit-CoreLocation/Extensions/SCNNode+Extensions.swift b/Sources/ARKit-CoreLocation/Extensions/SCNNode+Extensions.swift index e08c819f..e074d766 100644 --- a/Sources/ARKit-CoreLocation/Extensions/SCNNode+Extensions.swift +++ b/Sources/ARKit-CoreLocation/Extensions/SCNNode+Extensions.swift @@ -12,6 +12,7 @@ extension SCNNode { /// Overlapping nodes require unique renderingOrder values to avoid flicker /// This method will select random values if you don't care which node is in front of the other, /// or you can specify a particular z-order value + /// Note: rendering order will be changed later based on distance from camera func removeFlicker (withRenderingOrder renderingOrder: Int = Int.random(in: 1.. Int { + return Int.max - 1000 - (Int(distance * 1000)) + } } diff --git a/changelog.md b/changelog.md index 3694011e..c8d10f7f 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # Changelog - 1.2.2 + - [PR #220 - Render distant nodes behind closer nodes ](https://github.com/ProjectDent/ARKit-CoreLocation/pull/220) - 1.2.1 - [PR #207 - Addresses Issue #136 - ARCL lacks CI ](https://github.com/ProjectDent/ARKit-CoreLocation/pull/207) - [PR #209 - Updates polyline position/scale when GPS location is updated](https://github.com/ProjectDent/ARKit-CoreLocation/pull/209)