Class: Rgltf::BufferView
- Inherits:
-
Properties::Base
- Object
- Properties::Base
- Rgltf::BufferView
- Defined in:
- lib/rgltf/properties/buffer_view.rb
Constant Summary collapse
- TARGETS =
{ 34_962 => :array_buffer, 34_963 => :element_array_buffer }.freeze
Instance Attribute Summary collapse
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
-
#byte_length ⇒ Object
readonly
Returns the value of attribute byte_length.
-
#byte_offset ⇒ Object
readonly
Returns the value of attribute byte_offset.
-
#byte_stride ⇒ Object
readonly
Returns the value of attribute byte_stride.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Attributes inherited from Properties::Base
#extensions, #extras, #index, #name, #owner_type, #source_json
Instance Method Summary collapse
-
#initialize(json, document:, index:) ⇒ BufferView
constructor
A new instance of BufferView.
Methods inherited from Properties::Base
#extension, #nested_properties, #parse_extensions!
Constructor Details
#initialize(json, document:, index:) ⇒ BufferView
Returns a new instance of BufferView.
9 10 11 12 13 14 15 16 |
# File 'lib/rgltf/properties/buffer_view.rb', line 9 def initialize(json, document:, index:) super(json, document:, index:, owner_type: :buffer_view) @buffer = document.fetch_reference(:buffers, json.fetch('buffer'), "bufferViews/#{index}/buffer") @byte_offset = json.fetch('byteOffset', 0) @byte_length = json.fetch('byteLength') @byte_stride = json['byteStride'] @target = TARGETS.fetch(json['target'], json['target']) end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
7 8 9 |
# File 'lib/rgltf/properties/buffer_view.rb', line 7 def buffer @buffer end |
#byte_length ⇒ Object (readonly)
Returns the value of attribute byte_length.
7 8 9 |
# File 'lib/rgltf/properties/buffer_view.rb', line 7 def byte_length @byte_length end |
#byte_offset ⇒ Object (readonly)
Returns the value of attribute byte_offset.
7 8 9 |
# File 'lib/rgltf/properties/buffer_view.rb', line 7 def byte_offset @byte_offset end |
#byte_stride ⇒ Object (readonly)
Returns the value of attribute byte_stride.
7 8 9 |
# File 'lib/rgltf/properties/buffer_view.rb', line 7 def byte_stride @byte_stride end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
7 8 9 |
# File 'lib/rgltf/properties/buffer_view.rb', line 7 def target @target end |