~ubuntu-branches/ubuntu/utopic/blender/utopic-proposed

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-02-19 11:24:23 UTC
  • mfrom: (14.2.23 sid)
  • Revision ID: package-import@ubuntu.com-20140219112423-rkmaz2m7ha06d4tk
Tags: 2.69-3ubuntu1
* Merge with Debian; remaining changes:
  - Configure without OpenImageIO on armhf, as it is not available on
    Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright 2011, Blender Foundation.
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or
5
 
 * modify it under the terms of the GNU General Public License
6
 
 * as published by the Free Software Foundation; either version 2
7
 
 * of the License, or (at your option) any later version.
8
 
 *
9
 
 * This program is distributed in the hope that it will be useful,
10
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
 * GNU General Public License for more details.
13
 
 *
14
 
 * You should have received a copy of the GNU General Public License
15
 
 * along with this program; if not, write to the Free Software Foundation,
16
 
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
2
 * Copyright 2011-2013 Blender Foundation
 
3
 *
 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
 
5
 * you may not use this file except in compliance with the License.
 
6
 * You may obtain a copy of the License at
 
7
 *
 
8
 * http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License
17
15
 */
18
16
 
19
17
CCL_NAMESPACE_BEGIN
22
20
 
23
21
__device float voronoi_distance(NodeDistanceMetric distance_metric, float3 d, float e)
24
22
{
 
23
#if 0
25
24
        if(distance_metric == NODE_VORONOI_DISTANCE_SQUARED)
 
25
#endif
26
26
                return dot(d, d);
 
27
#if 0
27
28
        if(distance_metric == NODE_VORONOI_ACTUAL_DISTANCE)
28
29
                return len(d);
29
30
        if(distance_metric == NODE_VORONOI_MANHATTAN)
38
39
                return powf(powf(fabsf(d.x), e) + powf(fabsf(d.y), e) + powf(fabsf(d.z), e), 1.0f/e);
39
40
        
40
41
        return 0.0f;
 
42
#endif
41
43
}
42
44
 
43
45
/* Voronoi / Worley like */
177
179
        return (hard)? fabsf(2.0f*t - 1.0f): t;
178
180
}
179
181
 
180
 
/* Waves */
181
 
 
182
 
__device float noise_wave(NodeWaveBasis wave, float a)
183
 
{
184
 
        if(wave == NODE_WAVE_SINE) {
185
 
                return 0.5f + 0.5f * sinf(a);
186
 
        }
187
 
        else if(wave == NODE_WAVE_SAW) {
188
 
                float b = M_2PI_F;
189
 
                int n = float_to_int(a / b);
190
 
                a -= n*b;
191
 
                if(a < 0.0f) a += b;
192
 
 
193
 
                return a / b;
194
 
        }
195
 
        else if(wave == NODE_WAVE_TRI) {
196
 
                float b = M_2PI_F;
197
 
                float rmax = 1.0f;
198
 
 
199
 
                return rmax - 2.0f*fabsf(floorf((a*(1.0f/b))+0.5f) - (a*(1.0f/b)));
200
 
        }
201
 
 
202
 
        return 0.0f;
203
 
}
204
 
 
205
182
/* Turbulence */
206
183
 
207
184
__device_noinline float noise_turbulence(float3 p, NodeNoiseBasis basis, float octaves, int hard)