Skip to content

Commit 2dad51a

Browse files
chellmuthChris Hellmuth
authored andcommitted
Default to identity for unknown testrender xforms
1 parent a1761c7 commit 2dad51a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/testrender/simpleraytracer.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,11 @@ SimpleRaytracer::get_matrix(ShaderGlobals* /*sg*/, Matrix44& result,
516516
{
517517
// SimpleRaytracer doesn't understand motion blur and transformations
518518
// are just simple 4x4 matrices.
519-
result = *reinterpret_cast<const Matrix44*>(xform);
519+
if (xform)
520+
result = *reinterpret_cast<const Matrix44*>(xform);
521+
else
522+
result = Matrix44(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
523+
520524
return true;
521525
}
522526

@@ -543,7 +547,10 @@ SimpleRaytracer::get_matrix(ShaderGlobals* /*sg*/, Matrix44& result,
543547
{
544548
// SimpleRaytracer doesn't understand motion blur and transformations
545549
// are just simple 4x4 matrices.
546-
result = *reinterpret_cast<const Matrix44*>(xform);
550+
if (xform)
551+
result = *reinterpret_cast<const Matrix44*>(xform);
552+
else
553+
result = Matrix44(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
547554
return true;
548555
}
549556

0 commit comments

Comments
 (0)