Coverage Report

Created: 2025-10-12 07:23

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ogre/OgreMain/include/OgreCommon.h
Line
Count
Source
1
/*
2
-----------------------------------------------------------------------------
3
This source file is part of OGRE
4
    (Object-oriented Graphics Rendering Engine)
5
For the latest info, see http://www.ogre3d.org/
6
7
Copyright (c) 2000-2014 Torus Knot Software Ltd
8
9
Permission is hereby granted, free of charge, to any person obtaining a copy
10
of this software and associated documentation files (the "Software"), to deal
11
in the Software without restriction, including without limitation the rights
12
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
copies of the Software, and to permit persons to whom the Software is
14
furnished to do so, subject to the following conditions:
15
16
The above copyright notice and this permission notice shall be included in
17
all copies or substantial portions of the Software.
18
19
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
THE SOFTWARE.
26
-----------------------------------------------------------------------------
27
*/
28
#ifndef __Common_H__
29
#define __Common_H__
30
// Common stuff
31
32
#include "OgreVector.h"
33
#include "OgreHeaderPrefix.h"
34
#include "OgreMurmurHash3.h"
35
36
namespace Ogre {
37
38
    /** \addtogroup Core
39
    *  @{
40
    */
41
    /** \addtogroup General
42
    *  @{
43
    */
44
45
    /// Fast general hashing algorithm
46
0
    inline uint32 FastHash (const char * data, size_t len, uint32 hashSoFar = 0) {
47
0
        uint32 ret;
48
0
        MurmurHash3_x86_32(data, len, hashSoFar, &ret);
49
0
        return ret;
50
0
    }
51
    /// Combine hashes with same style as boost::hash_combine
52
    template <typename T>
53
    uint32 HashCombine (uint32 hashSoFar, const T& data)
54
0
    {
55
0
        return FastHash((const char*)&data, sizeof(T), hashSoFar);
56
0
    }
Unexecuted instantiation: unsigned int Ogre::HashCombine<unsigned short>(unsigned int, unsigned short const&)
Unexecuted instantiation: unsigned int Ogre::HashCombine<unsigned long>(unsigned int, unsigned long const&)
57
58
59
    /** Comparison functions used for the depth/stencil buffer operations and 
60
        others. */
61
    enum CompareFunction : uint8
62
    {
63
        CMPF_ALWAYS_FAIL,  //!< Never writes a pixel to the render target
64
        CMPF_ALWAYS_PASS,  //!< Always writes a pixel to the render target
65
        CMPF_LESS,         //!< Write if (new_Z < existing_Z)
66
        CMPF_LESS_EQUAL,   //!< Write if (new_Z <= existing_Z)
67
        CMPF_EQUAL,        //!< Write if (new_Z == existing_Z)
68
        CMPF_NOT_EQUAL,    //!< Write if (new_Z != existing_Z)
69
        CMPF_GREATER_EQUAL,//!< Write if (new_Z >= existing_Z)
70
        CMPF_GREATER       //!< Write if (new_Z >= existing_Z)
71
    };
72
73
    /** High-level filtering options providing shortcuts to settings the
74
        minification, magnification and mip filters. */
75
    enum TextureFilterOptions
76
    {
77
        /// No filtering or mipmapping is used. 
78
        /// Equal to: min=Ogre::FO_POINT, mag=Ogre::FO_POINT, mip=Ogre::FO_NONE
79
        TFO_NONE,
80
        /// 2x2 box filtering is performed when magnifying or reducing a texture, and a mipmap is picked from the list but no filtering is done between the levels of the mipmaps. 
81
        /// Equal to: min=Ogre::FO_LINEAR, mag=Ogre::FO_LINEAR, mip=Ogre::FO_POINT
82
        TFO_BILINEAR,
83
        /// 2x2 box filtering is performed when magnifying and reducing a texture, and the closest 2 mipmaps are filtered together. 
84
        /// Equal to: min=Ogre::FO_LINEAR, mag=Ogre::FO_LINEAR, mip=Ogre::FO_LINEAR
85
        TFO_TRILINEAR,
86
        /// This is the same as ’trilinear’, except the filtering algorithm takes account of the slope of the triangle in relation to the camera rather than simply doing a 2x2 pixel filter in all cases.
87
        /// Equal to: min=Ogre::FO_ANISOTROPIC, max=Ogre::FO_ANISOTROPIC, mip=Ogre::FO_LINEAR
88
        TFO_ANISOTROPIC
89
    };
90
91
    enum FilterType
92
    {
93
        /// The filter used when shrinking a texture
94
        FT_MIN,
95
        /// The filter used when magnifying a texture
96
        FT_MAG,
97
        /// The filter used when determining the mipmap
98
        FT_MIP
99
    };
100
    /** Filtering options for textures / mipmaps. */
101
    enum FilterOptions : uint8
102
    {
103
        /// No filtering, used for FT_MIP to turn off mipmapping
104
        FO_NONE,
105
        /// Use the closest pixel
106
        FO_POINT,
107
        /// Average of a 2x2 pixel area, denotes bilinear for MIN and MAG, trilinear for MIP
108
        FO_LINEAR,
109
        /// Similar to FO_LINEAR, but compensates for the angle of the texture plane. Note that in
110
        /// order for this to make any difference, you must also set the
111
        /// TextureUnitState::setTextureAnisotropy attribute too.
112
        FO_ANISOTROPIC
113
    };
114
115
    /** Texture addressing modes - default is TAM_WRAP.
116
    */
117
    enum TextureAddressingMode : uint8
118
    {
119
        /// %Any value beyond 1.0 wraps back to 0.0. %Texture is repeated.
120
        TAM_WRAP,
121
        /// %Texture flips every boundary, meaning texture is mirrored every 1.0 u or v
122
        TAM_MIRROR,
123
        /// Values beyond 1.0 are clamped to 1.0. %Texture ’streaks’ beyond 1.0 since last line
124
        /// of pixels is used across the rest of the address space. Useful for textures which
125
        /// need exact coverage from 0.0 to 1.0 without the ’fuzzy edge’ wrap gives when
126
        /// combined with filtering.
127
        TAM_CLAMP,
128
        /// %Texture coordinates outside the range [0.0, 1.0] are set to the border colour.
129
        TAM_BORDER
130
    };
131
132
    /// Strategies for allocating and managing render buffers.
133
    enum RenderBufferPool : uint16
134
    {
135
        /// No automatic allocation. Use this when the buffer is not needed, or when it will be managed explicitly by the user.
136
        RBP_NONE    = 0,
137
        /// Automatically allocated and managed from the default shared pool (pool ID = 1)
138
        RBP_DEFAULT = 1
139
    };
140
141
    /** %Light shading modes. */
142
    enum ShadeOptions : uint8
143
    {
144
        SO_FLAT, //!< No interpolation takes place. Each face is shaded with a single colour determined from the first vertex in the face.
145
        SO_GOURAUD, //!< Colour at each vertex is linearly interpolated across the face.
146
        SO_PHONG //!< Vertex normals are interpolated across the face, and these are used to determine colour at each pixel. Gives a more natural lighting effect but is more expensive and works better at high levels of tessellation. Not supported on all hardware.
147
    };
148
149
    /** Fog modes. */
150
    enum FogMode : uint8
151
    {
152
        /// No fog. Duh.
153
        FOG_NONE,
154
        /// Fog density increases  exponentially from the camera (fog = 1/e^(distance * density))
155
        FOG_EXP,
156
        /// Fog density increases at the square of FOG_EXP, i.e. even quicker (fog = 1/e^(distance * density)^2)
157
        FOG_EXP2,
158
        /// Fog density increases linearly between the start and end distances
159
        FOG_LINEAR
160
    };
161
162
    /** Hardware culling modes based on vertex winding.
163
        This setting applies to how the hardware API culls triangles it is sent. */
164
    enum CullingMode : uint8
165
    {
166
        /// Hardware never culls triangles and renders everything it receives.
167
        CULL_NONE = 1,
168
        /// Hardware culls triangles whose vertices are listed clockwise in the view (default).
169
        CULL_CLOCKWISE = 2,
170
        /// Hardware culls triangles whose vertices are listed anticlockwise in the view.
171
        CULL_ANTICLOCKWISE = 3
172
    };
173
174
    /** Manual culling modes based on vertex normals.
175
        This setting applies to how the software culls triangles before sending them to the 
176
        hardware API. This culling mode is used by scene managers which choose to implement it -
177
        normally those which deal with large amounts of fixed world geometry which is often 
178
        planar (software culling movable variable geometry is expensive). */
179
    enum ManualCullingMode : uint8
180
    {
181
        /// No culling so everything is sent to the hardware.
182
        MANUAL_CULL_NONE = 1,
183
        /// Cull triangles whose normal is pointing away from the camera (default).
184
        MANUAL_CULL_BACK = 2,
185
        /// Cull triangles whose normal is pointing towards the camera.
186
        MANUAL_CULL_FRONT = 3
187
    };
188
189
    /** Enumerates the wave types usable with the Ogre engine. */
190
    enum WaveformType
191
    {
192
        /// Standard sine wave which smoothly changes from low to high and back again.
193
        WFT_SINE,
194
        /// An angular wave with a constant increase / decrease speed with pointed peaks.
195
        WFT_TRIANGLE,
196
        /// Half of the time is spent at the min, half at the max with instant transition between.
197
        WFT_SQUARE,
198
        /// Gradual steady increase from min to max over the period with an instant return to min at the end.
199
        WFT_SAWTOOTH,
200
        /// Gradual steady decrease from max to min over the period, with an instant return to max at the end.
201
        WFT_INVERSE_SAWTOOTH,
202
        /// Pulse Width Modulation. Works like WFT_SQUARE, except the high to low transition is controlled by duty cycle. 
203
        /// With a duty cycle of 50% (0.5) will give the same output as WFT_SQUARE.
204
        WFT_PWM
205
    };
206
207
    /** The polygon mode to use when rasterising. */
208
    enum PolygonMode : uint8
209
    {
210
        /// Only the points of each polygon are rendered.
211
        PM_POINTS = 1,
212
        /// Polygons are drawn in outline only.
213
        PM_WIREFRAME = 2,
214
        /// The normal situation - polygons are filled in.
215
        PM_SOLID = 3
216
    };
217
218
    /** An enumeration of broad shadow techniques */
219
    enum ShadowTechnique
220
    {
221
        /** No shadows */
222
        SHADOWTYPE_NONE = 0x00,
223
        /** Mask for additive shadows (not for direct use, use  SHADOWTYPE_ enum instead)
224
        */
225
        SHADOWDETAILTYPE_ADDITIVE = 0x01,
226
        /** Mask for modulative shadows (not for direct use, use  SHADOWTYPE_ enum instead)
227
        */
228
        SHADOWDETAILTYPE_MODULATIVE = 0x02,
229
        /** Mask for integrated shadows (not for direct use, use SHADOWTYPE_ enum instead)
230
        */
231
        SHADOWDETAILTYPE_INTEGRATED = 0x04,
232
        /** Mask for stencil shadows (not for direct use, use  SHADOWTYPE_ enum instead)
233
        */
234
        SHADOWDETAILTYPE_STENCIL = 0x10,
235
        /** Mask for texture shadows (not for direct use, use  SHADOWTYPE_ enum instead)
236
        */
237
        SHADOWDETAILTYPE_TEXTURE = 0x20,
238
        
239
        /** Stencil shadow technique which renders all shadow volumes as
240
            a modulation after all the non-transparent areas have been 
241
            rendered. This technique is considerably less fillrate intensive 
242
            than the additive stencil shadow approach when there are multiple
243
            lights, but is not an accurate model. 
244
        */
245
        SHADOWTYPE_STENCIL_MODULATIVE = SHADOWDETAILTYPE_STENCIL | SHADOWDETAILTYPE_MODULATIVE,
246
        /** Stencil shadow technique which renders each light as a separate
247
            additive pass to the scene. This technique can be very fillrate
248
            intensive because it requires at least 2 passes of the entire
249
            scene, more if there are multiple lights. However, it is a more
250
            accurate model than the modulative stencil approach and this is
251
            especially apparent when using coloured lights or bump mapping.
252
        */
253
        SHADOWTYPE_STENCIL_ADDITIVE = SHADOWDETAILTYPE_STENCIL | SHADOWDETAILTYPE_ADDITIVE,
254
        /** Texture-based shadow technique which involves a monochrome render-to-texture
255
            of the shadow caster and a projection of that texture onto the 
256
            shadow receivers as a modulative pass. 
257
        */
258
        SHADOWTYPE_TEXTURE_MODULATIVE = SHADOWDETAILTYPE_TEXTURE | SHADOWDETAILTYPE_MODULATIVE,
259
        
260
        /** Texture-based shadow technique which involves a render-to-texture
261
            of the shadow caster and a projection of that texture onto the 
262
            shadow receivers, built up per light as additive passes. 
263
            This technique can be very fillrate intensive because it requires numLights + 2 
264
            passes of the entire scene. However, it is a more accurate model than the 
265
            modulative approach and this is especially apparent when using coloured lights 
266
            or bump mapping.
267
        */
268
        SHADOWTYPE_TEXTURE_ADDITIVE = SHADOWDETAILTYPE_TEXTURE | SHADOWDETAILTYPE_ADDITIVE,
269
270
        /** Texture-based shadow technique which involves a render-to-texture
271
        of the shadow caster and a projection of that texture on to the shadow
272
        receivers, with the usage of those shadow textures completely controlled
273
        by the materials of the receivers.
274
        This technique is easily the most flexible of all techniques because 
275
        the material author is in complete control over how the shadows are
276
        combined with regular rendering. It can perform shadows as accurately
277
        as SHADOWTYPE_TEXTURE_ADDITIVE but more efficiently because it requires
278
        less passes. However it also requires more expertise to use, and 
279
        in almost all cases, shader capable hardware to really use to the full.
280
        @note The 'additive' part of this mode means that the colour of
281
        the rendered shadow texture is by default plain black. It does
282
        not mean it does the adding on your receivers automatically though, how you
283
        use that result is up to you.
284
        */
285
        SHADOWTYPE_TEXTURE_ADDITIVE_INTEGRATED = SHADOWTYPE_TEXTURE_ADDITIVE | SHADOWDETAILTYPE_INTEGRATED,
286
        /** Texture-based shadow technique which involves a render-to-texture
287
            of the shadow caster and a projection of that texture on to the shadow
288
            receivers, with the usage of those shadow textures completely controlled
289
            by the materials of the receivers.
290
            This technique is easily the most flexible of all techniques because 
291
            the material author is in complete control over how the shadows are
292
            combined with regular rendering. It can perform shadows as accurately
293
            as SHADOWTYPE_TEXTURE_ADDITIVE but more efficiently because it requires
294
            less passes. However it also requires more expertise to use, and 
295
            in almost all cases, shader capable hardware to really use to the full.
296
            @note The 'modulative' part of this mode means that the colour of
297
            the rendered shadow texture is by default the 'shadow colour'. It does
298
            not mean it modulates on your receivers automatically though, how you
299
            use that result is up to you.
300
        */
301
        SHADOWTYPE_TEXTURE_MODULATIVE_INTEGRATED = SHADOWTYPE_TEXTURE_MODULATIVE | SHADOWDETAILTYPE_INTEGRATED
302
    };
303
304
    /** An enumeration describing which material properties should track the vertex colours */
305
    typedef int TrackVertexColourType;
306
    enum TrackVertexColourEnum {
307
        TVC_NONE        = 0x0,
308
        TVC_AMBIENT     = 0x1,        
309
        TVC_DIFFUSE     = 0x2,
310
        TVC_SPECULAR    = 0x4,
311
        TVC_EMISSIVE    = 0x8
312
    };
313
314
    /** Function used compute the camera-distance for sorting objects */
315
    enum SortMode : uint8
316
    {
317
318
        /** Sort by direction of the camera.
319
         * The distance along the camera view as in `cam->getDerivedDirection().dotProduct(diff)`
320
         * Best for @ref PT_ORTHOGRAPHIC
321
         */
322
        SM_DIRECTION,
323
        /** Sort by distance from the camera.
324
         * The euclidean distance as in `diff.squaredLength()`
325
         * Best for @ref PT_PERSPECTIVE
326
         */
327
        SM_DISTANCE
328
    };
329
330
    /** Defines the frame buffer types. */
331
    enum FrameBufferType {
332
        FBT_COLOUR  = 0x1,
333
        FBT_DEPTH   = 0x2,
334
        FBT_STENCIL = 0x4
335
    };
336
  
337
  /** Defines the colour buffer types. */
338
    enum ColourBufferType
339
    {
340
      CBT_BACK = 0x0,
341
      CBT_BACK_LEFT,
342
      CBT_BACK_RIGHT
343
    };
344
345
    /** Flags for the Instance Manager when calculating ideal number of instances per batch */
346
    enum InstanceManagerFlags
347
    {
348
        /** Forces an amount of instances per batch low enough so that vertices * numInst < 65535
349
            since usually improves performance. In HW instanced techniques, this flag is ignored
350
        */
351
        IM_USE16BIT     = 0x0001,
352
353
        /** The num. of instances is adjusted so that as few pixels as possible are wasted
354
            in the vertex texture */
355
        IM_VTFBESTFIT   = 0x0002,
356
357
        /** Use a limited number of skeleton animations shared among all instances. 
358
        Update only that limited amount of animations in the vertex texture.*/
359
        IM_VTFBONEMATRIXLOOKUP = 0x0004,
360
361
        IM_USEBONEDUALQUATERNIONS = 0x0008,
362
363
        /** Use one weight per vertex when recommended (i.e. VTF). */
364
        IM_USEONEWEIGHT = 0x0010,
365
366
        /** All techniques are forced to one weight per vertex. */
367
        IM_FORCEONEWEIGHT = 0x0020,
368
369
        IM_USEALL       = IM_USE16BIT|IM_VTFBESTFIT|IM_USEONEWEIGHT
370
    };
371
    
372
    class Light;
373
    typedef std::vector<Light*> LightList;
374
375
376
    /// Constant blank string, useful for returning by ref where local does not exist
377
    const String BLANKSTRING;
378
379
    typedef std::map<String, bool> UnaryOptionList;
380
    typedef std::map<String, String> BinaryOptionList;
381
382
    /// Name / value parameter pair (first = name, second = value)
383
    typedef std::map<String, String> NameValuePairList;
384
385
    /// Alias / Texture name pair (first = alias, second = texture name)
386
    typedef std::map<String, String> AliasTextureNamePairList;
387
388
        template< typename T > struct TRect
389
        {
390
          T left, top, right, bottom;
391
0
          TRect() : left(0), top(0), right(0), bottom(0) {}
392
          TRect( T const & l, T const & t, T const & r, T const & b )
393
0
            : left( l ), top( t ), right( r ), bottom( b )
394
0
          {
395
0
          }
Unexecuted instantiation: Ogre::TRect<int>::TRect(int const&, int const&, int const&, int const&)
Unexecuted instantiation: Ogre::TRect<float>::TRect(float const&, float const&, float const&, float const&)
396
          TRect( TRect const & o )
397
0
            : left( o.left ), top( o.top ), right( o.right ), bottom( o.bottom )
398
0
          {
399
0
          }
400
          TRect & operator=( TRect const & o )
401
0
          {
402
0
            left = o.left;
403
0
            top = o.top;
404
0
            right = o.right;
405
0
            bottom = o.bottom;
406
0
            return *this;
407
0
          }
Unexecuted instantiation: Ogre::TRect<float>::operator=(Ogre::TRect<float> const&)
Unexecuted instantiation: Ogre::TRect<int>::operator=(Ogre::TRect<int> const&)
408
          T width() const
409
0
          {
410
0
            return right - left;
411
0
          }
Unexecuted instantiation: Ogre::TRect<float>::width() const
Unexecuted instantiation: Ogre::TRect<int>::width() const
412
          T height() const
413
0
          {
414
0
            return bottom - top;
415
0
          }
Unexecuted instantiation: Ogre::TRect<float>::height() const
Unexecuted instantiation: Ogre::TRect<int>::height() const
416
          bool isNull() const
417
0
          {
418
0
              return width() == 0 || height() == 0;
419
0
          }
420
          void setNull()
421
0
          {
422
0
              left = right = top = bottom = 0;
423
0
          }
424
          TRect & merge(const TRect& rhs)
425
0
          {
426
0
              assert(right >= left && bottom >= top);
427
0
              assert(rhs.right >= rhs.left && rhs.bottom >= rhs.top);
428
0
              if (isNull())
429
0
              {
430
0
                  *this = rhs;
431
0
              }
432
0
              else if (!rhs.isNull())
433
0
              {
434
0
                  left = std::min(left, rhs.left);
435
0
                  right = std::max(right, rhs.right);
436
0
                  top = std::min(top, rhs.top);
437
0
                  bottom = std::max(bottom, rhs.bottom);
438
0
              }
439
440
0
              return *this;
441
442
0
          }
443
444
          /**
445
           * Returns the intersection of the two rectangles.
446
           *
447
           * Note that the rectangles extend downwards. I.e. a valid box will
448
           * have "right > left" and "bottom > top".
449
           * @param rhs Another rectangle.
450
           * @return The intersection of the two rectangles. Zero size if they don't intersect.
451
           */
452
          TRect intersect(const TRect& rhs) const
453
0
          {
454
0
              assert(right >= left && bottom >= top);
455
0
              assert(rhs.right >= rhs.left && rhs.bottom >= rhs.top);
456
0
              TRect ret;
457
0
              if (isNull() || rhs.isNull())
458
0
              {
459
                  // empty
460
0
                  return ret;
461
0
              }
462
0
              else
463
0
              {
464
0
                  ret.left = std::max(left, rhs.left);
465
0
                  ret.right = std::min(right, rhs.right);
466
0
                  ret.top = std::max(top, rhs.top);
467
0
                  ret.bottom = std::min(bottom, rhs.bottom);
468
0
              }
469
470
0
              if (ret.left > ret.right || ret.top > ret.bottom)
471
0
              {
472
                  // no intersection, return empty
473
0
                  ret.left = ret.top = ret.right = ret.bottom = 0;
474
0
              }
475
476
0
              return ret;
477
478
0
          }
479
          bool operator==(const TRect& rhs) const
480
          {
481
              return left == rhs.left && right == rhs.right && top == rhs.top && bottom == rhs.bottom;
482
          }
483
          bool operator!=(const TRect& rhs) const { return !(*this == rhs); }
484
        };
485
        template<typename T>
486
        std::ostream& operator<<(std::ostream& o, const TRect<T>& r)
487
        {
488
            o << "TRect<>(l:" << r.left << ", t:" << r.top << ", r:" << r.right << ", b:" << r.bottom << ")";
489
            return o;
490
        }
491
492
        /** Structure used to define a rectangle in a 2-D floating point space.
493
        */
494
        typedef TRect<float> FloatRect;
495
496
        /** Structure used to define a rectangle in a 2-D floating point space, 
497
            subject to double / single floating point settings.
498
        */
499
        typedef TRect<Real> RealRect;
500
501
        /** Structure used to define a rectangle in a 2-D integer space.
502
        */
503
        typedef TRect< int32 > Rect;
504
505
        /** Structure used to define a box in a 3-D integer space.
506
            Note that the left, top, and front edges are included but the right,
507
            bottom and back ones are not.
508
         */
509
        struct Box
510
        {
511
            uint32 left, top, right, bottom, front, back;
512
            /// Parameterless constructor for setting the members manually
513
            Box()
514
0
                : left(0), top(0), right(1), bottom(1), front(0), back(1)
515
0
            {
516
0
            }
517
            /** Define a box from left, top, right and bottom coordinates
518
                This box will have depth one (front=0 and back=1).
519
                @param  l   x value of left edge
520
                @param  t   y value of top edge
521
                @param  r   x value of right edge
522
                @param  b   y value of bottom edge
523
                @note @copydetails Ogre::Box
524
            */
525
            Box( uint32 l, uint32 t, uint32 r, uint32 b ):
526
0
                left(l),
527
0
                top(t),   
528
0
                right(r),
529
0
                bottom(b),
530
0
                front(0),
531
0
                back(1)
532
0
            {
533
0
                assert(right >= left && bottom >= top && back >= front);
534
0
            }
535
536
            /// @overload
537
0
            template <typename T> explicit Box(const TRect<T>& r) : Box(r.left, r.top, r.right, r.bottom) {}
538
539
            /** Define a box from left, top, front, right, bottom and back
540
                coordinates.
541
                @param  l   x value of left edge
542
                @param  t   y value of top edge
543
                @param  ff  z value of front edge
544
                @param  r   x value of right edge
545
                @param  b   y value of bottom edge
546
                @param  bb  z value of back edge
547
                @note @copydetails Ogre::Box
548
            */
549
            Box( uint32 l, uint32 t, uint32 ff, uint32 r, uint32 b, uint32 bb ):
550
0
                left(l),
551
0
                top(t),   
552
0
                right(r),
553
0
                bottom(b),
554
0
                front(ff),
555
0
                back(bb)
556
0
            {
557
0
                assert(right >= left && bottom >= top && back >= front);
558
0
            }
559
560
            /// @overload
561
            explicit Box(const Vector3i& size)
562
0
                : left(0), top(0), right(size[0]), bottom(size[1]), front(0), back(size[2])
563
0
            {
564
0
            }
565
566
            /// Return true if the other box is a part of this one
567
            bool contains(const Box &def) const
568
0
            {
569
0
                return (def.left >= left && def.top >= top && def.front >= front &&
570
0
                    def.right <= right && def.bottom <= bottom && def.back <= back);
571
0
            }
572
            
573
            /// Get the width of this box
574
0
            uint32 getWidth() const { return right-left; }
575
            /// Get the height of this box
576
0
            uint32 getHeight() const { return bottom-top; }
577
            /// Get the depth of this box
578
0
            uint32 getDepth() const { return back-front; }
579
580
            /// origin (top, left, front) of the box
581
0
            Vector3i getOrigin() const { return Vector3i(left, top, front); }
582
            /// size (width, height, depth) of the box
583
0
            Vector3i getSize() const { return Vector3i(getWidth(), getHeight(), getDepth()); }
584
        };
585
586
    
587
    
588
    /** Locate command-line options of the unary form '-blah' and of the
589
        binary form '-blah foo', passing back the index of the next non-option.
590
    @param numargs, argv The standard parameters passed to the main method
591
    @param unaryOptList Map of unary options (i.e. those that do not require a parameter).
592
        Should be pre-populated with, for example '-e' in the key and false in the 
593
        value. Options which are found will be set to true on return.
594
    @param binOptList Map of binary options (i.e. those that require a parameter
595
        e.g. '-e afile.txt').
596
        Should be pre-populated with, for example '-e' and the default setting. 
597
        Options which are found will have the value updated.
598
    */
599
    int _OgreExport findCommandLineOpts(int numargs, char** argv, UnaryOptionList& unaryOptList, 
600
        BinaryOptionList& binOptList);
601
602
    /// Generic result of clipping
603
    enum ClipResult
604
    {
605
        /// Nothing was clipped
606
        CLIPPED_NONE = 0,
607
        /// Partially clipped
608
        CLIPPED_SOME = 1, 
609
        /// Everything was clipped away
610
        CLIPPED_ALL = 2
611
    };
612
613
    /// Render window creation parameters.
614
    struct RenderWindowDescription
615
    {
616
        String              name;
617
        unsigned int        width;
618
        unsigned int        height;
619
        bool                useFullScreen;
620
        NameValuePairList   miscParams;
621
    };
622
623
    /// Render window creation parameters container.
624
    typedef std::vector<RenderWindowDescription> RenderWindowDescriptionList;
625
626
    /// Render window container.
627
    typedef std::vector<RenderWindow*> RenderWindowList;
628
629
    /** @} */
630
    /** @} */
631
}
632
633
#include "OgreHeaderSuffix.h"
634
635
#endif