Class: Lightwave::LightwaveObject::TextureLayer

Inherits:
ChunkReader
  • Object
show all
Defined in:
lib/lightwave.rb

Instance Attribute Summary collapse

Attributes inherited from ChunkReader

#errors

Instance Method Summary collapse

Methods inherited from ChunkReader

chunk_map, #make_defaults, #process_tags, set_chunk_length

Constructor Details

#initialize(strio) ⇒ TextureLayer

Returns a new instance of TextureLayer.



266
267
268
269
270
271
272
273
274
275
276
# File 'lib/lightwave.rb', line 266

def initialize(strio)
  @type, header_chunk = strio.read_chunk(2)
  @errors = []
  if @type != 'IMAP'
    @errors << TextureError.new("#{@type} (non image-mapped) texture layer found.")
  end
  @ordinal = header_chunk.read_string

  @header = TextureHeader.new(header_chunk)
  super(strio)
end

Instance Attribute Details

#aaObject Also known as: aa?

Returns the value of attribute aa.



232
233
234
# File 'lib/lightwave.rb', line 232

def aa
  @aa
end

#aa_strengthObject

Returns the value of attribute aa_strength.



232
233
234
# File 'lib/lightwave.rb', line 232

def aa_strength
  @aa_strength
end

#amplitudeObject

Returns the value of attribute amplitude.



235
236
237
# File 'lib/lightwave.rb', line 235

def amplitude
  @amplitude
end

#axisObject

Bodgetastic. Assumes that we’re only ever an IMAP texture block. Must change. The UV file has a NEGA as part of the header. I don’t think that can be right, according to the docs, but it does make sense in context.



228
229
230
# File 'lib/lightwave.rb', line 228

def axis
  @axis
end

#headerObject

Bodgetastic. Assumes that we’re only ever an IMAP texture block. Must change. The UV file has a NEGA as part of the header. I don’t think that can be right, according to the docs, but it does make sense in context.



228
229
230
# File 'lib/lightwave.rb', line 228

def header
  @header
end

#height_repeatObject

Returns the value of attribute height_repeat.



230
231
232
# File 'lib/lightwave.rb', line 230

def height_repeat
  @height_repeat
end

#height_wrapObject

Returns the value of attribute height_wrap.



229
230
231
# File 'lib/lightwave.rb', line 229

def height_wrap
  @height_wrap
end

#image_indexObject

Returns the value of attribute image_index.



229
230
231
# File 'lib/lightwave.rb', line 229

def image_index
  @image_index
end

#mappingObject

Bodgetastic. Assumes that we’re only ever an IMAP texture block. Must change. The UV file has a NEGA as part of the header. I don’t think that can be right, according to the docs, but it does make sense in context.



228
229
230
# File 'lib/lightwave.rb', line 228

def mapping
  @mapping
end

#ordinalObject

Bodgetastic. Assumes that we’re only ever an IMAP texture block. Must change. The UV file has a NEGA as part of the header. I don’t think that can be right, according to the docs, but it does make sense in context.



228
229
230
# File 'lib/lightwave.rb', line 228

def ordinal
  @ordinal
end

#pixel_blendingObject Also known as: pixel_blending?

Returns the value of attribute pixel_blending.



233
234
235
# File 'lib/lightwave.rb', line 233

def pixel_blending
  @pixel_blending
end

#projection_modeObject

Bodgetastic. Assumes that we’re only ever an IMAP texture block. Must change. The UV file has a NEGA as part of the header. I don’t think that can be right, according to the docs, but it does make sense in context.



228
229
230
# File 'lib/lightwave.rb', line 228

def projection_mode
  @projection_mode
end

#stickyObject Also known as: sticky?

Returns the value of attribute sticky.



234
235
236
# File 'lib/lightwave.rb', line 234

def sticky
  @sticky
end

#sticky_timeObject

Returns the value of attribute sticky_time.



234
235
236
# File 'lib/lightwave.rb', line 234

def sticky_time
  @sticky_time
end

#typeObject

Bodgetastic. Assumes that we’re only ever an IMAP texture block. Must change. The UV file has a NEGA as part of the header. I don’t think that can be right, according to the docs, but it does make sense in context.



228
229
230
# File 'lib/lightwave.rb', line 228

def type
  @type
end

#vertex_map_nameObject

Returns the value of attribute vertex_map_name.



231
232
233
# File 'lib/lightwave.rb', line 231

def vertex_map_name
  @vertex_map_name
end

#width_repeatObject

Returns the value of attribute width_repeat.



230
231
232
# File 'lib/lightwave.rb', line 230

def width_repeat
  @width_repeat
end

#width_wrapObject

Returns the value of attribute width_wrap.



229
230
231
# File 'lib/lightwave.rb', line 229

def width_wrap
  @width_wrap
end

Instance Method Details

#read_aa(c) ⇒ Object



262
263
264
265
# File 'lib/lightwave.rb', line 262

def read_aa(c)
  self.aa = c.read_u2 != 0
  self.aa_strength = c.read_float
end

#read_sticky(c) ⇒ Object



255
256
257
258
# File 'lib/lightwave.rb', line 255

def read_sticky(c)
  self.sticky = c.read_u2 != 0
  self.sticky_time = c.read_float
end

#read_wraps(c) ⇒ Object



259
260
261
# File 'lib/lightwave.rb', line 259

def read_wraps(c)
  self.width_wrap, self.height_wrap = [c.read_u2, c.read_u2].collect{|i| WRAP_TYPES[i]}
end