MCPcopy Create free account
hub / github.com/ImageEngine/cortex / readObject

Method readObject

src/IECoreScene/SampledSceneInterface.cpp:136–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136ConstObjectPtr 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}

Callers

nothing calls this directly

Calls 4

objectSampleIntervalFunction · 0.85
readObjectAtSampleFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected