Waterflow
Visualize water in terrain
src/shaders/addHeightShader.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) readonly buffer height0 
00010 {
00011     float u0[];
00012     
00013 };
00014 
00015 layout (std430,binding = 10) readonly buffer Terrain 
00016 {   
00017     float terr[];
00018     
00019 };
00020 
00021 layout (std430,binding = 11) writeonly buffer Model 
00022 {   
00023     float outHeight[];
00024     
00025 };
00026 
00027 
00028 
00029 uniform ivec2 size; 
00030 uniform float dt; 
00031 
00032 void main(){
00033     //determine where to sample
00034     ivec2 storePos = ivec2(gl_GlobalInvocationID.xy);
00035     int i = storePos.x;
00036     int j = storePos.y;
00037     int offset = i+j*size.x;
00038 
00039     if(i < size.x && j < size.y) {
00040         
00041         outHeight[offset] = u0[offset] +terr[offset];
00042     }
00043 }
 All Classes Files Functions Variables Enumerations