Class: Rgltf::TextureInfo

Inherits:
Properties::Base show all
Defined in:
lib/rgltf/properties/material.rb

Direct Known Subclasses

NormalTextureInfo, OcclusionTextureInfo

Instance Attribute Summary collapse

Attributes inherited from Properties::Base

#extensions, #extras, #index, #name, #owner_type, #source_json

Instance Method Summary collapse

Methods inherited from Properties::Base

#extension, #nested_properties, #parse_extensions!

Constructor Details

#initialize(json, document:, owner_type: :texture_info) ⇒ TextureInfo

Returns a new instance of TextureInfo.



7
8
9
10
11
12
13
# File 'lib/rgltf/properties/material.rb', line 7

def initialize(json, document:, owner_type: :texture_info)
  super
  @texture = document.fetch_reference(:textures, json.fetch('index'), 'textureInfo/index')
  @tex_coord = json.fetch('texCoord', 0)
rescue KeyError => e
  raise FormatError, "invalid textureInfo: #{e.message}"
end

Instance Attribute Details

#tex_coordObject (readonly)

Returns the value of attribute tex_coord.



5
6
7
# File 'lib/rgltf/properties/material.rb', line 5

def tex_coord
  @tex_coord
end

#textureObject (readonly)

Returns the value of attribute texture.



5
6
7
# File 'lib/rgltf/properties/material.rb', line 5

def texture
  @texture
end

Instance Method Details

#transformObject



15
16
17
# File 'lib/rgltf/properties/material.rb', line 15

def transform
  extension('KHR_texture_transform')
end