~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to intern/cycles/kernel/svm/svm_mix.h

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
248
248
{
249
249
        float tm = 1.0f - t;
250
250
 
251
 
        float3 one= make_float3(1.0f, 1.0f, 1.0f);
252
 
        float3 scr= one - (one - col2)*(one - col1);
 
251
        float3 one = make_float3(1.0f, 1.0f, 1.0f);
 
252
        float3 scr = one - (one - col2)*(one - col1);
253
253
 
254
254
        return tm*col1 + t*((one - col1)*col2*col1 + col1*scr);
255
255
}
259
259
        float3 outcol = col1;
260
260
 
261
261
        if(col2.x > 0.5f)
262
 
                outcol.x= col1.x + t*(2.0f*(col2.x - 0.5f));
 
262
                outcol.x = col1.x + t*(2.0f*(col2.x - 0.5f));
263
263
        else
264
 
                outcol.x= col1.x + t*(2.0f*(col2.x) - 1.0f);
 
264
                outcol.x = col1.x + t*(2.0f*(col2.x) - 1.0f);
265
265
 
266
266
        if(col2.y > 0.5f)
267
 
                outcol.y= col1.y + t*(2.0f*(col2.y - 0.5f));
 
267
                outcol.y = col1.y + t*(2.0f*(col2.y - 0.5f));
268
268
        else
269
 
                outcol.y= col1.y + t*(2.0f*(col2.y) - 1.0f);
 
269
                outcol.y = col1.y + t*(2.0f*(col2.y) - 1.0f);
270
270
 
271
271
        if(col2.z > 0.5f)
272
 
                outcol.z= col1.z + t*(2.0f*(col2.z - 0.5f));
 
272
                outcol.z = col1.z + t*(2.0f*(col2.z - 0.5f));
273
273
        else
274
 
                outcol.z= col1.z + t*(2.0f*(col2.z) - 1.0f);
 
274
                outcol.z = col1.z + t*(2.0f*(col2.z) - 1.0f);
275
275
        
276
276
        return outcol;
277
277
}
278
278
 
 
279
__device float3 svm_mix_clamp(float3 col)
 
280
{
 
281
        float3 outcol = col;
 
282
 
 
283
        outcol.x = clamp(col.x, 0.0f, 1.0f);
 
284
        outcol.y = clamp(col.y, 0.0f, 1.0f);
 
285
        outcol.z = clamp(col.z, 0.0f, 1.0f);
 
286
 
 
287
        return outcol;
 
288
}
 
289
 
279
290
__device float3 svm_mix(NodeMix type, float fac, float3 c1, float3 c2)
280
291
{
281
292
        float t = clamp(fac, 0.0f, 1.0f);
299
310
                case NODE_MIX_COLOR: return svm_mix_color(t, c1, c2);
300
311
                case NODE_MIX_SOFT: return svm_mix_soft(t, c1, c2);
301
312
                case NODE_MIX_LINEAR: return svm_mix_linear(t, c1, c2);
 
313
                case NODE_MIX_CLAMP: return svm_mix_clamp(c1);
302
314
        }
303
315
 
304
316
        return make_float3(0.0f, 0.0f, 0.0f);