very fizzely and green junk but overall believable defusion
This commit is contained in:
+7
-5
@@ -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;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user