Implement perlin noise

This commit is contained in:
CJSatnarine
2024-07-09 16:18:02 -04:00
parent 4c58e4a084
commit 0374a95639
13 changed files with 358872 additions and 358757 deletions

View File

@@ -143,8 +143,32 @@ void funny() {
cam.render(hittableList(object));
}
void perlinSpheres() {
hittableList world;
auto perlinTexture = make_shared<noiseTexture>();
world.add(make_shared<sphere>(point3(0,-1000,0), 1000, make_shared<lambertian>(perlinTexture)));
world.add(make_shared<sphere>(point3(0,2,0), 2, make_shared<lambertian>(perlinTexture)));
camera cam;
cam.aspectRatio = 16.0 / 9.0;
cam.imageWidth = 800;
cam.samplesPerPixel = 100;
cam.maxDepth = 50;
cam.vFieldOfView = 20;
cam.lookFrom = point3(13,2,3);
cam.lookAt = point3(0,0,0);
cam.vUp = vec3(0,1,0);
cam.defocusAngle = 0;
cam.render(world);
}
int main(void) {
int sceneToShow = 4;
int sceneToShow = 5;
switch (sceneToShow) {
case 1:
@@ -159,5 +183,8 @@ int main(void) {
case 4:
funny();
break;
case 5:
perlinSpheres();
break;
}
}