MCPcopy Create free account
hub / github.com/RenderKit/embree / calculate_interpolated_space

Function calculate_interpolated_space

tutorials/viewer/viewer_device.cpp:132–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132AffineSpace3fa calculate_interpolated_space (ISPCInstance* instance, float gtime)
133{
134 if (instance->numTimeSteps == 1)
135 return AffineSpace3fa(instance->spaces[0]);
136
137 /* calculate time segment itime and fractional time ftime */
138 const int time_segments = instance->numTimeSteps-1;
139 const float time = gtime*(float)(time_segments);
140 const int itime = clamp((int)(floor(time)),(int)0,time_segments-1);
141 const float ftime = time - (float)(itime);
142 return (1.0f-ftime)*AffineSpace3fa(instance->spaces[itime+0]) + ftime*AffineSpace3fa(instance->spaces[itime+1]);
143}
144
145typedef ISPCInstance* ISPCInstancePtr;
146

Callers 1

postIntersectFunction · 0.70

Calls 2

clampFunction · 0.50
floorFunction · 0.50

Tested by

no test coverage detected