Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Dinges <blender@dingto.org>2013-06-11 01:55:41 +0400
committerThomas Dinges <blender@dingto.org>2013-06-11 01:55:41 +0400
commit9020df976ca37104a36a90d43c6e5b33c24cdbd2 (patch)
tree8ce649d25f4de2f84b340a9d8328ef39ed8b2851 /intern/cycles/kernel/svm/svm_hsv.h
parentc03e638cf310cde57ede10d3d9c90aecce007b15 (diff)
parentcf359f6c7f259bf669a144c9a455fe79780fc6ff (diff)
Cycles / Wavelength to RGB node:
* Added a node to convert wavelength (in nanometers, from 380nm to 780nm) to RGB values. This can be useful to match real world colors easier. * Code cleanup: ** Moved color functions (xyz and hsv) into dedicated utility files. ** Remove svm_lerp(), use interp() instead. Documentation: http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/More#Wavelength Example render: http://www.pasteall.org/pic/show.php?id=53202 This is part of my GSoC 2013. (revisions 57322, 57326, 57335 and 57367 from soc-2013-dingto).
Diffstat (limited to 'intern/cycles/kernel/svm/svm_hsv.h')
-rw-r--r--intern/cycles/kernel/svm/svm_hsv.h74
1 files changed, 0 insertions, 74 deletions
diff --git a/intern/cycles/kernel/svm/svm_hsv.h b/intern/cycles/kernel/svm/svm_hsv.h
index 348f13f59f2..6e6a9dff159 100644
--- a/intern/cycles/kernel/svm/svm_hsv.h
+++ b/intern/cycles/kernel/svm/svm_hsv.h
@@ -21,80 +21,6 @@
CCL_NAMESPACE_BEGIN
-__device float3 rgb_to_hsv(float3 rgb)
-{
- float cmax, cmin, h, s, v, cdelta;
- float3 c;
-
- cmax = fmaxf(rgb.x, fmaxf(rgb.y, rgb.z));
- cmin = min(rgb.x, min(rgb.y, rgb.z));
- cdelta = cmax - cmin;
-
- v = cmax;
-
- if(cmax != 0.0f) {
- s = cdelta/cmax;
- }
- else {
- s = 0.0f;
- h = 0.0f;
- }
-
- if(s == 0.0f) {
- h = 0.0f;
- }
- else {
- float3 cmax3 = make_float3(cmax, cmax, cmax);
- c = (cmax3 - rgb)/cdelta;
-
- if(rgb.x == cmax) h = c.z - c.y;
- else if(rgb.y == cmax) h = 2.0f + c.x - c.z;
- else h = 4.0f + c.y - c.x;
-
- h /= 6.0f;
-
- if(h < 0.0f)
- h += 1.0f;
- }
-
- return make_float3(h, s, v);
-}
-
-__device float3 hsv_to_rgb(float3 hsv)
-{
- float i, f, p, q, t, h, s, v;
- float3 rgb;
-
- h = hsv.x;
- s = hsv.y;
- v = hsv.z;
-
- if(s == 0.0f) {
- rgb = make_float3(v, v, v);
- }
- else {
- if(h == 1.0f)
- h = 0.0f;
-
- h *= 6.0f;
- i = floorf(h);
- f = h - i;
- rgb = make_float3(f, f, f);
- p = v*(1.0f-s);
- q = v*(1.0f-(s*f));
- t = v*(1.0f-(s*(1.0f-f)));
-
- if(i == 0.0f) rgb = make_float3(v, t, p);
- else if(i == 1.0f) rgb = make_float3(q, v, p);
- else if(i == 2.0f) rgb = make_float3(p, v, t);
- else if(i == 3.0f) rgb = make_float3(p, q, v);
- else if(i == 4.0f) rgb = make_float3(t, p, v);
- else rgb = make_float3(v, p, q);
- }
-
- return rgb;
-}
-
__device void svm_node_hsv(KernelGlobals *kg, ShaderData *sd, float *stack, uint in_color_offset, uint fac_offset, uint out_color_offset, int *offset)
{
/* read extra data */