File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -199,6 +199,39 @@ struct LayerView : LayerViewBase
199199 // /@}
200200};
201201
202+ /* * @cond INTERNAL */
203+ namespace detail
204+ {
205+ inline std::uint64_t fnv1a64_bytes (
206+ const void * data, std::size_t n,
207+ std::uint64_t seed = 1469598103934665603ULL )
208+ {
209+ const auto * p = static_cast <const std::uint8_t *>(data);
210+ std::uint64_t h = seed;
211+ for (std::size_t i = 0 ; i < n; ++i) {
212+ h ^= p[i]; h *= 1099511628211ULL ;
213+ }
214+ return h;
215+ }
216+ } // namespace detail
217+ /* * @endcond */
218+
219+ template <typename T>
220+ std::uint64_t LayerView<T>::content_hash() const
221+ {
222+ if (!hash_dirty_) {return hash_cache_;}
223+ const std::size_t n = data_.size ();
224+ std::uint64_t h = navmap::detail::fnv1a64_bytes (&n, sizeof (n));
225+ if (n) {
226+ static_assert (std::is_trivially_copyable<T>::value,
227+ " LayerView<T> requires trivially copyable T." );
228+ h = navmap::detail::fnv1a64_bytes (data_.data (), n * sizeof (T), h);
229+ }
230+ hash_cache_ = h;
231+ hash_dirty_ = false ;
232+ return hash_cache_;
233+ }
234+
202235/* *
203236 * \brief Registry of named layers (per-NavCel).
204237 *
Original file line number Diff line number Diff line change 2525namespace navmap
2626{
2727
28- /* * @cond INTERNAL */
29- namespace navmap
30- {namespace detail
31- {
32- inline std::uint64_t fnv1a64_bytes (
33- const void * data, std::size_t n,
34- std::uint64_t seed = 1469598103934665603ULL )
35- {
36- const auto * p = static_cast <const std::uint8_t *>(data);
37- std::uint64_t h = seed;
38- for (std::size_t i = 0 ; i < n; ++i) {
39- h ^= p[i]; h *= 1099511628211ULL ;
40- }
41- return h;
42- }
43- }} // namespaces
44- /* * @endcond */
45-
46- template <typename T>
47- std::uint64_t LayerView<T>::content_hash() const
48- {
49- if (!hash_dirty_) {return hash_cache_;}
50- const std::size_t n = data_.size ();
51- std::uint64_t h = navmap::detail::fnv1a64_bytes (&n, sizeof (n));
52- if (n) {
53- static_assert (std::is_trivially_copyable<T>::value,
54- " LayerView<T> requires trivially copyable T." );
55- h = navmap::detail::fnv1a64_bytes (data_.data (), n * sizeof (T), h);
56- }
57- hash_cache_ = h;
58- hash_dirty_ = false ;
59- return hash_cache_;
60- }
6128
6229namespace
6330{
@@ -472,7 +439,7 @@ bool NavMap::raycast(
472439{
473440 bool any = false ;
474441 float best_t = std::numeric_limits<float >::infinity ();
475- Vec3 best_p;
442+ Vec3 best_p = Vec3::Zero () ;
476443 NavCelId best_cid = 0 ;
477444
478445 for (const auto & s : surfaces) {
You can’t perform that action at this time.
0 commit comments