Sha256: ee355b5eae4c5e179396ab4f423e8754cae908218e2ad17e97774559ce3072b0

Contents?: true

Size: 620 Bytes

Versions: 10

Compression:

Stored size: 620 Bytes

Contents

require 'securerandom'

module Mittsu
  class MeshFaceMaterial
    attr_reader :materials

    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.5.0 lib/mittsu/materials/mesh_face_material.rb
mittsu-0.4.1 lib/mittsu/materials/mesh_face_material.rb
mittsu-0.4.0 lib/mittsu/materials/mesh_face_material.rb
mittsu-0.3.3 lib/mittsu/materials/mesh_face_material.rb
mittsu-0.3.2 lib/mittsu/materials/mesh_face_material.rb
mittsu-0.3.1 lib/mittsu/materials/mesh_face_material.rb
mittsu-0.3.0 lib/mittsu/materials/mesh_face_material.rb
mittsu-0.2.4 lib/mittsu/materials/mesh_face_material.rb
mittsu-0.2.3 lib/mittsu/materials/mesh_face_material.rb
mittsu-0.2.2 lib/mittsu/materials/mesh_face_material.rb