Class: Lightwave::LightwaveObject::Scene
- Inherits:
-
ChunkReader
- Object
- ChunkReader
- Lightwave::LightwaveObject::Scene
- Defined in:
- lib/lightwave.rb
Instance Attribute Summary collapse
-
#clips ⇒ Object
Returns the value of attribute clips.
-
#current_layer ⇒ Object
Returns the value of attribute current_layer.
-
#description ⇒ Object
Returns the value of attribute description.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#icon ⇒ Object
Returns the value of attribute icon.
-
#layers ⇒ Object
list of layers.
-
#max ⇒ Object
Returns the value of attribute max.
-
#min ⇒ Object
Returns the value of attribute min.
-
#surfaces ⇒ Object
Returns the value of attribute surfaces.
-
#tags ⇒ Object
list of strings.
-
#text ⇒ Object
Returns the value of attribute text.
-
#type ⇒ Object
Version.
Attributes inherited from ChunkReader
Instance Method Summary collapse
- #init_lists ⇒ Object
-
#initialize(string) ⇒ Scene
constructor
A new instance of Scene.
- #method_missing(sym, *args, &block) ⇒ Object
- #read_clip(strio) ⇒ Object
- #read_layer(strio) ⇒ Object
- #read_scene_bbox ⇒ Object
- #read_surface(strio) ⇒ Object
Methods inherited from ChunkReader
chunk_map, #make_defaults, #process_tags, set_chunk_length
Constructor Details
#initialize(string) ⇒ Scene
Returns a new instance of Scene.
476 477 478 479 480 481 482 483 484 485 486 487 |
# File 'lib/lightwave.rb', line 476 def initialize(string) init_lists ext_reader = LightwaveStringIO.new(string) discard, reader = ext_reader.read_chunk @type = reader.read_type @current_layer = VCR.new super(reader) read_scene_bbox end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
466 467 468 |
# File 'lib/lightwave.rb', line 466 def method_missing(sym, *args, &block) @current_layer.send(sym, *args, &block) end |
Instance Attribute Details
#clips ⇒ Object
Returns the value of attribute clips.
446 447 448 |
# File 'lib/lightwave.rb', line 446 def clips @clips end |
#current_layer ⇒ Object
Returns the value of attribute current_layer.
445 446 447 |
# File 'lib/lightwave.rb', line 445 def current_layer @current_layer end |
#description ⇒ Object
Returns the value of attribute description.
448 449 450 |
# File 'lib/lightwave.rb', line 448 def description @description end |
#filename ⇒ Object
Returns the value of attribute filename.
439 440 441 |
# File 'lib/lightwave.rb', line 439 def filename @filename end |
#icon ⇒ Object
Returns the value of attribute icon.
444 445 446 |
# File 'lib/lightwave.rb', line 444 def icon @icon end |
#layers ⇒ Object
list of layers
442 443 444 |
# File 'lib/lightwave.rb', line 442 def layers @layers end |
#max ⇒ Object
Returns the value of attribute max.
449 450 451 |
# File 'lib/lightwave.rb', line 449 def max @max end |
#min ⇒ Object
Returns the value of attribute min.
449 450 451 |
# File 'lib/lightwave.rb', line 449 def min @min end |
#surfaces ⇒ Object
Returns the value of attribute surfaces.
443 444 445 |
# File 'lib/lightwave.rb', line 443 def surfaces @surfaces end |
#tags ⇒ Object
list of strings
441 442 443 |
# File 'lib/lightwave.rb', line 441 def end |
#text ⇒ Object
Returns the value of attribute text.
447 448 449 |
# File 'lib/lightwave.rb', line 447 def text @text end |
#type ⇒ Object
Version
440 441 442 |
# File 'lib/lightwave.rb', line 440 def type @type end |
Instance Method Details
#init_lists ⇒ Object
469 470 471 472 473 474 475 |
# File 'lib/lightwave.rb', line 469 def init_lists @errors = [] @layers = [] @surfaces = {} = [] @clips = {} end |
#read_clip(strio) ⇒ Object
498 499 500 |
# File 'lib/lightwave.rb', line 498 def read_clip(strio) @clips[strio.read_u4] = Clip.new(strio) end |
#read_layer(strio) ⇒ Object
501 502 503 504 505 506 507 508 |
# File 'lib/lightwave.rb', line 501 def read_layer(strio) new_layer = GeomLayer.new(self,strio) if @current_layer.respond_to? :play_back_to @current_layer.play_back_to new_layer end @layers << new_layer @current_layer = new_layer end |
#read_scene_bbox ⇒ Object
488 489 490 491 492 493 494 495 496 497 |
# File 'lib/lightwave.rb', line 488 def read_scene_bbox @min = @layers[0].min.dup @max = @layers[0].max.dup @layers.each do |layer| (0..2).each do |i| @min[i] = layer.min[i] < @min[i] ? layer.min[i] : @min[i] @max[i] = layer.max[i] > @max[i] ? layer.max[i] : @max[i] end end end |
#read_surface(strio) ⇒ Object
509 510 511 512 513 |
# File 'lib/lightwave.rb', line 509 def read_surface(strio) s = Surface.new(strio) @surfaces[s.name] = s # @errors += s.errors end |