OSL_SHADEOP void osl_luminance_dfdv (void *sg, void *out, void *c) { ShadingContext *ctx = (ShadingContext *)((ShaderGlobals *)sg)->context; ((float *)out)[0] = ctx->shadingsys().luminance (((const Color3 *)c)[0]); ((float *)out)[1] = ctx->shadingsys().luminance (((const Color3 *)c)[1]); ((float *)out)[2] = ctx->shadingsys().luminance (((const Color3 *)c)[2]); }
OSL_SHADEOP void osl_prepend_color_from (void *sg, void *c_, const char *from) { ShadingContext *ctx (((ShaderGlobals *)sg)->context); Color3 &c (*(Color3*)c_); c = ctx->shadingsys().to_rgb (USTR(from), c[0], c[1], c[2]); }
OSL_SHADEOP void osl_wavelength_color_vf (void *sg, void *out, float lambda) { ShadingContext *ctx = (ShadingContext *)((ShaderGlobals *)sg)->context; Color3 rgb = ctx->shadingsys().XYZ_to_RGB (wavelength_color_XYZ (lambda)); // constrain_rgb (rgb); rgb *= 1.0/2.52; // Empirical scale from lg to make all comps <= 1 // norm_rgb (rgb); clamp_zero (rgb); *(Color3 *)out = rgb; }
OSL_SHADEOP void osl_blackbody_vf (void *sg, void *out, float temp) { ShadingContext *ctx = (ShadingContext *)((ShaderGlobals *)sg)->context; *(Color3 *)out = ctx->shadingsys().blackbody_rgb (temp); }