This file is indexed.

/usr/include/OGRE/Volume/OgreVolumeCSGSource.h is in libogre-1.9-dev 1.9.0+dfsg1-4.

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
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/

Copyright (c) 2000-2013 Torus Knot Software Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __Ogre_Volume_CSGSource_H__
#define __Ogre_Volume_CSGSource_H__

#include "OgreVolumeSource.h"
#include "OgreVector3.h"
#include "OgreAxisAlignedBox.h"
#include "OgreVolumePrerequisites.h"
#include "OgreVolumeSimplexNoise.h"

namespace Ogre {
namespace Volume {

    /** A sphere.
    */
    class _OgreVolumeExport CSGSphereSource : public Source
    {
    protected:
        /** The radius.
        */
        const Real mR;
        
        /** The center.
        */
        const Vector3 mCenter;
    public:
    
        /** Constructor.
        @param r
            The radius.
        @param center
            The center.
        */
        CSGSphereSource(const Real r, const Vector3 &center);
        
        /** Overridden from Source.
        */
        virtual Vector4 getValueAndGradient(const Vector3 &position) const;

        /** Overridden from Source.
        */
        virtual Real getValue(const Vector3 &position) const;
    };

    /** A plane.
    */
    class _OgreVolumeExport CSGPlaneSource : public Source
    {
    protected:
        
        /// The distance to zero of the plane.
        const Real mD;
        
        /// The normal of the plane.
        Vector3 mNormal;

    public:
        
        /** Constructor.
        @param d
            The distance to zero of the plane.
        @param normal
            The planes normal.
        */
        CSGPlaneSource(const Real d, const Vector3 &normal);
        
        /** Overridden from Source.
        */
        virtual Vector4 getValueAndGradient(const Vector3 &position) const;

        /** Overridden from Source.
        */
        virtual Real getValue(const Vector3 &position) const;
    };

    /** A not rotated cube.
    */
    class _OgreVolumeExport CSGCubeSource : public Source
    {
    protected:
    
        /// The six possible normals of the cube.
        static Vector3 mBoxNormals[6];
        
        /// The box.
        AxisAlignedBox mBox;

        /** Gets the distance of a point to the nearest cube element.
        @param position
            The point to test.
        @return
            The distance.
        */
        inline Real distanceTo(const Vector3 &position) const
        {
            Real distance;
            const Vector3 dMin = position - mBox.getMinimum();
            const Vector3 dMax = mBox.getMaximum() - position;

            // Check if inside of the box
            if (dMin.x >= (Real)0.0 && dMin.y >= (Real)0.0 && dMin.z >= (Real)0.0 &&
                dMax.x >= (Real)0.0 && dMax.y >= (Real)0.0 && dMax.z >= (Real)0.0)
            {
                const Real d[6] = {dMin.x, dMin.y, dMin.z, dMax.x, dMax.y, dMax.z};
                distance = Math::POS_INFINITY;
                for (size_t i = 0; i < 6; ++i)
                {
                    if (d[i] < distance)
                    {
                        distance = d[i];
                    }
                }
            }
            else
            {
                distance = -mBox.distance(position);
            }
            return distance;
        }

    public:
    
        /** Constructor.
        @param min
            The lower back left corner.
        @param max
            The upper front right corner.
        */
        CSGCubeSource(const Vector3 &min, const Vector3 &max);
        
        /** Overridden from Source.
        */
        virtual Vector4 getValueAndGradient(const Vector3 &position) const;

        /** Overridden from Source.
        */
        virtual Real getValue(const Vector3 &position) const;
    };

    /** Abstract operation volume source holding two sources as operants.
    */
    class _OgreVolumeExport CSGOperationSource : public Source
    {
    protected:
    
        /// The first operant.
        const Source *mA;
        
        /// The second operant.
        const Source *mB;
        
        /** Constructor. Protected to be callable from child classes.
        @param a
            The first operator.
        @param b
            The second operator.
        */
        CSGOperationSource(const Source *a, const Source *b);

        /** Constructor, sets the sources to null.
        Protected to be callable from child classes.
        */
        CSGOperationSource(void);
    public:
        
        /** Gets the first operator source.
        @return
            The first operator source.
        */
        virtual const Source* getSourceA() const;
        
        /** Sets the first operator source.
        @param a
            The first operator source.
        */
        virtual void setSourceA(Source *a);

        /** Gets the second operator source.
        @return
            The second operator source.
        */
        virtual const Source* getSourceB(void) const;
        
        /** Sets the second operator source.
        @param b
            The second operator source.
        */
        virtual void setSourceB(Source *b);
    };

    /** Builds the intersection between two sources.
    */
    class _OgreVolumeExport CSGIntersectionSource : public CSGOperationSource
    {
    public:
    
        /** Constructor.
        @param a
            The first operator.
        @param b
            The second operator.
        */
        CSGIntersectionSource(const Source *a, const Source *b);

        /** Constructor, sets the sources to null.
        */
        CSGIntersectionSource(void);
        
        /** Overridden from Source.
        */
        virtual Vector4 getValueAndGradient(const Vector3 &position) const;

        /** Overridden from Source.
        */
        virtual Real getValue(const Vector3 &position) const;
    };

