Closed davidSedlacek closed 4 years ago
There's no built-in way to do that, but it's doable with a little hacking. :-)
Shapes with animated transforms are stored in TransformedPrimitive
s. You could use a dynamic_cast
on isect.primitive
to get the TransformedPrimitive *
, when there is one. Then if you make TransformedPrimitive::PrimitiveToWorld
public
(or otherwise accessible), you should be able to get at that information.
(A cleaner option might be to add a method to the Primitive
interface that does what you want, make it a no-op for GeometricPrimitive
, and then do what you want in the TransformedPrimitive
implementation of it.)
Thanks to the author for the great book and pbrt code :)
I am implementing own integrator and I would like to evaluate primitive (or shape) animation after an intersection. I am a little bit lost with it.
I do not see (and can't find it in any classes) where the animated transform is applied on primitive and how I can get it from the intersection.
I can get
isect.shape->WorldToObject
- but it is a transform in concrete time or I can getisect.primitive
- but there is not a transform at all.Would you recommend me to extend shape with AnimatedTransform or is there some way how to get to TransformedPrimitive from intersection info?
Thanks in advance for help david