| 134 | } |
| 135 | |
| 136 | ConstObjectPtr SampledSceneInterface::readObject( double time, const Canceller *canceller ) const |
| 137 | { |
| 138 | size_t sample1, sample2; |
| 139 | double x = objectSampleInterval( time, sample1, sample2 ); |
| 140 | |
| 141 | if( x == 0 ) |
| 142 | { |
| 143 | return readObjectAtSample( sample1, canceller ); |
| 144 | } |
| 145 | if( x == 1 ) |
| 146 | { |
| 147 | return readObjectAtSample( sample2, canceller ); |
| 148 | } |
| 149 | |
| 150 | ConstObjectPtr object1 = readObjectAtSample( sample1, canceller ); |
| 151 | ConstObjectPtr object2 = readObjectAtSample( sample2, canceller ); |
| 152 | |
| 153 | ObjectPtr object = linearObjectInterpolation( object1.get(), object2.get(), x ); |
| 154 | if( !object ) |
| 155 | { |
| 156 | // failed to interpolate, return the closest one |
| 157 | return ( x >= 0.5 ? object2 : object1 ); |
| 158 | } |
| 159 | |
| 160 | return object; |
| 161 | } |
nothing calls this directly
no test coverage detected