add upper spheres
This commit is contained in:
parent
1c672e0f42
commit
55d9620983
|
@ -11,6 +11,34 @@ RayHit trace(inout Ray ray)
|
|||
intersectSphere(ray, hit, _spheres[i]);
|
||||
}
|
||||
|
||||
int sphereCount = 10;
|
||||
for (int i = 0; i < sphereCount; i++)
|
||||
{
|
||||
Sphere s;
|
||||
float a = i/float(sphereCount)*2.0*PI;
|
||||
float d = 17.0 + cos((1.3+a)*3.0) * 3.0;
|
||||
float r = 4.0 + sin(a*3.0)*2.0;
|
||||
s.cr = vec4(sin(a)*d,2.0*r+cos(a*5.0),cos(a)*d, r);
|
||||
s.albedo = vec3(.2);
|
||||
s.material = i % 3 == 0 ? MAT_CHROME : MAT_LAMBERT;
|
||||
|
||||
intersectSphere(ray, hit, s);
|
||||
}
|
||||
|
||||
sphereCount = 3;
|
||||
for (int i = 0; i < sphereCount; i++)
|
||||
{
|
||||
Sphere s;
|
||||
float a = i/float(sphereCount)*2.0*PI;
|
||||
float d = 5.0 + cos((5.34+a)*5.0) * 3.0;
|
||||
float r = 3.0 + sin(a*2.0)*1.5;
|
||||
s.cr = vec4(sin(a)*d,4.0*r+cos(a*5.0),cos(a)*d, r);
|
||||
s.albedo = vec3(.2);
|
||||
s.material = i % 3 == 0 ? MAT_CHROME : MAT_LAMBERT;
|
||||
|
||||
intersectSphere(ray, hit, s);
|
||||
}
|
||||
|
||||
ray.distance += hit.distance * float(hit.distance < INF);
|
||||
|
||||
return hit;
|
||||
|
|
|
@ -135,7 +135,7 @@ void updateUniforms(GLuint shaderProgram, float t)
|
|||
updateCameraUniforms(shaderProgram, aspect, t);
|
||||
|
||||
// make and update spheres
|
||||
const int sphereCount = 41;
|
||||
const int sphereCount = 25;
|
||||
struct Sphere spheres[sphereCount];
|
||||
makeSpheres(spheres, sphereCount, t);
|
||||
updateSphereUniforms(shaderProgram, spheres, sphereCount);
|
||||
|
|
|
@ -30,13 +30,13 @@ void makeSpheres(struct Sphere *spheres, int count, float t)
|
|||
int rainbowSpheres = count - middleSpheres;
|
||||
// distance from center
|
||||
float d = 6.0;
|
||||
radius = 0.5;
|
||||
radius = 0.7;
|
||||
float x;
|
||||
for (int i = 0; i < rainbowSpheres; i++)
|
||||
{
|
||||
x = 2.0*CGLM_PI * (float)i/(float)rainbowSpheres;
|
||||
sc[0] = sin(x)*d;
|
||||
sc[1] = sin(x*3.0-5.0*sin(t));
|
||||
sc[1] = radius*sin(x*3.0-5.0*sin(t));
|
||||
sc[2] = cos(x)*d;
|
||||
|
||||
float ic = i/(float)rainbowSpheres*CGLM_PI*2.0;
|
||||
|
|
Loading…
Reference in New Issue