very fizzely and green junk but overall believable defusion

This commit is contained in:
any
2026-07-30 00:54:59 +02:00
parent 43dc073622
commit e0096dce11
3 changed files with 8 additions and 6 deletions
+7 -5
View File
@@ -7,15 +7,17 @@
RGBA raytraceSphere(sphere **objectList, ray *lightray) {
RGBA pixel = (RGBA){0,0,0,0};
const int lightBounces = 2;
sphere **spheresHitList = (sphere **)calloc( (lightBounces + 1),sizeof(sphere*) );
vec3 *spheresNormalList = (vec3 *)calloc( lightBounces + 1,sizeof(vec3) );
#define lightBounces 1
//sphere **spheresHitList = (sphere **)calloc( (lightBounces + 1),sizeof(sphere*) );
//vec3 *spheresNormalList = (vec3 *)calloc( lightBounces + 1,sizeof(vec3) );
int hitLightIndex = -1;
vec3 sphereNormal;
int raysPerPixel = 50;
ray originalRay = *lightray;
for (int k = 0; k < raysPerPixel; k++) {
sphere *spheresHitList[lightBounces + 1] = {0};
vec3 spheresNormalList[lightBounces + 1] = {0};
*lightray = originalRay;
RGBA tempPixel = (RGBA){1,1,1,1};
sphere *nearestSphere = nullptr;
@@ -92,8 +94,8 @@ RGBA raytraceSphere(sphere **objectList, ray *lightray) {
pixel.a = pixel.a / raysPerPixel;
free(spheresHitList);
free(spheresNormalList);
//free(spheresHitList);
//free(spheresNormalList);
return pixel;
}