Cogs.Core
HeightMapComponent.h
1#pragma once
2
3#include "Foundation/ComponentModel/Component.h"
4
5#include <glm/vec3.hpp>
6
7#include <memory>
8#include <vector>
9#include <limits>
10
11namespace Cogs
12{
13 namespace Core
14 {
15
18 {
19 public:
20 enum struct IsoLine : int
21 {
22 None,
23 On,
24 Top,
25 Bottom
26 };
27
28 enum struct TextureDomain : int
29 {
30 Height,
31 XY
32 };
33
35 xIncrement(1.f),
36 yIncrement(1.f),
37 height(1.f),
38 minValue(std::numeric_limits<float>::quiet_NaN()),
39 maxValue(std::numeric_limits<float>::quiet_NaN()),
40 gridLines(false),
41 gridLineOffset(glm::vec3(0.f, 0.f, 0.001f)),
43 isoLineOrigin(std::numeric_limits<float>::quiet_NaN()),
44 isoLineDistance(std::numeric_limits<float>::quiet_NaN()),
46 {}
47
48 static void registerType();
49
50 std::shared_ptr<ComponentModel::Entity> dataSet;
51 std::shared_ptr<ComponentModel::Entity> colorMap;
52 float xIncrement;
53 float yIncrement;
54 float height;
55 float minValue;
56 float maxValue;
57 bool gridLines;
58 glm::vec3 gridLineOffset;
63 };
64
65 } // namespace Core
66} // namespace Cogs
67
68template<> inline Cogs::StringView getName<Cogs::Core::HeightMapComponent>()
69{
70 return "HeightMapComponent";
71}
72
73template<> inline Cogs::StringView getName<Cogs::Core::HeightMapComponent::IsoLine>()
74{
75 return "IsoLine";
76}
77
78template<> inline Cogs::StringView getName<Cogs::Core::HeightMapComponent::TextureDomain>()
79{
80 return "TextureDomain";
81}
Base class for Component instances.
Definition: Component.h:143
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
STL namespace.
float yIncrement
Grid line separation along y axis.
float maxValue
Explicitly set maximum value, set to NaN to use dataset's maximum value.
std::shared_ptr< ComponentModel::Entity > colorMap
Color map used to colorize values from the dataset.
bool gridLines
Enable rendering of grid lines.
@ Bottom
Iso-line on bottom of bounding box.
@ Top
Iso-line on top of bounding box.
@ XY
compute texture coordinates based on the height of the points
std::shared_ptr< ComponentModel::Entity > dataSet
Underlying 2D scalar dataset.
TextureDomain textureDomain
Specify how the texture coordinates of the points in the mesh are computed.
float height
Height of maximum value.
float isoLineDistance
Distance between consecutive iso-lines, set to NaN to use default value.
IsoLine isoLine
Enable iso-line rendering.
glm::vec3 gridLineOffset
Offset of grid lines relative to surface.
float xIncrement
Grid line separation along x axis.
float minValue
Explicitly set minimum value, set to NaN to use dataset's minimum value.
float isoLineOrigin
Value of zero'th iso-line, set to NaN to use current minimum value.