-
Notifications
You must be signed in to change notification settings - Fork 1
/
BlendedTerrainEffect.h
107 lines (88 loc) · 3.01 KB
/
BlendedTerrainEffect.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// David Eberly, Geometric Tools, Redmond WA 98052
// Copyright (c) 1998-2022
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
// https://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
// Version: 6.0.2022.01.06
#pragma once
#include <Applications/Environment.h>
#include <Graphics/Graphics.h>
#include <Graphics/Texture1.h>
#include <Graphics/Texture2.h>
#include <Graphics/VisualEffect.h>
#include <Mathematics/Vector2.h>
namespace gte
{
class BlendedTerrainEffect : public VisualEffect
{
public:
// Construction.
BlendedTerrainEffect(std::shared_ptr<GraphicsEngine> const& engine,
std::shared_ptr<ProgramFactory> const& factory,
Environment const& environment, bool& created);
// Member access.
virtual void SetPVWMatrixConstant(std::shared_ptr<ConstantBuffer> const& buffer);
inline void SetFlowDirection(Vector2<float> const& flowDirection)
{
*mFlowDirection = flowDirection;
}
inline Vector2<float> const& GetFlowDirection() const
{
return *mFlowDirection;
}
inline std::shared_ptr<ConstantBuffer> const& GetFlowDirectionConstant() const
{
return mFlowDirectionConstant;
}
inline void SetPowerFactor(float powerFactor)
{
*mPowerFactor = powerFactor;
}
inline float GetPowerFactor() const
{
return *mPowerFactor;
}
inline std::shared_ptr<ConstantBuffer> const& GetPowerFactorConstant() const
{
return mPowerFactorConstant;
}
inline std::shared_ptr<Texture1> const& GetBlendTexture() const
{
return mBlendTexture;
}
inline std::shared_ptr<Texture2> const& GetGrassTexture() const
{
return mGrassTexture;
}
inline std::shared_ptr<Texture2> const& GetStoneTexture() const
{
return mStoneTexture;
}
inline std::shared_ptr<Texture2> const& GetCloudTexture() const
{
return mCloudTexture;
}
inline std::shared_ptr<SamplerState> const& GetCommonSampler() const
{
return mCommonSampler;
}
inline std::shared_ptr<SamplerState> const& GetBlendSampler() const
{
return mBlendSampler;
}
private:
// Vertex shader parameter.
std::shared_ptr<ConstantBuffer> mFlowDirectionConstant;
// Pixel shader parameters.
std::shared_ptr<ConstantBuffer> mPowerFactorConstant;
std::shared_ptr<Texture1> mBlendTexture;
std::shared_ptr<Texture2> mGrassTexture;
std::shared_ptr<Texture2> mStoneTexture;
std::shared_ptr<Texture2> mCloudTexture;
std::shared_ptr<SamplerState> mCommonSampler;
std::shared_ptr<SamplerState> mBlendSampler;
// Convenience pointers.
Vector2<float>* mFlowDirection;
float* mPowerFactor;
};
}