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

« back to all changes in this revision

Viewing changes to intern/cycles/kernel/svm/svm_texture.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:
42
42
 
43
43
/* Voronoi / Worley like */
44
44
 
45
 
__device_noinline void voronoi(float3 p, NodeDistanceMetric distance_metric, float e, float da[4], float3 pa[4])
 
45
__device_noinline float4 voronoi_Fn(float3 p, float e, int n1, int n2)
46
46
{
 
47
        float da[4];
 
48
        float3 pa[4];
 
49
        NodeDistanceMetric distance_metric = NODE_VORONOI_DISTANCE_SQUARED;
 
50
 
47
51
        /* returns distances in da and point coords in pa */
48
52
        int xx, yy, zz, xi, yi, zi;
49
53
 
105
109
                        }
106
110
                }
107
111
        }
108
 
}
109
 
 
110
 
__device float voronoi_Fn(float3 p, int n)
111
 
{
112
 
        float da[4];
113
 
        float3 pa[4];
114
 
 
115
 
        voronoi(p, NODE_VORONOI_DISTANCE_SQUARED, 0, da, pa);
116
 
 
117
 
        return da[n];
118
 
}
119
 
 
120
 
__device float voronoi_FnFn(float3 p, int n1, int n2)
121
 
{
122
 
        float da[4];
123
 
        float3 pa[4];
124
 
 
125
 
        voronoi(p, NODE_VORONOI_DISTANCE_SQUARED, 0, da, pa);
126
 
 
127
 
        return da[n2] - da[n1];
128
 
}
129
 
 
130
 
__device float voronoi_F1(float3 p) { return voronoi_Fn(p, 0); }
131
 
__device float voronoi_F2(float3 p) { return voronoi_Fn(p, 1); }
132
 
__device float voronoi_F3(float3 p) { return voronoi_Fn(p, 2); }
133
 
__device float voronoi_F4(float3 p) { return voronoi_Fn(p, 3); }
134
 
__device float voronoi_F1F2(float3 p) { return voronoi_FnFn(p, 0, 1); }
 
112
 
 
113
        float4 result = make_float4(pa[n1].x, pa[n1].y, pa[n1].z, da[n1]);
 
114
 
 
115
        if(n2 != -1)
 
116
                result = make_float4(pa[n2].x, pa[n2].y, pa[n2].z, da[n2]) - result;
 
117
 
 
118
        return result;
 
119
}
 
120
 
 
121
__device float voronoi_F1(float3 p) { return voronoi_Fn(p, 0.0f, 0, -1).w; }
 
122
__device float voronoi_F2(float3 p) { return voronoi_Fn(p, 0.0f, 1, -1).w; }
 
123
__device float voronoi_F3(float3 p) { return voronoi_Fn(p, 0.0f, 2, -1).w; }
 
124
__device float voronoi_F4(float3 p) { return voronoi_Fn(p, 0.0f, 3, -1).w; }
 
125
__device float voronoi_F1F2(float3 p) { return voronoi_Fn(p, 0.0f, 0, 1).w; }
135
126
 
136
127
__device float voronoi_Cr(float3 p)
137
128
{
152
143
__device float noise_basis(float3 p, NodeNoiseBasis basis)
153
144
{
154
145
        /* Only Perlin enabled for now, others break CUDA compile by making kernel
155
 
           too big, with compile using > 4GB, due to everything being inlined. */
 
146
         * too big, with compile using > 4GB, due to everything being inlined. */
156
147
 
157
148
#if 0
158
149
        if(basis == NODE_NOISE_PERLIN)
188
179
 
189
180
/* Waves */
190
181
 
191
 
__device float noise_wave(NodeWaveType wave, float a)
 
182
__device float noise_wave(NodeWaveBasis wave, float a)
192
183
{
193
184
        if(wave == NODE_WAVE_SINE) {
194
 
                return 0.5f + 0.5f*sin(a);
 
185
                return 0.5f + 0.5f * sinf(a);
195
186
        }
196
187
        else if(wave == NODE_WAVE_SAW) {
197
188
                float b = 2.0f*M_PI_F;
221
212
        int i, n;
222
213
 
223
214
        octaves = clamp(octaves, 0.0f, 16.0f);
224
 
        n= (int)octaves;
 
215
        n = (int)octaves;
225
216
 
226
217
        for(i = 0; i <= n; i++) {
227
218
                float t = noise_basis(fscale*p, basis);
234
225
                fscale *= 2.0f;
235
226
        }
236
227
 
237
 
        float rmd = octaves - floor(octaves);
 
228
        float rmd = octaves - floorf(octaves);
238
229
 
239
230
        if(rmd != 0.0f) {
240
231
                float t = noise_basis(fscale*p, basis);