30 |
FPARAM(eps, .25); |
FPARAM(eps, .25); |
31 |
FPARAM(invert, 0); |
FPARAM(invert, 0); |
32 |
FPARAM(quantize, 255); |
FPARAM(quantize, 255); |
33 |
|
int angles = (int)params->getFloat("angles", 0); |
34 |
|
|
35 |
// Note: radius is specified in texels |
// Note: radius is specified in texels |
36 |
FPARAM(radius, 2); |
FPARAM(radius, 2); |
39 |
FPARAM(ripple_scale, 0.25); |
FPARAM(ripple_scale, 0.25); |
40 |
|
|
41 |
float *origdata = data; |
float *origdata = data; |
42 |
if(components != 4) { |
data = new float[width * height * depth * 4]; |
|
data = new float[width * height * depth * 4]; |
|
|
} |
|
43 |
|
|
44 |
if(depth != 1) return; |
if(depth != 1) return; |
45 |
if(width != height) return; |
if(width != height) return; |
88 |
data[i] = f * scale + bias; |
data[i] = f * scale + bias; |
89 |
|
|
90 |
// Add outer edge to quantized inner edge |
// Add outer edge to quantized inner edge |
91 |
if (components == 4) |
if (angles) |
92 |
data[i] = floor(data[i] * quantize + 0.5) / quantize; |
data[i] = floor(data[i] * quantize + 0.5) / quantize; |
93 |
} |
} |
94 |
|
|
95 |
if (components == 4) |
for (int comp = 0; comp < angles && comp < components; comp++) { |
96 |
for (int comp = 0; comp < 3; comp++) { |
|
97 |
float dx = cos(comp * 2*M_PI / 3); |
float dx = cos(comp * M_PI / angles); |
98 |
float dy = sin(comp * 2*M_PI / 3); |
float dy = sin(comp * M_PI / angles); |
99 |
|
|
100 |
ind = 0; |
ind = 0; |
101 |
for (j = 0, y = 0; j < height; j++, y += ystep) { |
for (j = 0, y = 0; j < height; j++, y += ystep) { |
113 |
if (h > maxh) maxh = h; |
if (h > maxh) maxh = h; |
114 |
} |
} |
115 |
|
|
116 |
data[ind + comp] = maxh; |
origdata[ind + comp] = maxh; |
117 |
ind += 4; |
|
118 |
|
ind += components; |
119 |
} |
} |
120 |
} |
} |
121 |
|
|
131 |
} |
} |
132 |
#endif |
#endif |
133 |
|
|
134 |
if (components < 4) { |
for (int i = 0; i < width * height * depth; i++) |
135 |
for (int i = 0; i < width * height * depth; i++) |
for (int c = angles; c < components; c++) |
136 |
for (int c = 0; c < components; c++) |
origdata[i * components + c] = data[4 * i + 3 - (c - angles)]; |
137 |
origdata[i * components + c] = data[4 * i + 3 - c]; |
|
138 |
delete[] data; |
delete[] data; |
|
} |
|
139 |
} |
} |
140 |
|
|
141 |
|
|