This file is indexed.

/usr/share/OpenGTL/common/libraries/stdlib.fragment is in libopenshiva0.8 0.9.16-0ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
/*
 *  Copyright (c) 2008,2009,2010,2011 Cyrille Berger <cberger@cberger.net>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation;
 * version 2 of the License.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

library stdlib
{
  const float PI = 3.14159265358979323846;
  const unsigned int RAND_MAX = 16777215; // 0xFFFFFF
  // abs functions
  float abs( float v )
  {
    if( v < 0) return -v;
    return v;
  }
  float2 abs(float2 v)
  {
    return float2( abs(v.x), abs(v.y) );
  }
  float3 abs(float3 v)
  {
    return float3( abs(v.x), abs(v.y), abs(v.z) );
  }
  float4 abs(float4 v)
  {
    return float4( abs(v.x), abs(v.y), abs(v.z), abs(v.a) );
  }
  // Sign function
  float sign( float v )
  {
    if( v < 0 ) return -1;
    if( v > 0 ) return 1;
    return v;
  }
  // min functions
  float min(float a, float b)
  {
    if( a > b) return b;
    return a;
  }
  float2 min(float2 v, float2 v2)
  {
    return float2( min(v.x, v2.x), min(v.y, v2.y) );
  }
  float3 min(float3 v, float3 v2)
  {
    return float3( min(v.x, v2.x), min(v.y, v2.y), min(v.z, v2.z) );
  }
  float4 min(float4 v, float4 v2)
  {
    return float4( min(v.x, v2.x), min(v.y, v2.y), min(v.z, v2.z), min(v.a, v2.a) );
  }
  // max functions
  float max(float a, float b)
  {
    if( a < b) return b;
    return a;
  }
  float2 max(float2 v, float2 v2)
  {
    return float2( max(v.x, v2.x), max(v.y, v2.y) );
  }
  float3 max(float3 v, float3 v2)
  {
    return float3( max(v.x, v2.x), max(v.y, v2.y), max(v.z, v2.z) );
  }
  float4 max(float4 v, float4 v2)
  {
    return float4( max(v.x, v2.x), max(v.y, v2.y), max(v.z, v2.z), max(v.a, v2.a) );
  }
  // mix functions
  color mix(color a, color b, float c)
  {
    color r;
    r.red = a.red * (1-c) + b.red * c;
    r.green = a.green * (1-c) + b.green * c;
    r.blue = a.blue * (1-c) + b.blue * c;
    r.opacity = a.red * (1-c) + b.opacity * c;
    return r;
  }
  float mix(float a, float b, float c)
  {
    return a * (1 - c) + b * c;
  }
  float2 mix(float2 a, float2 b, float c)
  {
    return a * (1 - c) + b * c;
  }
  float3 mix(float3 a, float3 b, float c)
  {
    return a * (1 - c) + b * c;
  }
  float4 mix(float4 a, float4 b, float c)
  {
    return a * (1 - c) + b * c;
  }
  // clamp functions
  float clamp(float a, float min, float max)
  {
    if( a < min ) return min;
    if( a > max ) return max;
    return a;
  }
  float2 clamp(float2 a, float2 min, float2 max)
  {
    return float2(clamp(a.x, min.x, max.x), clamp(a.y, min.y, max.y));
  }
  float3 clamp(float3 a, float3 min, float3 max)
  {
    return float3(clamp(a.x, min.x, max.x), clamp(a.y, min.y, max.y), clamp(a.z, min.z, max.z));
  }
  float4 clamp(float4 a, float4 min, float4 max)
  {
    return float4(clamp(a.x, min.x, max.x), clamp(a.y, min.y, max.y), clamp(a.z, min.z, max.z), clamp(a.a, min.a, max.a));
  }
  // Lengths functions
  float length( float2 v )
  {
    v *= v;
    return sqrt(v.x + v.y);
  }
  float length( float3 v )
  {
    v *= v;
    return sqrt(v.x + v.y + v.z);
  }
  float length( float4 v )
  {
    v *= v;
    return sqrt(v.x + v.y + v.z + v.a);
  }
  // floor
  float2 floor(float2 v)
  {
    return float2( floor(v.x), floor(v.y) );
  }
  float3 floor(float3 v)
  {
    return float3( floor(v.x), floor(v.y), floor(v.z) );
  }
  float4 floor(float4 v)
  {
    return float4( floor(v.x), floor(v.y), floor(v.z), floor(v.a) );
  }
  // ceil
  float2 ceil(float2 v)
  {
    return float2( ceil(v.x), ceil(v.y) );
  }
  float3 ceil(float3 v)
  {
    return float3( ceil(v.x), ceil(v.y), ceil(v.z) );
  }
  float4 ceil(float4 v)
  {
    return float4( ceil(v.x), ceil(v.y), ceil(v.z), ceil(v.a) );
  }
  // fract
  float fract(float v)
  {
    return v - floor(v);
  }
  float2 fract(float2 v)
  {
    return float2( fract(v.x), fract(v.y) );
  }
  float3 fract(float3 v)
  {
    return float3( fract(v.x), fract(v.y), fract(v.z) );
  }
  float4 fract(float4 v)
  {
    return float4( fract(v.x), fract(v.y), fract(v.z), fract(v.a) );
  }
  // cos functions
  float2 cos(float2 v)
  {
    return float2( cos(v.x), cos(v.y) );
  }
  float3 cos(float3 v)
  {
    return float3( cos(v.x), cos(v.y), cos(v.z) );
  }
  float4 cos(float4 v)
  {
    return float4( cos(v.x), cos(v.y), cos(v.z), cos(v.a) );
  }
  // acos functions
  float2 acos(float2 v)
  {
    return float2( acos(v.x), acos(v.y) );
  }
  float3 acos(float3 v)
  {
    return float3( acos(v.x), acos(v.y), acos(v.z) );
  }
  float4 acos(float4 v)
  {
    return float4( acos(v.x), acos(v.y), acos(v.z), acos(v.a) );
  }
  // sin functions
  float2 sin(float2 v)
  {
    return float2( sin(v.x), sin(v.y) );
  }
  float3 sin(float3 v)
  {
    return float3( sin(v.x), sin(v.y), sin(v.z) );
  }
  float4 sin(float4 v)
  {
    return float4( sin(v.x), sin(v.y), sin(v.z), sin(v.a) );
  }
  // asin functions
  float2 asin(float2 v)
  {
    return float2( asin(v.x), asin(v.y) );
  }
  float3 asin(float3 v)
  {
    return float3( asin(v.x), asin(v.y), asin(v.z) );
  }
  float4 asin(float4 v)
  {
    return float4( asin(v.x), asin(v.y), asin(v.z), asin(v.a) );
  }
  // tan functions
  float2 tan(float2 v)
  {
    return float2( tan(v.x), tan(v.y) );
  }
  float3 tan(float3 v)
  {
    return float3( tan(v.x), tan(v.y), tan(v.z) );
  }
  float4 tan(float4 v)
  {
    return float4( tan(v.x), tan(v.y), tan(v.z), tan(v.a) );
  }
  // atan functions
  float2 atan(float2 v)
  {
    return float2( atan(v.x), atan(v.y) );
  }
  float3 atan(float3 v)
  {
    return float3( atan(v.x), atan(v.y), atan(v.z) );
  }
  float4 atan(float4 v)
  {
    return float4( atan(v.x), atan(v.y), atan(v.z), atan(v.a) );
  }
  // atan2 functions
  float2 atan2(float2 v, float2 v2)
  {
    return float2( atan2(v.x, v2.x), atan2(v.y, v2.y) );
  }
  float3 atan2(float3 v, float3 v2)
  {
    return float3( atan2(v.x, v2.x), atan2(v.y, v2.y), atan2(v.z, v2.z) );
  }
  float4 atan2(float4 v, float4 v2)
  {
    return float4( atan2(v.x, v2.x), atan2(v.y, v2.y), atan2(v.z, v2.z), atan2(v.a, v2.a) );
  }
  // cosh functions
  float2 cosh(float2 v)
  {
    return float2( cosh(v.x), cosh(v.y) );
  }
  float3 cosh(float3 v)
  {
    return float3( cosh(v.x), cosh(v.y), cosh(v.z) );
  }
  float4 cosh(float4 v)
  {
    return float4( cosh(v.x), cosh(v.y), cosh(v.z), cosh(v.a) );
  }
  // sinh functions
  float2 sinh(float2 v)
  {
    return float2( sinh(v.x), sinh(v.y) );
  }
  float3 sinh(float3 v)
  {
    return float3( sinh(v.x), sinh(v.y), sinh(v.z) );
  }
  float4 sinh(float4 v)
  {
    return float4( sinh(v.x), sinh(v.y), sinh(v.z), sinh(v.a) );
  }
  // tanh functions
  float2 tanh(float2 v)
  {
    return float2( tanh(v.x), tanh(v.y) );
  }
  float3 tanh(float3 v)
  {
    return float3( tanh(v.x), tanh(v.y), tanh(v.z) );
  }
  float4 tanh(float4 v)
  {
    return float4( tanh(v.x), tanh(v.y), tanh(v.z), tanh(v.a) );
  }
  // exp functions
  float2 exp(float2 v)
  {
    return float2( exp(v.x), exp(v.y) );
  }
  float3 exp(float3 v)
  {
    return float3( exp(v.x), exp(v.y), exp(v.z) );
  }
  float4 exp(float4 v)
  {
    return float4( exp(v.x), exp(v.y), exp(v.z), exp(v.a) );
  }
  // log functions
  float2 log(float2 v)
  {
    return float2( log(v.x), log(v.y) );
  }
  float3 log(float3 v)
  {
    return float3( log(v.x), log(v.y), log(v.z) );
  }
  float4 log(float4 v)
  {
    return float4( log(v.x), log(v.y), log(v.z), log(v.a) );
  }
  // log10 functions
  float2 log10(float2 v)
  {
    return float2( log10(v.x), log10(v.y) );
  }
  float3 log10(float3 v)
  {
    return float3( log10(v.x), log10(v.y), log10(v.z) );
  }
  float4 log10(float4 v)
  {
    return float4( log10(v.x), log10(v.y), log10(v.z), log10(v.a) );
  }
  // sqrt functions
  float2 sqrt(float2 v)
  {
    return float2( sqrt(v.x), sqrt(v.y) );
  }
  float3 sqrt(float3 v)
  {
    return float3( sqrt(v.x), sqrt(v.y), sqrt(v.z) );
  }
  float4 sqrt(float4 v)
  {
    return float4( sqrt(v.x), sqrt(v.y), sqrt(v.z), sqrt(v.a) );
  }
  // pow functions
  float2 pow(float2 v, float p)
  {
    return float2( pow(v.x, p), pow(v.y, p) );
  }
  float3 pow(float3 v, float p)
  {
    return float3( pow(v.x, p), pow(v.y, p), pow(v.z, p) );
  }
  float4 pow(float4 v, float p)
  {
    return float4( pow(v.x, p), pow(v.y, p), pow(v.z, p), pow(v.a, p) );
  }
  float2 pow(float2 v, float2 p)
  {
    return float2( pow(v.x, p.x), pow(v.y, p.y) );
  }
  float3 pow(float3 v, float3 p)
  {
    return float3( pow(v.x, p.x), pow(v.y, p.y), pow(v.z, p.z) );
  }
  float4 pow(float4 v, float4 p)
  {
    return float4( pow(v.x, p.x), pow(v.y, p.y), pow(v.z, p.z), pow(v.a, p.a) );
  }
  // deg2rad
  float deg2rad(float d)
  {
    return d / 180 * PI;
  }
  float2 deg2rad(float2 v)
  {
    return float2( deg2rad(v.x), deg2rad(v.y) );
  }
  float3 deg2rad(float3 v)
  {
    return float3( deg2rad(v.x), deg2rad(v.y), deg2rad(v.z) );
  }
  float4 deg2rad(float4 v)
  {
    return float4( deg2rad(v.x), deg2rad(v.y), deg2rad(v.z), deg2rad(v.a) );
  }
  // rad2deg
  float rad2deg(float d)
  {
    return d / PI * 180;
  }
  float2 rad2deg(float2 v)
  {
    return float2( rad2deg(v.x), rad2deg(v.y) );
  }
  float3 rad2deg(float3 v)
  {
    return float3( rad2deg(v.x), rad2deg(v.y), rad2deg(v.z) );
  }
  float4 rad2deg(float4 v)
  {
    return float4( rad2deg(v.x), rad2deg(v.y), rad2deg(v.z), rad2deg(v.a) );
  }
  // Random function
  unsigned int rand(output unsigned int seed)
  {
    seed = seed * 1103515245 + 12345;
    return (seed % RAND_MAX);
  }
  float frand(output unsigned int seed)
  {
    return rand(seed) / float(RAND_MAX);
  }
}