Class: Bayonetta::WMBFile::Mesh

Inherits:
LibBin::Structure
  • Object
show all
Defined in:
lib/bayonetta/wmb.rb

Instance Method Summary collapse

Constructor Details

#initializeMesh

Returns a new instance of Mesh.



1008
1009
1010
1011
1012
# File 'lib/bayonetta/wmb.rb', line 1008

def initialize
  @header = MeshHeader::new
  @batch_offsets = []
  @batches = []
end

Instance Method Details

#__size(position = 0, parent = nil, index = nil) ⇒ Object



1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
# File 'lib/bayonetta/wmb.rb', line 1014

def __size(position = 0, parent = nil, index = nil)
  sz = @header.offset_batch_offsets
  sz += @header.num_batch * 4
  sz = align(sz, 0x20)
  @header.num_batch.times { |i|
     sz += @batches[i].__size
     sz = align(sz, 0x20)
  }
  sz
end

#duplicate(positions, vertexes, vertexes_ex) ⇒ Object



1036
1037
1038
1039
1040
1041
1042
# File 'lib/bayonetta/wmb.rb', line 1036

def duplicate(positions, vertexes, vertexes_ex)
  m = Mesh::new
  m.header = @header
  m.batch_offsets = @batch_offsets
  m.batches = @batches.collect { |b| b.duplicate(positions, vertexes, vertexes_ex) }
  m
end

#recompute_layoutObject



1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
# File 'lib/bayonetta/wmb.rb', line 1025

def recompute_layout
  @header.num_batch = @batches.length
  off = @header.num_batch * 4
  @batch_offsets = []
  @header.num_batch.times { |j|
    off = align(off, 0x20)
    @batch_offsets.push off
    off += @batches[j].__size
  }
end