    /** Builds the union between two sources.
    */
    class _OgreVolumeExport CSGUnionSource : public CSGOperationSource
    {
    public:
    
        /** Constructor.
        @param a
            The first operator.
        @param b
            The second operator.
        */
        CSGUnionSource(const Source *a, const Source *b);

        /** Constructor, sets the sources to null.
        */
        CSGUnionSource(void);
        
        /** Overridden from Source.
        */
        virtual Vector4 getValueAndGradient(const Vector3 &position) const;

        /** Overridden from Source.
        */
        virtual Real getValue(const Vector3 &position) const;
    };

    /** Builds the difference between two sources.
    */
    class _OgreVolumeExport CSGDifferenceSource : public CSGOperationSource
    {
    public:
    
    
        /** Constructor.
        @param a
            The first operator.
        @param b
            The second operator.
        */
        CSGDifferenceSource(const Source *a, const Source *b);

        /** Constructor, sets the sources to null.
        */
        CSGDifferenceSource(void);
        
        /** Overridden from Source.
        */
        virtual Vector4 getValueAndGradient(const Vector3 &position) const;

        /** Overridden from Source.
        */
        virtual Real getValue(const Vector3 &position) const;
    };

    /** Source which does a unary operation to another one.
    */
    class _OgreVolumeExport CSGUnarySource : public Source
    {
    protected:
    
        /// The first operant.
        const Source *mSrc;
        
        /** Constructor. Protected to be callable from child classes.
        @param src
            The operator.
        */
        CSGUnarySource(const Source *src);

        /** Constructor. Sets the source to null.
        Protected to be callable from child classes.
        */
        CSGUnarySource(void);

    public:

        /** Gets the source.
        @return
            The source.
        */
        virtual const Source* getSource(void) const;
        
        /** Sets the source.
        @param a
            The source.
        */
        virtual void setSource(Source *a);
    };

    /** Negates the given volume.
    */
    class _OgreVolumeExport CSGNegateSource : public CSGUnarySource
    {
    public:
    
        /** Constructor.
        @param src
            The source to negate.
        */
        explicit CSGNegateSource(const Source *src);
        
        /** Constructor. Sets the source to null.
        */
        CSGNegateSource(void);
        
        /** Overridden from Source.
        */
        virtual Vector4 getValueAndGradient(const Vector3 &position) const;

        /** Overridden from Source.
        */
        virtual Real getValue(const Vector3 &position) const;
    };

    /** Scales the given volume source.
    */
    class _OgreVolumeExport CSGScaleSource : public CSGUnarySource
    {
    protected:
        
        /// Holds the dimensions of the volume.
        Real mScale;
    public:

        /** Constructor.
        @param src
            The source to scale.
        @param scale
            The scale of the source.
        */
        CSGScaleSource(const Source *src, const Real scale);
        
        /** Overridden from Source.
        */
        virtual Vector4 getValueAndGradient(const Vector3 &position) const;

        /** Overridden from Source.
        */
        virtual Real getValue(const Vector3 &position) const;
    };

    class _OgreVolumeExport CSGNoiseSource: public CSGUnarySource
    {
    protected:
        
        /// The frequencies of the octaves.
        Real *mFrequencies;

        /// The amplitudes of the octaves.
        Real *mAmplitudes;
        
        /// The amount of octaves.
        size_t mNumOctaves;
        
        /// To make some noise.
        SimplexNoise mNoise;

        /// To calculate the gradient.
        Real mGradientOff;

        /// The initial seed.
        long mSeed;

        /// Prepares the node members.
        void setData(void);

        /* Gets the density value.
        @param position
            The position of the value.
        @return
            The value.
        */
        inline Real getInternalValue(const Vector3 &position) const
        {
            Real toAdd = (Real)0.0;
            for (size_t i = 0; i < mNumOctaves; ++i)
            {
                toAdd += mNoise.noise(position.x * mFrequencies[i], position.y * mFrequencies[i], position.z * mFrequencies[i]) * mAmplitudes[i];
            }
            return mSrc->getValue(position) + toAdd;
        }

    public:
        
        /** Constructor.
        @param src
            The source to add the noise to.
        @param frequencies
            The frequencies of the added noise octaves.
        @param amplitudes
            The amplitudes of the added noise octaves.
        @param numOctaves
            The amount of octaves.
        @param seed
            The seed to initialize the random number generator with.
        */
        CSGNoiseSource(const Source *src, Real *frequencies, Real *amplitudes, size_t numOctaves, long seed);
                
        /** Constructor with current time as seed.
        @param src
            The source to add the noise to.
        @param frequencies
            The frequencies of the added noise octaves.
        @param amplitudes
            The amplitudes of the added noise octaves.
        @param numOctaves
            The amount of octaves.
        */
        CSGNoiseSource(const Source *src, Real *frequencies, Real *amplitudes, size_t numOctaves);
                
        /** Overridden from Source.
        */
        virtual Vector4 getValueAndGradient(const Vector3 &position) const;

        /** Overridden from Source.
        */
        virtual Real getValue(const Vector3 &position) const;
        
        /** Gets the initial seed.
        @return
            The initial seed.
        */
        long getSeed(void) const;
    };

}
}

#endif