Waterflow
Visualize water in terrain
src/shaders/addFlowShader.comp
Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 #version 430
00006 
00007 layout(local_size_x = 16, local_size_y = 16) in; 
00008 
00009 layout (std430,binding = 4) buffer height0 
00010 {
00011     float u0[];
00012     
00013 };
00014 
00015 layout (std430, binding = 5) buffer height1 
00016 {
00017     float u1[];
00018     
00019 };
00020 
00021 layout (std430,binding = 6) buffer velocity 
00022 {
00023     float v[];
00024     
00025 };
00026 
00027 layout (std430,binding = 7) buffer terrainHeight 
00028 {   
00029     float terrHeight[];
00030     
00031 };
00032 
00033 layout (std430,binding = 8) buffer addition 
00034 {
00035     float add[];
00036 };
00037 
00038 uniform ivec2 size; 
00039 
00040 void main(){
00041     //determine where to sample
00042     ivec2 storePos = ivec2(gl_GlobalInvocationID.xy);
00043     int i = storePos.x;
00044     int j = storePos.y;
00045     int offset = i+j*size.x;
00046 
00047     if(i < size.x && j < size.y) {
00048         
00049         u0[offset] +=add[offset];
00050     }
00051 }
 All Classes Files Functions Variables Enumerations