Sha256: 5be6adacd93069c21fc21684189fe7ba846cabc51a622b606663aa1e6b6c52ad

Contents?: true

Size: 992 Bytes

Versions: 17

Compression:

Stored size: 992 Bytes

Contents

require 'mittsu/math'

module Mittsu
  class Face3
    attr_accessor :a, :b, :c, :normal, :vertex_normals, :color, :vertex_colors, :vertex_tangents, :material_index

    def initialize(a, b, c, normal = nil, color = nil, material_index = nil)
      @a = a
      @b = b
      @c = c
      @normal = normal.is_a?(Vector3) ? normal : Mittsu::Vector3.new
      @vertex_normals = normal.is_a?(Array) ? normal : []
      @color = color.is_a?(Color) ? color : Mittsu::Color.new
      @vertex_colors = color.is_a?(Array) ? normal : []
      @vertex_tangents = []
      @material_index = material_index.nil? ? 0 : material_index
    end

    def clone
      face = Mittsu::Face3.new(@a, @b, @c)
      face.normal.copy(@normal)
      face.color.copy(@color)
      face.material_index = @material_index
      face.vertex_normals = @vertex_normals.map(&:clone)
      face.vertex_colors = @vertex_colors.map(&:clone)
      face.vertex_tangents = @vertex_tangents.map(&:clone)
      face
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
mittsu-0.5.0 lib/mittsu/core/face3.rb
mittsu-0.4.1 lib/mittsu/core/face3.rb
mittsu-0.4.0 lib/mittsu/core/face3.rb
mittsu-0.3.3 lib/mittsu/core/face3.rb
mittsu-0.3.2 lib/mittsu/core/face3.rb
mittsu-0.3.1 lib/mittsu/core/face3.rb
mittsu-0.3.0 lib/mittsu/core/face3.rb
mittsu-0.2.4 lib/mittsu/core/face3.rb
mittsu-0.2.3 lib/mittsu/core/face3.rb
mittsu-0.2.2 lib/mittsu/core/face3.rb
mittsu-0.2.1 lib/mittsu/core/face3.rb
mittsu-0.2.0 lib/mittsu/core/face3.rb
mittsu-0.1.7 lib/mittsu/core/face3.rb
mittsu-0.1.6 lib/mittsu/core/face3.rb
mittsu-0.1.5 lib/mittsu/core/face3.rb
mittsu-0.1.4 lib/mittsu/core/face3.rb
mittsu-0.1.3 lib/mittsu/core/face3.rb