feat: added sin distortions
This commit is contained in:
4
main.cpp
4
main.cpp
@@ -112,8 +112,12 @@ int main(int argc, char **argv) {
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glUseProgram(shaderProgram);
|
||||
|
||||
int aspectLocation = glGetUniformLocation(shaderProgram, "aspect");
|
||||
glUniform1f(aspectLocation, aspect);
|
||||
int timeLocation = glGetUniformLocation(shaderProgram, "t");
|
||||
glUniform1f(timeLocation, 2. * glfwGetTime());
|
||||
|
||||
glBindVertexArray(fsq.getVAO());
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
|
||||
|
||||
3
sdf.glsl
3
sdf.glsl
@@ -5,6 +5,7 @@ out vec4 FragColor;
|
||||
in vec2 texCoords;
|
||||
|
||||
uniform float aspect;
|
||||
uniform float t;
|
||||
|
||||
vec3 center = vec3(0.0,-4.0,20.0);
|
||||
float radius = 5.0;
|
||||
@@ -55,7 +56,7 @@ float planeMin(vec3 pos){
|
||||
}
|
||||
|
||||
float sphereMin(vec3 pos){
|
||||
return length(pos - center) - radius;
|
||||
return length(pos - center) - radius + 0.2*sin(5*pos.x+t)*sin(5*pos.y+t)*sin(5*pos.z+t);
|
||||
}
|
||||
|
||||
Ray minFn(Ray ray){
|
||||
|
||||
Reference in New Issue
Block a user