bugfix: width und heigth waren bei axampleSphere vertaucht. jetzt sieht man eine rote kugel
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
[ViewState]
|
||||||
|
Mode=
|
||||||
|
Vid=
|
||||||
|
FolderType=Generic
|
||||||
+2
-2
@@ -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};
|
||||||
|
|||||||
@@ -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 );
|
||||||
|
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user