Sha256: 9ed7b0f55c6fe2d94974d84f7fec66eaea2acba827f998ccc379d0559982fdca

Contents?: true

Size: 592 Bytes

Versions: 10

Compression:

Stored size: 592 Bytes

Contents

require 'securerandom'

module Mittsu
  class MeshFaceMaterial
    def initialize(materials = [])
      @uuid = SecureRandom.uuid
      @type = 'MeshFaceMaterial'
      @materials = materials
    end

    def to_json
      {
        metadata: {
          version: 4.2,
          type: 'material',
          generator: 'MaterialExporter'
        },
        uuid: @uuid,
        type: @type,
        materials: @materials.map(&:to_json)
      }
    end

    def clone
      MeshFaceMaterial.new.tap do |mateiral|
        material.materials = @materials.map(&:clone)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mittsu-0.2.1 lib/mittsu/materials/mesh_face_material.rb
mittsu-0.2.0 lib/mittsu/materials/mesh_face_material.rb
mittsu-0.1.7 lib/mittsu/materials/mesh_face_material.rb
mittsu-0.1.6 lib/mittsu/materials/mesh_face_material.rb
mittsu-0.1.5 lib/mittsu/materials/mesh_face_material.rb
mittsu-0.1.4 lib/mittsu/materials/mesh_face_material.rb
mittsu-0.1.3 lib/mittsu/materials/mesh_face_material.rb
mittsu-0.1.2 lib/mittsu/materials/mesh_face_material.rb
mittsu-0.1.1 lib/mittsu/materials/mesh_face_material.rb
mittsu-0.1.0 lib/mittsu/materials/mesh_face_material.rb