Class: Rgltf::PbrMetallicRoughness

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

Instance Attribute Summary collapse

Attributes inherited from Rgltf::Properties::Base

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

Instance Method Summary collapse

Methods inherited from Rgltf::Properties::Base

#extension, #parse_extensions!

Constructor Details

#initialize(json, document:) ⇒ PbrMetallicRoughness

Returns a new instance of PbrMetallicRoughness.



42
43
44
45
46
47
48
49
# File 'lib/rgltf/properties/material.rb', line 42

def initialize(json, document:)
  super(json, document:, owner_type: :pbr_metallic_roughness)
  @base_color_factor = json.fetch('baseColorFactor', [1.0, 1.0, 1.0, 1.0]).freeze
  @base_color_texture = texture_info(json['baseColorTexture'], document)
  @metallic_factor = json.fetch('metallicFactor', 1.0)
  @roughness_factor = json.fetch('roughnessFactor', 1.0)
  @metallic_roughness_texture = texture_info(json['metallicRoughnessTexture'], document)
end

Instance Attribute Details

#base_color_factorObject (readonly)

Returns the value of attribute base_color_factor.



39
40
41
# File 'lib/rgltf/properties/material.rb', line 39

def base_color_factor
  @base_color_factor
end

#base_color_textureObject (readonly)

Returns the value of attribute base_color_texture.



39
40
41
# File 'lib/rgltf/properties/material.rb', line 39

def base_color_texture
  @base_color_texture
end

#metallic_factorObject (readonly)

Returns the value of attribute metallic_factor.



39
40
41
# File 'lib/rgltf/properties/material.rb', line 39

def metallic_factor
  @metallic_factor
end

#metallic_roughness_textureObject (readonly)

Returns the value of attribute metallic_roughness_texture.



39
40
41
# File 'lib/rgltf/properties/material.rb', line 39

def metallic_roughness_texture
  @metallic_roughness_texture
end

#roughness_factorObject (readonly)

Returns the value of attribute roughness_factor.



39
40
41
# File 'lib/rgltf/properties/material.rb', line 39

def roughness_factor
  @roughness_factor
end

Instance Method Details

#nested_propertiesObject



51
52
53
# File 'lib/rgltf/properties/material.rb', line 51

def nested_properties
  [base_color_texture, metallic_roughness_texture].compact
end