Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
TerrainDescriptor.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31
32#pragma once
33#ifndef DVD_TERRAIN_DESCRIPTOR_H_
34#define DVD_TERRAIN_DESCRIPTOR_H_
35
38
39namespace Divide {
40
41class Terrain;
42
43template<>
44struct PropertyDescriptor<Terrain>
45{
46 using LayerDataEntry = std::array<vec2<F32>, 4>;
47 using LayerData = std::array<LayerDataEntry, 8>;
48
50 hashMap<U64, F32> _variablesf{};
51 LayerData _layerDataEntries{};
52 std::array<U8, 16> _ringTileCount = {};
53 string _name;
54 vec2<F32> _altitudeRange{0.f, 1.f};
55 vec2<U16> _dimensions{ U16_ONE, U16_ONE };
56 F32 _startWidth{0.25f};
57 U8 _ringCount{4u};
58 U8 _textureLayers{1u};
59 bool _active{false};
60};
61
63
64template<>
65inline size_t GetHash( const TerrainDescriptor& descriptor ) noexcept;
66
67void Init( TerrainDescriptor& descriptor, std::string_view name );
68
69[[nodiscard]] bool LoadFromXML( TerrainDescriptor& descriptor, const boost::property_tree::ptree& pt, std::string_view name );
70 void SaveToXML( const TerrainDescriptor& descriptor, boost::property_tree::ptree& pt);
71
72void AddVariable( TerrainDescriptor& descriptor, std::string_view name, std::string_view value );
73[[nodiscard]] string GetVariable( const TerrainDescriptor& descriptor, std::string_view name );
74
75void AddVariableF( TerrainDescriptor& descriptor, std::string_view name, F32 value );
76[[nodiscard]] F32 GetVariableF( const TerrainDescriptor& descriptor, std::string_view name );
77
78[[nodiscard]] U32 MaxNodesPerStage( const TerrainDescriptor& descriptor ) noexcept;
79[[nodiscard]] U8 TileRingCount( const TerrainDescriptor& descriptor, const U8 index ) noexcept;
80
81} // namespace Divide
82
83#endif //DVD_TERRAIN_DESCRIPTOR_H_
84
85#include "TerrainDescriptor.inl"
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
U32 MaxNodesPerStage(const TerrainDescriptor &descriptor) noexcept
void AddVariable(TerrainDescriptor &descriptor, std::string_view name, std::string_view value)
uint8_t U8
F32 GetVariableF(const TerrainDescriptor &descriptor, std::string_view name)
size_t GetHash(const PropertyDescriptor< T > &descriptor) noexcept
Definition: Resource.inl:40
void SaveToXML(const TerrainDescriptor &descriptor, boost::property_tree::ptree &pt)
hashAlg::unordered_map< K, V, HashFun, Predicate > hashMap
Definition: HashMap.h:55
bool LoadFromXML(TerrainDescriptor &descriptor, const boost::property_tree::ptree &pt, std::string_view name)
string GetVariable(const TerrainDescriptor &descriptor, std::string_view name)
constexpr U16 U16_ONE
void AddVariableF(TerrainDescriptor &descriptor, std::string_view name, F32 value)
void Init(ImTextureID texture1, ImTextureID texture2, ImTextureID dockTexture)
uint32_t U32
U8 TileRingCount(const TerrainDescriptor &descriptor, const U8 index) noexcept
std::array< vec2< F32 >, 4 > LayerDataEntry
std::array< LayerDataEntry, 8 > LayerData