Cogs.Core
BasicOceanComponent.h
1#pragma once
2
3#include "Resources/Resources.h"
4
5#include "../../EntityDefinition.h"
6
7namespace Cogs
8{
9 namespace Core
10 {
11 class Context;
12
13 enum struct BasicOceanWaves
14 {
15 Default,
16 Quux
17 };
18
19 enum struct BasicOceanReflection
20 {
21 Planar,
22 EnvSkyBox,
23 EnvRadiance
24 };
25
26 enum struct BasicOceanBeliefSystem
27 {
28 // Earth is flat
29 FlatEarth,
30
31 // Earth is curved, it is assumed that at TransformSystem's
32 // origin, the XY-plane is tangent to the earth.
33 //
34 // This only bends the ocean, you must manually position
35 // entities accordingly. Simplest approach is to adjust the
36 // z coordinate with z = z - (R - sqrt((R-d)*(R+d)), where
37 // R is the radius of earth (6371000) and d is the distance
38 // from the origin. Then tilt the local Z-axis s.t. negative
39 // Z points towards (0,0,-6371000).
40 CurvedEarth
41 };
42
44 {
45 public:
47 glm::vec4 color = glm::vec4(0.f, 0.11f, 0.18f, 1.f);
48
49 BasicOceanWaves waves = BasicOceanWaves::Default;
50
51 BasicOceanBeliefSystem beliefSystem = BasicOceanBeliefSystem::FlatEarth;
52
53 BasicOceanReflection reflection = BasicOceanReflection::Planar;
54
55 bool pbr = false;
56
58 float seaLevel = 0.f;
59
61 float transparency = 0.f;
62
65
66 int fftTileResolutionLog2 = 7;
67
68 float significantWaveHeight = 4.f;
69 float dominantWavePeriod = 25.f;
70 float windSpeed = 10.f;
71 float windDirection = 0.f;
72
73 std::string reflectionTexFormat;
74
75 EntityPtr reflectionCamera;
76
77 static void registerType();
78 };
79 }
80}
81
82template<> inline Cogs::StringView getName<Cogs::Core::BasicOceanComponent>() { return "BasicOceanComponent"; }
83
84template<> inline Cogs::StringView getName<Cogs::Core::BasicOceanWaves>() { return "BasicOceanWaves"; }
85
86template<> inline Cogs::StringView getName<Cogs::Core::BasicOceanBeliefSystem>() { return "BasicOceanBeliefSystem"; }
87
88template<> inline Cogs::StringView getName<Cogs::Core::BasicOceanReflection>() { return "BasicOceanReflection"; }
Base class for Component instances.
Definition: Component.h:143
float reflectionBrightness
Multiplicative factor reflection.
float seaLevel
Vertical displacement of average sea height.
float transparency
Transparency of water.
glm::vec4 color
Color of water. Alpha taken from transparency component.
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
std::shared_ptr< ComponentModel::Entity > EntityPtr
Smart pointer for Entity access.
Definition: EntityPtr.h:12
Contains all Cogs related functionality.
Definition: FieldSetter.h:23