Browse Source

bump the test example

master
gradient 8 years ago
parent
commit
96378d36bd
1 changed files with 13 additions and 4 deletions
  1. +13
    -4
      examples/test/shaders/test.frag

+ 13
- 4
examples/test/shaders/test.frag View File

@ -30,8 +30,8 @@ vec3 ray_dir(float fov, vec2 uv) {
}
SceneResult scene_f(vec3 p) {
SceneResult ball = SceneResult(length(p-vec3(0, 2, 0)) - 2, 3.);
SceneResult ball2 = SceneResult(length(p-vec3(2*sin(u_Time), 2-2*cos(u_Time), 0)) - 1, 3.);
//SceneResult ball = SceneResult(length(p-vec3(0, 2, 0)) - 2, 3.);
//SceneResult ball2 = SceneResult(length(p-vec3(2*sin(u_Time), 2-2*cos(u_Time), 0)) - 1, 3.);
SceneResult plane = SceneResult(p.y+5, 2.);
// SceneResult box = SceneResult(
@ -48,7 +48,16 @@ SceneResult scene_f(vec3 p) {
// fBox(p, vec3(1)),
// 1.);
SceneResult res = min_sr(min_sr(ball, ball2), plane);
// SceneResult res = min_sr(min_sr(ball, ball2), plane);
p -= vec3(0, 2, 0);
//pR(p.yz, u_Time);
//float d = max(abs(p.x), max(abs(p.y), abs(p.z))) - 2.;
//float d = fBox(p, vec3(2));
float d = fCircle(p, 3) - 1;
SceneResult res = min_sr(plane, SceneResult(d, 3.));
return res;
}
@ -93,7 +102,7 @@ vec4 shade_material(vec3 p, vec3 norm, float mat_idx) {
return vec4(vec3(mix(0.8, 1.0, checker(p.xz))), 1);
}
if (mat_idx <= 3.0) {
return vec4(mix(vec3(0), vec3(0.05, 0, 0.1), dot(vec3(3, 3, 3), norm)), 1);
return mix(vec4(vec3(0), 1), vec4(0.05, 0, 0.1, 1), dot(vec3(3, 3, 3), norm));
}
return vec4(1, 0, 0, 1);


Loading…
Cancel
Save