Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
TerrainDescriptor.inl
Go to the documentation of this file.
1
2/*
3 Copyright (c) 2018 DIVIDE-Studio
4 Copyright (c) 2009 Ionut Cava
5
6 This file is part of DIVIDE Framework.
7
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software
10 and associated documentation files (the "Software"), to deal in the Software
11 without restriction,
12 including without limitation the rights to use, copy, modify, merge, publish,
13 distribute, sublicense,
14 and/or sell copies of the Software, and to permit persons to whom the
15 Software is furnished to do so,
16 subject to the following conditions:
17
18 The above copyright notice and this permission notice shall be included in
19 all copies or substantial portions of the Software.
20
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 IMPLIED,
23 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24 PARTICULAR PURPOSE AND NONINFRINGEMENT.
25 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
26 DAMAGES OR OTHER LIABILITY,
27 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
28 IN CONNECTION WITH THE SOFTWARE
29 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
31 */
32
33#pragma once
34#ifndef DVD_TERRAIN_DESCRIPTOR_INL_
35#define DVD_TERRAIN_DESCRIPTOR_INL_
36
37namespace Divide
38{
39 template<>
40 inline size_t GetHash( const TerrainDescriptor& descriptor ) noexcept
41 {
42 size_t hash = 1337;
43
44 for ( const auto& it : descriptor._variables )
45 {
46 Util::Hash_combine( hash, it.first, it.second );
47 }
48
49 for ( hashMap<U64, F32>::value_type it : descriptor._variablesf )
50 {
51 Util::Hash_combine( hash, it.first, it.second );
52 }
53
55 descriptor._active,
56 descriptor._textureLayers,
57 descriptor._altitudeRange.x,
58 descriptor._altitudeRange.y,
59 descriptor._dimensions.x,
60 descriptor._dimensions.y,
61 descriptor._startWidth
62 );
63
64 for ( U8 i = 0; i < descriptor._ringCount; ++i )
65 {
66 Util::Hash_combine( hash, descriptor._ringTileCount[i] );
67 }
68
69 return hash;
70 }
71} //namespace Divide
72
73#endif //DVD_TERRAIN_DESCRIPTOR_INL_
void Hash_combine(size_t &seed, const T &v, const Rest &... rest) noexcept
a la Boost
Definition: MathHelper.inl:799
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
uint8_t U8
size_t GetHash(const PropertyDescriptor< T > &descriptor) noexcept
Definition: Resource.inl:40
hashAlg::unordered_map< K, V, HashFun, Predicate > hashMap
Definition: HashMap.h:55