@@ -13,7 +13,7 @@ aiCameraSample::aiCameraSample(aiCamera *schema)
1313
1414void aiCameraSample::getData (aiCameraData &dst) const
1515{
16- dst = m_data ;
16+ dst = data ;
1717}
1818
1919
@@ -31,53 +31,53 @@ void aiCamera::readSampleBody(Sample& sample, uint64_t idx)
3131{
3232 auto ss = aiIndexToSampleSelector (idx);
3333 auto ss2 = aiIndexToSampleSelector (idx + 1 );
34- readVisibility (sample, ss);
3534
36- m_schema.get (sample.m_sample , ss);
37- m_schema.get (sample.m_next_sample , ss2);
35+ readVisibility (sample, ss);
36+ m_schema.get (sample.cam_sp , ss);
37+ m_schema.get (sample.cam_sp2 , ss2);
3838}
3939
4040void aiCamera::cookSampleBody (Sample& sample)
4141{
4242 auto & config = getConfig ();
43- auto & cs = sample.m_sample ;
44- auto & cs_next = sample.m_next_sample ;
45- auto & dst = sample.m_data ;
43+ auto & sp = sample.cam_sp ;
44+ auto & dst = sample.data ;
4645
4746 dst.visibility = sample.visibility ;
4847
4948 // Note: CameraSample::getFieldOfView() returns the horizontal field of view, we need the verical one
5049 static float sRad2Deg = 180 .0f / float (M_PI);
51- float focal_length = (float )cs .getFocalLength ();
52- float vertical_aperture = (float )cs .getVerticalAperture ();
50+ float focal_length = (float )sp .getFocalLength ();
51+ float vertical_aperture = (float )sp .getVerticalAperture ();
5352 if (config.aspect_ratio > 0 .0f )
54- vertical_aperture = (float )cs .getHorizontalAperture () / config.aspect_ratio ;
53+ vertical_aperture = (float )sp .getHorizontalAperture () / config.aspect_ratio ;
5554
56- dst.near_clipping_plane = (float )cs .getNearClippingPlane ();
57- dst.far_clipping_plane = (float )cs .getFarClippingPlane ();
55+ dst.near_clipping_plane = (float )sp .getNearClippingPlane ();
56+ dst.far_clipping_plane = (float )sp .getFarClippingPlane ();
5857 dst.field_of_view = 2 .0f * atanf (vertical_aperture * 10 .0f / (2 .0f * focal_length)) * sRad2Deg ;
5958
60- dst.focus_distance = (float )cs .getFocusDistance ();
59+ dst.focus_distance = (float )sp .getFocusDistance ();
6160 dst.focal_length = focal_length;
6261 dst.aperture = vertical_aperture;
63- dst.aspect_ratio = float (cs .getHorizontalAperture () / vertical_aperture);
62+ dst.aspect_ratio = float (sp .getHorizontalAperture () / vertical_aperture);
6463
6564 if (config.interpolate_samples && m_current_time_offset != 0 ) {
65+ auto & sp2 = sample.cam_sp2 ;
6666 float time_offset = (float )m_current_time_offset;
67- float focal_length2 = (float )cs_next .getFocalLength ();
68- float vertical_aperture2 = (float )cs_next .getVerticalAperture ();
67+ float focal_length2 = (float )sp2 .getFocalLength ();
68+ float vertical_aperture2 = (float )sp2 .getVerticalAperture ();
6969 if (config.aspect_ratio > 0 .0f )
70- vertical_aperture2 = (float )cs_next .getHorizontalAperture () / config.aspect_ratio ;
70+ vertical_aperture2 = (float )sp2 .getHorizontalAperture () / config.aspect_ratio ;
7171
7272 float fov2 = 2 .0f * atanf (vertical_aperture2 * 10 .0f / (2 .0f * focal_length2)) * sRad2Deg ;
73- dst.near_clipping_plane += time_offset * (float )(cs_next .getNearClippingPlane () - cs .getNearClippingPlane ());
74- dst.far_clipping_plane += time_offset * (float )(cs_next .getFarClippingPlane () - cs .getFarClippingPlane ());
73+ dst.near_clipping_plane += time_offset * (float )(sp2 .getNearClippingPlane () - sp .getNearClippingPlane ());
74+ dst.far_clipping_plane += time_offset * (float )(sp2 .getFarClippingPlane () - sp .getFarClippingPlane ());
7575 dst.field_of_view += time_offset * (fov2 - dst.field_of_view );
7676
77- dst.focus_distance += time_offset * (float )(cs_next .getFocusDistance () - cs .getFocusDistance ());
77+ dst.focus_distance += time_offset * (float )(sp2 .getFocusDistance () - sp .getFocusDistance ());
7878 dst.focal_length += time_offset * (focal_length2 - focal_length);
7979 dst.aperture += time_offset * (vertical_aperture2 - vertical_aperture);
80- dst.aspect_ratio += time_offset * (float (cs_next .getHorizontalAperture () / vertical_aperture2) - dst.aspect_ratio );
80+ dst.aspect_ratio += time_offset * (float (sp2 .getHorizontalAperture () / vertical_aperture2) - dst.aspect_ratio );
8181 }
8282
8383 if (dst.near_clipping_plane == 0 .0f )
0 commit comments