@@ -28,6 +28,7 @@ Intersection sceneObjectTransformIntersectRay(const SceneObject *superobject, co
28
28
29
29
intersection .normal = mvMulDir (object -> transform , intersection .normal );
30
30
intersection .position = mvMul (object -> transform , intersection .position );
31
+ intersection .distance = intersection .distance * mScale (object -> transform );
31
32
}
32
33
33
34
return intersection ;
@@ -46,9 +47,12 @@ bool sceneObjectTransformEmitPhotons(const SceneObject *superobject, const int n
46
47
if (success ) {
47
48
48
49
// Transform the photons.
50
+ float scale = mScale (object -> transform );
51
+ float areaScale = scale * scale ;
49
52
containerForeach (Photon , photon , newPhotons ) {
50
53
51
54
photon -> heading = mrMul (object -> transform , photon -> heading );
55
+ photon -> energy = csMul (photon -> energy , areaScale );
52
56
}
53
57
54
58
// "Return" the new, transformed photons.
@@ -67,8 +71,8 @@ Color sceneObjectTransformRadiantFlux(const SceneObject *superobject) {
67
71
68
72
// Forward the flux calculation.
69
73
Color radiantFlux = sceneObjectRadiantFlux (object -> subject );
70
-
71
- // TODO: Take scaling transforms into account.
72
74
73
- return radiantFlux ;
75
+ float scale = mScale (object -> transform );
76
+
77
+ return csMul (radiantFlux , scale * scale );
74
78
}
0 commit comments