Implement image texture

This commit is contained in:
CJSatnarine
2024-07-09 14:26:05 -04:00
parent cbd114795f
commit bef20a9b1f
12 changed files with 354487 additions and 354418 deletions

View File

@@ -99,8 +99,30 @@ void checkeredSpheres(void) {
cam.render(world);
}
void earth(void) {
auto earthTexture = make_shared<imageTexture>("earthmap.jpg");
auto earthSurface = make_shared<lambertian>(earthTexture);
auto globe = make_shared<sphere>(point3(0, 0, 0), 2, earthSurface);
camera cam;
cam.aspectRatio = 16.0 / 9.0;
cam.imageWidth = 800;
cam.samplesPerPixel = 100;
cam.maxDepth = 50;
cam.vFieldOfView = 20;
cam.lookFrom = point3(0,0,12);
cam.lookAt = point3(0,0,0);
cam.vUp = vec3(0,1,0);
cam.defocusAngle = 0;
cam.render(hittableList(globe));
}
int main(void) {
int sceneToShow = 2;
int sceneToShow = 3;
switch (sceneToShow) {
case 1:
@@ -109,5 +131,8 @@ int main(void) {
case 2:
checkeredSpheres();
break;
case 3:
earth();
break;
}
}