lullaby/modules/tinygltf/tinygltf_util.cc
/// Parses and returns a span of floating point time data for |sampler.input|,
/// or NullOpt if the GLTF referred to an invalid accessor.
Parses and returns a span of floating point time data for |sampler.input|,
or NullOpt if the GLTF referred to an invalid accessor.
Parses and returns a span of floating point time data for |sampler . input| or NullOpt if the GLTF referred to an invalid accessor .
Optional<Span<float>> GetTimeData(const tinygltf::AnimationSampler& sampler,
                                  const tinygltf::Model& model) {
  const tinygltf::Accessor& frame_time_accessor =
      model.accessors[sampler.input];
  if (frame_time_accessor.bufferView == kInvalidTinyGltfIndex) {
    return NullOpt;
  }
  if (frame_time_accessor.componentType != TINYGLTF_COMPONENT_TYPE_FLOAT) {
    return NullOpt;
  }
  const auto* times = DataFromGltfAccessor<float>(model, frame_time_accessor);
  if (times == nullptr) {
    return NullOpt;
  }
  return Span<float>(times, frame_time_accessor.count);
}
Optional < Span < float > > GetTimeData ( const tinygltf :: AnimationSampler & sampler , const tinygltf :: Model & model ) { const tinygltf :: Accessor & frame_time_accessor = model . accessors [ sampler . input ] ; if ( frame_time_accessor . bufferView == kInvalidTinyGltfIndex ) { return NullOpt ; } if ( frame_time_accessor . componentType != TINYGLTF_COMPONENT_TYPE_FLOAT ) { return NullOpt ; } const auto * times = DataFromGltfAccessor < float > ( model , frame_time_accessor ) ; if ( times == nullptr ) { return NullOpt ; } return Span < float > ( times , frame_time_accessor . count ) ; }
Parses and returns a span of floating point time data for |sampler.input|,
or NullOpt if the GLTF referred to an invalid accessor.
Parses and returns a span of floating point time data for |sampler . input| or NullOpt if the GLTF referred to an invalid accessor .
// Fetch and verify the input accessor. // According to the spec, times must be floating point values. // Since the data has been verified, we can safely interpret it as a list of // floating point data.