def _parse_rgb(line, color_mgr=None): t = line.split('=', maxsplit=1) name = t.pop(0).strip() if len(t) == 0: if color_mgr is None: return RGBArg(name, RGBSpectrum(0.0, 0.0, 0.0)) else: return arg_from_value(name, color_mgr.zero()) v = t.pop(0).strip().split(',') spectrum = RGBSpectrum(float(v[0]), float(v[1]), float(v[2])) if color_mgr is None: return RGBArg(name, spectrum) else: return arg_from_value(name, color_mgr.convert_spectrum(spectrum))
def _parse_rgb(line, color_mgr=None): t = line.split("=", maxsplit=1) name = t.pop(0).strip() if len(t) == 0: if color_mgr is None: return RGBArg(name, RGBSpectrum(0.0, 0.0, 0.0)) else: return arg_from_value(name, color_mgr.zero()) v = t.pop(0).strip().split(",") spectrum = RGBSpectrum(float(v[0]), float(v[1]), float(v[2])) if color_mgr is None: return RGBArg(name, spectrum) else: return arg_from_value(name, color_mgr.convert_spectrum(spectrum))
def register_shadepoint_class(spectrum): spec_arg = arg_from_value('dummy_name', spectrum) register_struct(ShadePoint, 'ShadePoint', fields=[ ('wo', Vec3Arg), ('wi', Vec3Arg), ('light_intensity', type(spec_arg)), ('light_position', Vec3Arg), ('material_reflectance', type(spec_arg)), ('pdf', FloatArg), ('light_normal', Vec3Arg), ('light_pdf', FloatArg), ('material_emission', type(spec_arg)), ('specular_bounce', IntArg)], factory=lambda: ShadePoint.factory(spectrum))