Commit 9068040b by Denis Salem

add bell shader

parent d7ad5ba5
......@@ -15,13 +15,13 @@ namespace ProceduralEngine {
HeightmapBrushes(int * seed);
~HeightmapBrushes();
Heightmap * GetNonOrientableBrushes(int id);
Heightmap * GetVoronoiBrushes0(int id);
Heightmap * GetVoronoiBrushes1(int id);
Heightmap * GetVoronoiBrushes2(int id);
Heightmap * GetPerlinBrushes(int id);
Heightmap * GetWarpBrushes(int id);
Heightmap * GetTurbulenceBrushes(int id);
Heightmap * GetNonOrientableBrush(int id);
Heightmap * GetVoronoiBrush0(int id);
Heightmap * GetVoronoiBrush1(int id);
Heightmap * GetVoronoiBrush2(int id);
Heightmap * GetPerlinBrush(int id);
Heightmap * GetWarpBrush(int id);
Heightmap * GetTurbulenceBrush(int id);
int GetScale();
......@@ -33,6 +33,7 @@ namespace ProceduralEngine {
Heightmap * m_PerlinBrushes;
Heightmap * m_WarpBrushes;
Heightmap * m_TurbulenceBrushes;
int * m_Seed;
int m_Scale;
};
......
......@@ -2,4 +2,6 @@
#define INC_PROCEDURAL_ENGIN
#define SEED_SIZE 4096
#endif
#version 430
layout (local_size_x = 1, local_size_y = 1) in;
layout(r32ui, binding = 0) uniform coherent volatile uimageBuffer bell;
uniform uint brushScale;
float Interpolate(float t) {
return 6 * pow(t,5) - 15 * pow(t,4) + 10 * pow(t,3);
}
uint GetElevation(uvec2 coord) {
int halfScale = int(brushScale >> 1);
int x = int(coord.x - halfScale);
int y = int(coord.y - halfScale);
float radius = sqrt(x*x + y*y) / halfScale;
return uint( (1.0 - Interpolate(radius)) * 4294967295.0);
}
void main() {
imageStore(bell, int(gl_GlobalInvocationID.x + gl_GlobalInvocationID.y*brushScale*4), uvec4(GetElevation(gl_GlobalInvocationID.xy)));
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment