raytracer immer noch kaputt. es war davor kaputt, weil ich im raytracer nicht abgefangen habe wenn der ray nicht trifft. jetzt ist alles schwarz, das weisst auf eine kaputte collision detection hin
This commit is contained in:
@@ -10,6 +10,7 @@ RGBA raytraceSphere(sphere *obj, ray *lightray) {
|
||||
pixel.a = 1;
|
||||
|
||||
vec3 collisionPoint = collisionPointSphere(lightray, obj);
|
||||
if (collisionPoint.x == -1) {return pixel;}
|
||||
vec3 sphereNormal = vec3Normalize(vec3Subtract(collisionPoint, obj->origin));
|
||||
pixel.r = -vec3Product(sphereNormal, lightray->direction);
|
||||
return pixel;
|
||||
|
||||
Reference in New Issue
Block a user