Class: Rgltf::Accessor::Sparse

Inherits:
Properties::Base show all
Defined in:
lib/rgltf/properties/accessor.rb

Defined Under Namespace

Classes: Indices, Values

Instance Attribute Summary collapse

Attributes inherited from Properties::Base

#extensions, #extras, #index, #name, #owner_type, #source_json

Instance Method Summary collapse

Methods inherited from Properties::Base

#extension, #parse_extensions!

Constructor Details

#initialize(json, document:, accessor_index:) ⇒ Sparse

Returns a new instance of Sparse.



96
97
98
99
100
101
102
103
# File 'lib/rgltf/properties/accessor.rb', line 96

def initialize(json, document:, accessor_index:)
  super(json, document:, owner_type: :accessor_sparse)
  @count = json.fetch('count')
  @indices = Indices.new(json.fetch('indices'), document:, accessor_index:)
  @values = Values.new(json.fetch('values'), document:, accessor_index:)
rescue KeyError => e
  raise FormatError, "invalid sparse accessor #{accessor_index}: #{e.message}"
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



94
95
96
# File 'lib/rgltf/properties/accessor.rb', line 94

def count
  @count
end

#indicesObject (readonly)

Returns the value of attribute indices.



94
95
96
# File 'lib/rgltf/properties/accessor.rb', line 94

def indices
  @indices
end

#valuesObject (readonly)

Returns the value of attribute values.



94
95
96
# File 'lib/rgltf/properties/accessor.rb', line 94

def values
  @values
end

Instance Method Details

#nested_propertiesObject



105
106
107
# File 'lib/rgltf/properties/accessor.rb', line 105

def nested_properties
  [indices, values]
end