Class: Assimp::TextureCopier

Inherits:
Object
  • Object
show all
Defined in:
lib/assimp/texture_copier.rb

Instance Method Summary collapse

Instance Method Details

#copy(pointer) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/assimp/texture_copier.rb', line 5

def copy(pointer)
  source = Native::Texture.new(pointer)
  byte_size = source[:height].zero? ? source[:width] : source[:width] * source[:height] * 4
  EmbeddedTexture.new(
    width: source[:width],
    height: source[:height],
    format_hint: source[:format_hint].to_ptr.read_string(9).delete("\0"),
    filename: source[:filename].to_s,
    bytes: NativeReader.bytes(source[:data], byte_size)
  )
end