-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fbf771e
commit 065414e
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#pragma once | ||
|
||
#include <vsg/maths/vec3.h> | ||
|
||
namespace custom | ||
{ | ||
// OpenGL style fog struct to pass to the GPU | ||
struct Fog | ||
{ | ||
vsg::vec3 color = {1.0, 1.0, 1.0}; | ||
float density = 0.05; // OpenGL default is 1.0! | ||
float start = 0.0; | ||
float end = 1.0; | ||
float exponent = 1.0; | ||
|
||
void read(vsg::Input& input) | ||
{ | ||
input.read("color", color); | ||
input.read("density", density); | ||
input.read("start", start); | ||
input.read("end", end); | ||
input.read("exponent", exponent); | ||
} | ||
|
||
void write(vsg::Output& output) const | ||
{ | ||
output.write("color", color); | ||
output.write("density", density); | ||
output.write("start", start); | ||
output.write("end", end); | ||
output.write("exponent", exponent); | ||
} | ||
}; | ||
|
||
using FogValue = vsg::Value<Fog>; | ||
|
||
extern vsg::ref_ptr<vsg::ShaderSet> pbr_ShaderSet(vsg::ref_ptr<const vsg::Options> options); | ||
} | ||
|
||
template<> | ||
constexpr bool vsg::has_read_write<custom::Fog>() { return true; } | ||
|
||
EVSG_type_name(custom::FogValue); |