Class: Assimp::EmbeddedTexture
- Inherits:
-
Object
- Object
- Assimp::EmbeddedTexture
- Defined in:
- lib/assimp/embedded_texture.rb
Instance Attribute Summary collapse
-
#bytes ⇒ Object
readonly
Returns the value of attribute bytes.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#format_hint ⇒ Object
readonly
Returns the value of attribute format_hint.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #compressed? ⇒ Boolean
-
#initialize(width:, height:, format_hint:, filename:, bytes:) ⇒ EmbeddedTexture
constructor
A new instance of EmbeddedTexture.
Constructor Details
#initialize(width:, height:, format_hint:, filename:, bytes:) ⇒ EmbeddedTexture
Returns a new instance of EmbeddedTexture.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/assimp/embedded_texture.rb', line 7 def initialize(width:, height:, format_hint:, filename:, bytes:) @width = Integer(width) @height = Integer(height) @format_hint = String(format_hint).dup.freeze @filename = String(filename).dup.freeze @bytes = String(bytes).dup.force_encoding(Encoding::BINARY).freeze expected = compressed? ? @width : @width * @height * 4 raise ArgumentError, "texture has #{@bytes.bytesize} bytes, expected #{expected}" unless @bytes.bytesize == expected freeze end |
Instance Attribute Details
#bytes ⇒ Object (readonly)
Returns the value of attribute bytes.
5 6 7 |
# File 'lib/assimp/embedded_texture.rb', line 5 def bytes @bytes end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
5 6 7 |
# File 'lib/assimp/embedded_texture.rb', line 5 def filename @filename end |
#format_hint ⇒ Object (readonly)
Returns the value of attribute format_hint.
5 6 7 |
# File 'lib/assimp/embedded_texture.rb', line 5 def format_hint @format_hint end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
5 6 7 |
# File 'lib/assimp/embedded_texture.rb', line 5 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
5 6 7 |
# File 'lib/assimp/embedded_texture.rb', line 5 def width @width end |
Instance Method Details
#compressed? ⇒ Boolean
19 20 21 |
# File 'lib/assimp/embedded_texture.rb', line 19 def compressed? height.zero? end |