Class: Rgltf::Sampler

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

Constant Summary collapse

FILTERS =
{
  9728 => :nearest,
  9729 => :linear,
  9984 => :nearest_mipmap_nearest,
  9985 => :linear_mipmap_nearest,
  9986 => :nearest_mipmap_linear,
  9987 => :linear_mipmap_linear
}.freeze
WRAPS =
{ 33_071 => :clamp_to_edge, 33_648 => :mirrored_repeat, 10_497 => :repeat }.freeze

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:) ⇒ Sampler

Returns a new instance of Sampler.



17
18
19
20
21
22
23
# File 'lib/rgltf/properties/sampler.rb', line 17

def initialize(json, document:, index:)
  super(json, document:, index:, owner_type: :sampler)
  @mag_filter = convert(FILTERS, json['magFilter'], 'magFilter')
  @min_filter = convert(FILTERS, json['minFilter'], 'minFilter')
  @wrap_s = convert(WRAPS, json.fetch('wrapS', 10_497), 'wrapS')
  @wrap_t = convert(WRAPS, json.fetch('wrapT', 10_497), 'wrapT')
end

Instance Attribute Details

#mag_filterObject (readonly)

Returns the value of attribute mag_filter.



15
16
17
# File 'lib/rgltf/properties/sampler.rb', line 15

def mag_filter
  @mag_filter
end

#min_filterObject (readonly)

Returns the value of attribute min_filter.



15
16
17
# File 'lib/rgltf/properties/sampler.rb', line 15

def min_filter
  @min_filter
end

#wrap_sObject (readonly)

Returns the value of attribute wrap_s.



15
16
17
# File 'lib/rgltf/properties/sampler.rb', line 15

def wrap_s
  @wrap_s
end

#wrap_tObject (readonly)

Returns the value of attribute wrap_t.



15
16
17
# File 'lib/rgltf/properties/sampler.rb', line 15

def wrap_t
  @wrap_t
end