bugfix: width und heigth waren bei axampleSphere vertaucht. jetzt sieht man eine rote kugel

This commit is contained in:
any
2026-07-26 18:23:10 +02:00
parent 0c6c6531fd
commit 30b7d557d1
5 changed files with 9 additions and 4 deletions
+4
View File
@@ -0,0 +1,4 @@
[ViewState]
Mode=
Vid=
FolderType=Generic
+2 -2
View File
@@ -22,7 +22,7 @@ void example_color(int width, int height, int channels, unsigned char *image) {
} }
} }
void exampleSphere(int height, int width, int channels, unsigned char *image) { void exampleSphere( int width, int height, int channels, unsigned char *image) {
camera cam1; camera cam1;
cam1.origin.x = 0; cam1.origin.x = 0;
cam1.origin.y = 0; cam1.origin.y = 0;
@@ -36,7 +36,7 @@ void exampleSphere(int height, int width, int channels, unsigned char *image) {
cam1.width = 1.920; cam1.width = 1.920;
cam1.height = 1.080; cam1.height = 1.080;
vec3 sphereOrigin = (vec3){0,0,5}; vec3 sphereOrigin = (vec3){0,0,5};
double sphereRadius = 1.0; double sphereRadius = 2.0;
sphere obj = (sphere){sphereOrigin, sphereRadius}; sphere obj = (sphere){sphereOrigin, sphereRadius};
vec3 worldUp = (vec3){0, 1, 0}; vec3 worldUp = (vec3){0, 1, 0};
+2 -2
View File
@@ -13,8 +13,8 @@
#include "collision.h" #include "collision.h"
#include "raytrace.h" #include "raytrace.h"
int main() { int main() {
int width = 1280; int width = 1920;
int height = 780; int height = 1080;
int channels = 4; int channels = 4;
unsigned char *image = (unsigned char*)malloc(width * height * channels ); unsigned char *image = (unsigned char*)malloc(width * height * channels );
+1
View File
@@ -17,6 +17,7 @@ struct ray {
struct sphere { struct sphere {
vec3 origin; vec3 origin;
double radius; double radius;
double luminance;
}; typedef struct sphere sphere; }; typedef struct sphere sphere;
struct camera { struct camera {
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 251 KiB