Class: Stagecraft::Textures::SamplerState

Inherits:
Data
  • Object
show all
Defined in:
lib/stagecraft/textures/sampler_state.rb

Constant Summary collapse

FILTERS =
%i[nearest linear].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wrap_u: :repeat, wrap_v: :repeat, wrap_w: :repeat, mag_filter: :linear, min_filter: :linear, mipmap_filter: :linear, lod_min: 0.0, lod_max: 32.0, compare: nil, max_anisotropy: 1) ⇒ SamplerState

Returns a new instance of SamplerState.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/stagecraft/textures/sampler_state.rb', line 11

def initialize(wrap_u: :repeat, wrap_v: :repeat, wrap_w: :repeat,
               mag_filter: :linear, min_filter: :linear, mipmap_filter: :linear,
               lod_min: 0.0, lod_max: 32.0, compare: nil, max_anisotropy: 1)
  super(
    wrap_u: normalize_wrap(wrap_u),
    wrap_v: normalize_wrap(wrap_v),
    wrap_w: normalize_wrap(wrap_w),
    mag_filter: mag_filter.to_sym,
    min_filter: min_filter.to_sym,
    mipmap_filter: mipmap_filter.to_sym,
    lod_min: Float(lod_min),
    lod_max: Float(lod_max),
    compare: compare&.to_sym,
    max_anisotropy: Integer(max_anisotropy)
  )
  validate!
end

Instance Attribute Details

#compareObject (readonly)

Returns the value of attribute compare

Returns:

  • (Object)

    the current value of compare



5
6
7
# File 'lib/stagecraft/textures/sampler_state.rb', line 5

def compare
  @compare
end

#lod_maxObject (readonly)

Returns the value of attribute lod_max

Returns:

  • (Object)

    the current value of lod_max



5
6
7
# File 'lib/stagecraft/textures/sampler_state.rb', line 5

def lod_max
  @lod_max
end

#lod_minObject (readonly)

Returns the value of attribute lod_min

Returns:

  • (Object)

    the current value of lod_min



5
6
7
# File 'lib/stagecraft/textures/sampler_state.rb', line 5

def lod_min
  @lod_min
end

#mag_filterObject (readonly)

Returns the value of attribute mag_filter

Returns:

  • (Object)

    the current value of mag_filter



5
6
7
# File 'lib/stagecraft/textures/sampler_state.rb', line 5

def mag_filter
  @mag_filter
end

#max_anisotropyObject (readonly)

Returns the value of attribute max_anisotropy

Returns:

  • (Object)

    the current value of max_anisotropy



5
6
7
# File 'lib/stagecraft/textures/sampler_state.rb', line 5

def max_anisotropy
  @max_anisotropy
end

#min_filterObject (readonly)

Returns the value of attribute min_filter

Returns:

  • (Object)

    the current value of min_filter



5
6
7
# File 'lib/stagecraft/textures/sampler_state.rb', line 5

def min_filter
  @min_filter
end

#mipmap_filterObject (readonly)

Returns the value of attribute mipmap_filter

Returns:

  • (Object)

    the current value of mipmap_filter



5
6
7
# File 'lib/stagecraft/textures/sampler_state.rb', line 5

def mipmap_filter
  @mipmap_filter
end

#wrap_uObject (readonly)

Returns the value of attribute wrap_u

Returns:

  • (Object)

    the current value of wrap_u



5
6
7
# File 'lib/stagecraft/textures/sampler_state.rb', line 5

def wrap_u
  @wrap_u
end

#wrap_vObject (readonly)

Returns the value of attribute wrap_v

Returns:

  • (Object)

    the current value of wrap_v



5
6
7
# File 'lib/stagecraft/textures/sampler_state.rb', line 5

def wrap_v
  @wrap_v
end

#wrap_wObject (readonly)

Returns the value of attribute wrap_w

Returns:

  • (Object)

    the current value of wrap_w



5
6
7
# File 'lib/stagecraft/textures/sampler_state.rb', line 5

def wrap_w
  @wrap_w
end