Class: Mikunyan::CustomTypes::Texture2D

Inherits:
BaseObject show all
Defined in:
lib/mikunyan/types/texture2d.rb

Instance Attribute Summary

Attributes inherited from BaseObject

#object_entry

Attributes inherited from ObjectValue

#attr, #endian, #is_struct, #name, #type, #value

Instance Method Summary collapse

Methods inherited from BaseObject

#object_name, #path_id

Methods inherited from ObjectValue

#[], #[]=, #array?, #initialize, #key?, #keys, #method_missing, #respond_to_missing?, #simplify, #struct?, #value?

Constructor Details

This class inherits a constructor from Mikunyan::ObjectValue

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Mikunyan::ObjectValue

Instance Method Details

#generate_pngObject

Generates an png image (an instance of ChunkyPNG::Image) from the texture data



12
13
14
# File 'lib/mikunyan/types/texture2d.rb', line 12

def generate_png
  Mikunyan::Decoder::ImageDecoder.decode_object(self)
end

#heightObject



20
21
22
# File 'lib/mikunyan/types/texture2d.rb', line 20

def height
  @attr['m_Height']&.value
end

#mipmap_countObject



28
29
30
# File 'lib/mikunyan/types/texture2d.rb', line 28

def mipmap_count
  @attr['m_MipCount']&.value
end

#texture_formatObject



24
25
26
# File 'lib/mikunyan/types/texture2d.rb', line 24

def texture_format
  @attr['m_TextureFormat']&.value
end

#widthObject



16
17
18
# File 'lib/mikunyan/types/texture2d.rb', line 16

def width
  @attr['m_Width']&.value
end