Class: PBRT::Spectrum
- Inherits:
-
Object
- Object
- PBRT::Spectrum
- Defined in:
- lib/pbrt/spectrum.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type, *args) ⇒ Spectrum
constructor
A new instance of Spectrum.
Constructor Details
#initialize(type, *args) ⇒ Spectrum
5 6 7 8 |
# File 'lib/pbrt/spectrum.rb', line 5 def initialize(type, *args) @type = type @args = args end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
3 4 5 |
# File 'lib/pbrt/spectrum.rb', line 3 def args @args end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/pbrt/spectrum.rb', line 3 def type @type end |
Class Method Details
.check_value_is_a_spectrum(value) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/pbrt/spectrum.rb', line 16 def self.check_value_is_a_spectrum(value) return if value.is_a?(self) = "Please specify the spectrum representation for #{value.inspect}.\n" += "You can do this by wrapping the value: rgb(#{value.inspect})\n" += "Valid representations are: rgb, xyz, sampled and blackbody" raise AmbiguousSpectrumError, end |
.unpack(value) ⇒ Object
10 11 12 13 14 |
# File 'lib/pbrt/spectrum.rb', line 10 def self.unpack(value) check_value_is_a_spectrum(value) [value.type, value.args] end |