jetzt haben wir einen komischen streifen

This commit is contained in:
any
2026-07-26 18:09:35 +02:00
parent b096302738
commit 0c6c6531fd
2 changed files with 3 additions and 3 deletions
+3 -3
View File
@@ -45,8 +45,8 @@ void exampleSphere(int height, int width, int channels, unsigned char *image) {
vec3 screenMiddlePoint = vec3Add(cam1.origin, vec3Scale(cam1.direction, cam1.screenDistance));
vec3 screenTopLeft = vec3Add(
vec3Add(screenMiddlePoint,
vec3Scale(screenY, cam1.height)),
vec3Scale(screenX, cam1.width)
vec3Scale(screenY, -cam1.height/2.0)),
vec3Scale(screenX, -cam1.width/2.0)
);
double pixelStepX = cam1.width / cam1.resolutionX;
double pixelStepY = cam1.height / cam1.resolutionY;
@@ -69,7 +69,7 @@ void exampleSphere(int height, int width, int channels, unsigned char *image) {
ray *lightRay = (ray *)malloc(sizeof(ray));;
lightRay->origin = cam1.origin;
lightRay->direction = vec3Subtract(*pixelOrigin, cam1.origin);
lightRay->direction = vec3Normalize(vec3Subtract(*pixelOrigin, cam1.origin));
pixelColor = raytraceSphere(&obj, lightRay);
free(pixelOrigin);