Class: Rgltf::Extensions::KHRLightsPunctual::Light
- Inherits:
-
Object
- Object
- Rgltf::Extensions::KHRLightsPunctual::Light
- Defined in:
- lib/rgltf/extensions/khr_lights_punctual.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#intensity ⇒ Object
readonly
Returns the value of attribute intensity.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#range ⇒ Object
readonly
Returns the value of attribute range.
-
#source_json ⇒ Object
readonly
Returns the value of attribute source_json.
-
#spot ⇒ Object
readonly
Returns the value of attribute spot.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(json, index:) ⇒ Light
constructor
A new instance of Light.
Constructor Details
#initialize(json, index:) ⇒ Light
Returns a new instance of Light.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rgltf/extensions/khr_lights_punctual.rb', line 25 def initialize(json, index:) @source_json = json @index = index @name = json['name'] @type = json.fetch('type').to_sym raise FormatError, "invalid punctual light type #{@type.inspect}" unless %i[directional point spot].include?(@type) @color = json.fetch('color', [1.0, 1.0, 1.0]).freeze @intensity = json.fetch('intensity', 1.0) @range = json['range'] @spot = Spot.new(json.fetch('spot', {})) if @type == :spot end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
23 24 25 |
# File 'lib/rgltf/extensions/khr_lights_punctual.rb', line 23 def color @color end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
23 24 25 |
# File 'lib/rgltf/extensions/khr_lights_punctual.rb', line 23 def index @index end |
#intensity ⇒ Object (readonly)
Returns the value of attribute intensity.
23 24 25 |
# File 'lib/rgltf/extensions/khr_lights_punctual.rb', line 23 def intensity @intensity end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
23 24 25 |
# File 'lib/rgltf/extensions/khr_lights_punctual.rb', line 23 def name @name end |
#range ⇒ Object (readonly)
Returns the value of attribute range.
23 24 25 |
# File 'lib/rgltf/extensions/khr_lights_punctual.rb', line 23 def range @range end |
#source_json ⇒ Object (readonly)
Returns the value of attribute source_json.
23 24 25 |
# File 'lib/rgltf/extensions/khr_lights_punctual.rb', line 23 def source_json @source_json end |
#spot ⇒ Object (readonly)
Returns the value of attribute spot.
23 24 25 |
# File 'lib/rgltf/extensions/khr_lights_punctual.rb', line 23 def spot @spot end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
23 24 25 |
# File 'lib/rgltf/extensions/khr_lights_punctual.rb', line 23 def type @type end |