class SolidRuby::CSGModifiers::Color
Public Class Methods
new(object, attributes, opacity = nil)
click to toggle source
Calls superclass method
# File lib/solidruby/csg_modifiers/color.rb, line 18 def initialize(object, attributes, opacity = nil) @operation = 'color' if attributes.is_a? String attributes = "\"#{attributes}\"" attributes += ", #{opacity}" unless opacity.nil? elsif attributes.is_a? Hash attributes[:a] ||= 255 r = attributes[:r] / 255.0 g = attributes[:g] / 255.0 b = attributes[:b] / 255.0 a = attributes[:a] / 255.0 attributes = {c: [r, g, b], alpha: a} end super(object, attributes) end