| 108 | } |
| 109 | |
| 110 | ConstObjectPtr SampledSceneInterface::readAttribute( const Name &name, double time ) const |
| 111 | { |
| 112 | size_t sample1, sample2; |
| 113 | double x = attributeSampleInterval( name, time, sample1, sample2 ); |
| 114 | |
| 115 | if( x == 0 ) |
| 116 | { |
| 117 | return readAttributeAtSample( name, sample1 ); |
| 118 | } |
| 119 | if( x == 1 ) |
| 120 | { |
| 121 | return readAttributeAtSample( name, sample2 ); |
| 122 | } |
| 123 | |
| 124 | ConstObjectPtr attributeObj1 = readAttributeAtSample( name, sample1 ); |
| 125 | ConstObjectPtr attributeObj2 = readAttributeAtSample( name, sample2 ); |
| 126 | |
| 127 | ObjectPtr attributeObj = linearObjectInterpolation( attributeObj1.get(), attributeObj2.get(), x ); |
| 128 | if( !attributeObj ) |
| 129 | { |
| 130 | // failed to interpolate, return the closest one |
| 131 | return ( x >= 0.5 ? attributeObj2 : attributeObj1 ); |
| 132 | } |
| 133 | return attributeObj; |
| 134 | } |
| 135 | |
| 136 | ConstObjectPtr SampledSceneInterface::readObject( double time, const Canceller *canceller ) const |
| 137 | { |
nothing calls this directly
no test coverage detected