-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from nilspettersson/develop
Develop
- Loading branch information
Showing
26 changed files
with
1,237 additions
and
557 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
float sdSphere( vec3 p, float s ) | ||
{ | ||
return length(p)-s; | ||
} | ||
|
||
float sdplane( vec3 p, float y) | ||
{ | ||
return p.y - y; | ||
} | ||
|
||
float sdBox( vec3 p, vec3 b ) | ||
{ | ||
vec3 q = abs(p) - b; | ||
return length(max(q,0.0)) + min(max(q.x,max(q.y,q.z)),0.0); | ||
} | ||
|
||
|
||
|
||
vec3 opRepLim(vec3 p, float c, vec3 l) | ||
{ | ||
p = p - c * clamp(round(p / c), -l, l); | ||
return p; | ||
} | ||
|
||
vec3 opRep( vec3 p, float c ) | ||
{ | ||
p = mod( p + 0.5 * c, c) - 0.5 * c; | ||
return p; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include lib/rayMarching.glsl; | ||
#include lib/sdf.glsl; | ||
|
||
uniforms{ | ||
int x | ||
} | ||
|
||
float sdf(vec3 p){ | ||
float plane = sdplane(p, -1); | ||
|
||
p = opRepLim(p, 4, vec3(500, 0, 500)); | ||
float box = sdBox(p - vec3(0, 0, 0), vec3(1, 1, 1) ); | ||
|
||
return min(box, plane); | ||
} | ||
|
||
fragment{ | ||
|
||
Ray ray = getRay(); | ||
ray = rayMarch(ray); | ||
|
||
if(ray.length != -1){ | ||
return rayMarchDiffuse(ray, vec3(1)) + rayMarchAmbient(ray, vec3(0.2, 0.3, 0.4), 1); | ||
} | ||
else{ | ||
vec3 col = vec3(0.40, 0.46, 0.60) - ((1 - ray.dir.y) * 0.3); | ||
return vec4(col, 1); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.