Class: Rgltf::Buffer

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

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, #nested_properties, #parse_extensions!

Constructor Details

#initialize(json, document:, index:) ⇒ Buffer

Returns a new instance of Buffer.



10
11
12
13
14
# File 'lib/rgltf/properties/buffer.rb', line 10

def initialize(json, document:, index:)
  super(json, document:, index:, owner_type: :buffer)
  @uri = json['uri']
  @byte_length = json.fetch('byteLength')
end

Instance Attribute Details

#byte_lengthObject (readonly)

Returns the value of attribute byte_length.



8
9
10
# File 'lib/rgltf/properties/buffer.rb', line 8

def byte_length
  @byte_length
end

#uriObject (readonly)

Returns the value of attribute uri.



8
9
10
# File 'lib/rgltf/properties/buffer.rb', line 8

def uri
  @uri
end

Instance Method Details

#bytesObject



16
17
18
# File 'lib/rgltf/properties/buffer.rb', line 16

def bytes
  @document.buffer_resolver.resolve(self)
end