Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #version 450
- #extension GL_ARB_separate_shader_objects : enable
- layout(binding = 1) uniform sampler2D texSampler;
- struct Vertex{
- vec3 pos;
- vec3 color;
- vec2 texCoord;
- };
- layout(binding = 2) buffer storage{
- Vertex vertices[];
- } st;
- layout(location = 0) in vec3 fragPos;
- layout(location = 1) in vec2 fragTexCoord;
- layout(location = 2) flat in int index;
- layout(location = 0) out vec4 outColor;
- float e = 2.718281828;
- float iso = 0.2;
- float k = 4.0;
- float skalarFeld(vec3 x){
- float s=0;
- for(int i=0; i<16; ++i){
- s = s + pow(e, -k * length(x - st.vertices[i].pos));
- }
- return s;
- }
- void main() {
- for( float f=0; f <= 2.0; f=f+0.05){
- float s=skalarFeld(fragPos * f);
- if(s >= iso){
- outColor = vec4(fragPos, 1.0); // * texture(texSampler, fragTexCoord);
- break;
- }else
- {
- outColor = vec4(1.0, 1.0, 1.0, 1.0);
- outColor = vec4(s, s, s, 1.0);
- break;
- }
- }
- //outColor = vec4(st.vertices[index].pos, 1.0);
- //outColor = vec4(fragPos, 1.0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement