Coverage Report

Created: 2025-07-18 07:08

/src/ogre/OgreMain/include/OgreCommon.h
Line
Count
Source (jump to first uncovered line)
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
    /** %Light shading modes. */
133
    enum ShadeOptions : uint8
134
    {
135
        SO_FLAT, //!< No interpolation takes place. Each face is shaded with a single colour determined from the first vertex in the face.
136
        SO_GOURAUD, //!< Colour at each vertex is linearly interpolated across the face.
137
        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.
138
    };
139
140
    /** Fog modes. */
141
    enum FogMode : uint8
142
    {
143
        /// No fog. Duh.
144
        FOG_NONE,
145
        /// Fog density increases  exponentially from the camera (fog = 1/e^(distance * density))
146
        FOG_EXP,
147
        /// Fog density increases at the square of FOG_EXP, i.e. even quicker (fog = 1/e^(distance * density)^2)
148
        FOG_EXP2,
149
        /// Fog density increases linearly between the start and end distances
150
        FOG_LINEAR
151
    };
152
153
    /** Hardware culling modes based on vertex winding.
154
        This setting applies to how the hardware API culls triangles it is sent. */
155
    enum CullingMode : uint8
156
    {
157
        /// Hardware never culls triangles and renders everything it receives.
158
        CULL_NONE = 1,
159
        /// Hardware culls triangles whose vertices are listed clockwise in the view (default).
160
        CULL_CLOCKWISE = 2,
161
        /// Hardware culls triangles whose vertices are listed anticlockwise in the view.
162
        CULL_ANTICLOCKWISE = 3
163
    };
164
165
    /** Manual culling modes based on vertex normals.
166
        This setting applies to how the software culls triangles before sending them to the 
167
        hardware API. This culling mode is used by scene managers which choose to implement it -
168
        normally those which deal with large amounts of fixed world geometry which is often 
169
        planar (software culling movable variable geometry is expensive). */
170
    enum ManualCullingMode : uint8
171
    {
172
        /// No culling so everything is sent to the hardware.
173
        MANUAL_CULL_NONE = 1,
174
        /// Cull triangles whose normal is pointing away from the camera (default).
175
        MANUAL_CULL_BACK = 2,
176
        /// Cull triangles whose normal is pointing towards the camera.
177
        MANUAL_CULL_FRONT = 3
178
    };
179
180
    /** Enumerates the wave types usable with the Ogre engine. */
181
    enum WaveformType
182
    {
183
        /// Standard sine wave which smoothly changes from low to high and back again.
184
        WFT_SINE,
185
        /// An angular wave with a constant increase / decrease speed with pointed peaks.
186
        WFT_TRIANGLE,
187
        /// Half of the time is spent at the min, half at the max with instant transition between.
188
        WFT_SQUARE,
189
        /// Gradual steady increase from min to max over the period with an instant return to min at the end.
190
        WFT_SAWTOOTH,
191
        /// Gradual steady decrease from max to min over the period, with an instant return to max at the end.
192
        WFT_INVERSE_SAWTOOTH,
193
        /// Pulse Width Modulation. Works like WFT_SQUARE, except the high to low transition is controlled by duty cycle. 
194
        /// With a duty cycle of 50% (0.5) will give the same output as WFT_SQUARE.
195
        WFT_PWM
196
    };
197
198
    /** The polygon mode to use when rasterising. */
199
    enum PolygonMode : uint8
200
    {
201
        /// Only the points of each polygon are rendered.
202
        PM_POINTS = 1,
203
        /// Polygons are drawn in outline only.
204
        PM_WIREFRAME = 2,
205
        /// The normal situation - polygons are filled in.
206
        PM_SOLID = 3
207
    };
208
209
    /** An enumeration of broad shadow techniques */
210
    enum ShadowTechnique
211
    {
212
        /** No shadows */
213
        SHADOWTYPE_NONE = 0x00,
214
        /** Mask for additive shadows (not for direct use, use  SHADOWTYPE_ enum instead)
215
        */
216
        SHADOWDETAILTYPE_ADDITIVE = 0x01,
217
        /** Mask for modulative shadows (not for direct use, use  SHADOWTYPE_ enum instead)
218
        */
219
        SHADOWDETAILTYPE_MODULATIVE = 0x02,
220
        /** Mask for integrated shadows (not for direct use, use SHADOWTYPE_ enum instead)
221
        */
222
        SHADOWDETAILTYPE_INTEGRATED = 0x04,
223
        /** Mask for stencil shadows (not for direct use, use  SHADOWTYPE_ enum instead)
224
        */
225
        SHADOWDETAILTYPE_STENCIL = 0x10,
226
        /** Mask for texture shadows (not for direct use, use  SHADOWTYPE_ enum instead)
227
        */
228
        SHADOWDETAILTYPE_TEXTURE = 0x20,
229
        
230
        /** Stencil shadow technique which renders all shadow volumes as
231
            a modulation after all the non-transparent areas have been 
232
            rendered. This technique is considerably less fillrate intensive 
233
            than the additive stencil shadow approach when there are multiple
234
            lights, but is not an accurate model. 
235
        */
236
        SHADOWTYPE_STENCIL_MODULATIVE = SHADOWDETAILTYPE_STENCIL | SHADOWDETAILTYPE_MODULATIVE,
237
        /** Stencil shadow technique which renders each light as a separate
238
            additive pass to the scene. This technique can be very fillrate
239
            intensive because it requires at least 2 passes of the entire
240
            scene, more if there are multiple lights. However, it is a more
241
            accurate model than the modulative stencil approach and this is
242
            especially apparent when using coloured lights or bump mapping.
243
        */
244
        SHADOWTYPE_STENCIL_ADDITIVE = SHADOWDETAILTYPE_STENCIL | SHADOWDETAILTYPE_ADDITIVE,
245
        /** Texture-based shadow technique which involves a monochrome render-to-texture
246
            of the shadow caster and a projection of that texture onto the 
247
            shadow receivers as a modulative pass. 
248
        */
249
        SHADOWTYPE_TEXTURE_MODULATIVE = SHADOWDETAILTYPE_TEXTURE | SHADOWDETAILTYPE_MODULATIVE,
250
        
251
        /** Texture-based shadow technique which involves a render-to-texture
252
            of the shadow caster and a projection of that texture onto the 
253
            shadow receivers, built up per light as additive passes. 
254
            This technique can be very fillrate intensive because it requires numLights + 2 
255
            passes of the entire scene. However, it is a more accurate model than the 
256
            modulative approach and this is especially apparent when using coloured lights 
257
            or bump mapping.
258
        */
259
        SHADOWTYPE_TEXTURE_ADDITIVE = SHADOWDETAILTYPE_TEXTURE | SHADOWDETAILTYPE_ADDITIVE,
260
261
        /** Texture-based shadow technique which involves a render-to-texture
262
        of the shadow caster and a projection of that texture on to the shadow
263
        receivers, with the usage of those shadow textures completely controlled
264
        by the materials of the receivers.
265
        This technique is easily the most flexible of all techniques because 
266
        the material author is in complete control over how the shadows are
267
        combined with regular rendering. It can perform shadows as accurately
268
        as SHADOWTYPE_TEXTURE_ADDITIVE but more efficiently because it requires
269
        less passes. However it also requires more expertise to use, and 
270
        in almost all cases, shader capable hardware to really use to the full.
271
        @note The 'additive' part of this mode means that the colour of
272
        the rendered shadow texture is by default plain black. It does
273
        not mean it does the adding on your receivers automatically though, how you
274
        use that result is up to you.
275
        */
276
        SHADOWTYPE_TEXTURE_ADDITIVE_INTEGRATED = SHADOWTYPE_TEXTURE_ADDITIVE | SHADOWDETAILTYPE_INTEGRATED,
277
        /** Texture-based shadow technique which involves a render-to-texture
278
            of the shadow caster and a projection of that texture on to the shadow
279
            receivers, with the usage of those shadow textures completely controlled
280
            by the materials of the receivers.
281
            This technique is easily the most flexible of all techniques because 
282
            the material author is in complete control over how the shadows are
283
            combined with regular rendering. It can perform shadows as accurately
284
            as SHADOWTYPE_TEXTURE_ADDITIVE but more efficiently because it requires
285
            less passes. However it also requires more expertise to use, and 
286
            in almost all cases, shader capable hardware to really use to the full.
287
            @note The 'modulative' part of this mode means that the colour of
288
            the rendered shadow texture is by default the 'shadow colour'. It does
289
            not mean it modulates on your receivers automatically though, how you
290
            use that result is up to you.
291
        */
292
        SHADOWTYPE_TEXTURE_MODULATIVE_INTEGRATED = SHADOWTYPE_TEXTURE_MODULATIVE | SHADOWDETAILTYPE_INTEGRATED
293
    };
294
295
    /** An enumeration describing which material properties should track the vertex colours */
296
    typedef int TrackVertexColourType;
297
    enum TrackVertexColourEnum {
298
        TVC_NONE        = 0x0,
299
        TVC_AMBIENT     = 0x1,        
300
        TVC_DIFFUSE     = 0x2,
301
        TVC_SPECULAR    = 0x4,
302
        TVC_EMISSIVE    = 0x8
303
    };
304
305
    /** Function used compute the camera-distance for sorting objects */
306
    enum SortMode : uint8
307
    {
308
309
        /** Sort by direction of the camera.
310
         * The distance along the camera view as in `cam->getDerivedDirection().dotProduct(diff)`
311
         * Best for @ref PT_ORTHOGRAPHIC
312
         */
313
        SM_DIRECTION,
314
        /** Sort by distance from the camera.
315
         * The euclidean distance as in `diff.squaredLength()`
316
         * Best for @ref PT_PERSPECTIVE
317
         */
318
        SM_DISTANCE
319
    };
320
321
    /** Defines the frame buffer types. */
322
    enum FrameBufferType {
323
        FBT_COLOUR  = 0x1,
324
        FBT_DEPTH   = 0x2,
325
        FBT_STENCIL = 0x4
326
    };
327
  
328
  /** Defines the colour buffer types. */
329
    enum ColourBufferType
330
    {
331
      CBT_BACK = 0x0,
332
      CBT_BACK_LEFT,
333
      CBT_BACK_RIGHT
334
    };
335
336
    /** Flags for the Instance Manager when calculating ideal number of instances per batch */
337
    enum InstanceManagerFlags
338
    {
339
        /** Forces an amount of instances per batch low enough so that vertices * numInst < 65535
340
            since usually improves performance. In HW instanced techniques, this flag is ignored
341
        */
342
        IM_USE16BIT     = 0x0001,
343
344
        /** The num. of instances is adjusted so that as few pixels as possible are wasted
345
            in the vertex texture */
346
        IM_VTFBESTFIT   = 0x0002,
347
348
        /** Use a limited number of skeleton animations shared among all instances. 
349
        Update only that limited amount of animations in the vertex texture.*/
350
        IM_VTFBONEMATRIXLOOKUP = 0x0004,
351
352
        IM_USEBONEDUALQUATERNIONS = 0x0008,
353
354
        /** Use one weight per vertex when recommended (i.e. VTF). */
355
        IM_USEONEWEIGHT = 0x0010,
356
357
        /** All techniques are forced to one weight per vertex. */
358
        IM_FORCEONEWEIGHT = 0x0020,
359
360
        IM_USEALL       = IM_USE16BIT|IM_VTFBESTFIT|IM_USEONEWEIGHT
361
    };
362
    
363
    class Light;
364
    typedef std::vector<Light*> LightList;
365
366
367
    /// Constant blank string, useful for returning by ref where local does not exist
368
    const String BLANKSTRING;
369
370
    typedef std::map<String, bool> UnaryOptionList;
371
    typedef std::map<String, String> BinaryOptionList;
372
373
    /// Name / value parameter pair (first = name, second = value)
374
    typedef std::map<String, String> NameValuePairList;
375
376
    /// Alias / Texture name pair (first = alias, second = texture name)
377
    typedef std::map<String, String> AliasTextureNamePairList;
378
379
        template< typename T > struct TRect
380
        {
381
          T left, top, right, bottom;
382
0
          TRect() : left(0), top(0), right(0), bottom(0) {}
383
          TRect( T const & l, T const & t, T const & r, T const & b )
384
0
            : left( l ), top( t ), right( r ), bottom( b )
385
0
          {
386
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&)
387
          TRect( TRect const & o )
388
0
            : left( o.left ), top( o.top ), right( o.right ), bottom( o.bottom )
389
0
          {
390
0
          }
391
          TRect & operator=( TRect const & o )
392
0
          {
393
0
            left = o.left;
394
0
            top = o.top;
395
0
            right = o.right;
396
0
            bottom = o.bottom;
397
0
            return *this;
398
0
          }
Unexecuted instantiation: Ogre::TRect<float>::operator=(Ogre::TRect<float> const&)
Unexecuted instantiation: Ogre::TRect<int>::operator=(Ogre::TRect<int> const&)
399
          T width() const
400
0
          {
401
0
            return right - left;
402
0
          }
Unexecuted instantiation: Ogre::TRect<float>::width() const
Unexecuted instantiation: Ogre::TRect<int>::width() const
403
          T height() const
404
0
          {
405
0
            return bottom - top;
406
0
          }
Unexecuted instantiation: Ogre::TRect<float>::height() const
Unexecuted instantiation: Ogre::TRect<int>::height() const
407
          bool isNull() const
408
0
          {
409
0
              return width() == 0 || height() == 0;
410
0
          }
411
          void setNull()
412
0
          {
413
0
              left = right = top = bottom = 0;
414
0
          }
415
          TRect & merge(const TRect& rhs)
416
0
          {
417
0
              assert(right >= left && bottom >= top);
418
0
              assert(rhs.right >= rhs.left && rhs.bottom >= rhs.top);
419
0
              if (isNull())
420
0
              {
421
0
                  *this = rhs;
422
0
              }
423
0
              else if (!rhs.isNull())
424
0
              {
425
0
                  left = std::min(left, rhs.left);
426
0
                  right = std::max(right, rhs.right);
427
0
                  top = std::min(top, rhs.top);
428
0
                  bottom = std::max(bottom, rhs.bottom);
429
0
              }
430
431
0
              return *this;
432
433
0
          }
434
435
          /**
436
           * Returns the intersection of the two rectangles.
437
           *
438
           * Note that the rectangles extend downwards. I.e. a valid box will
439
           * have "right > left" and "bottom > top".
440
           * @param rhs Another rectangle.
441
           * @return The intersection of the two rectangles. Zero size if they don't intersect.
442
           */
443
          TRect intersect(const TRect& rhs) const
444
0
          {
445
0
              assert(right >= left && bottom >= top);
446
0
              assert(rhs.right >= rhs.left && rhs.bottom >= rhs.top);
447
0
              TRect ret;
448
0
              if (isNull() || rhs.isNull())
449
0
              {
450
                  // empty
451
0
                  return ret;
452
0
              }
453
0
              else
454
0
              {
455
0
                  ret.left = std::max(left, rhs.left);
456
0
                  ret.right = std::min(right, rhs.right);
457
0
                  ret.top = std::max(top, rhs.top);
458
0
                  ret.bottom = std::min(bottom, rhs.bottom);
459
0
              }
460
461
0
              if (ret.left > ret.right || ret.top > ret.bottom)
462
0
              {
463
                  // no intersection, return empty
464
0
                  ret.left = ret.top = ret.right = ret.bottom = 0;
465
0
              }
466
467
0
              return ret;
468
469
0
          }
470
          bool operator==(const TRect& rhs) const
471
          {
472
              return left == rhs.left && right == rhs.right && top == rhs.top && bottom == rhs.bottom;
473
          }
474
          bool operator!=(const TRect& rhs) const { return !(*this == rhs); }
475
        };
476
        template<typename T>
477
        std::ostream& operator<<(std::ostream& o, const TRect<T>& r)
478
        {
479
            o << "TRect<>(l:" << r.left << ", t:" << r.top << ", r:" << r.right << ", b:" << r.bottom << ")";
480
            return o;
481
        }
482
483
        /** Structure used to define a rectangle in a 2-D floating point space.
484
        */
485
        typedef TRect<float> FloatRect;
486
487
        /** Structure used to define a rectangle in a 2-D floating point space, 
488
            subject to double / single floating point settings.
489
        */
490
        typedef TRect<Real> RealRect;
491
492
        /** Structure used to define a rectangle in a 2-D integer space.
493
        */
494
        typedef TRect< int32 > Rect;
495
496
        /** Structure used to define a box in a 3-D integer space.
497
            Note that the left, top, and front edges are included but the right,
498
            bottom and back ones are not.
499
         */
500
        struct Box
501
        {
502
            uint32 left, top, right, bottom, front, back;
503
            /// Parameterless constructor for setting the members manually
504
            Box()
505
0
                : left(0), top(0), right(1), bottom(1), front(0), back(1)
506
0
            {
507
0
            }
508
            /** Define a box from left, top, right and bottom coordinates
509
                This box will have depth one (front=0 and back=1).
510
                @param  l   x value of left edge
511
                @param  t   y value of top edge
512
                @param  r   x value of right edge
513
                @param  b   y value of bottom edge
514
                @note @copydetails Ogre::Box
515
            */
516
            Box( uint32 l, uint32 t, uint32 r, uint32 b ):
517
0
                left(l),
518
0
                top(t),   
519
0
                right(r),
520
0
                bottom(b),
521
0
                front(0),
522
0
                back(1)
523
0
            {
524
0
                assert(right >= left && bottom >= top && back >= front);
525
0
            }
526
527
            /// @overload
528
0
            template <typename T> explicit Box(const TRect<T>& r) : Box(r.left, r.top, r.right, r.bottom) {}
529
530
            /** Define a box from left, top, front, right, bottom and back
531
                coordinates.
532
                @param  l   x value of left edge
533
                @param  t   y value of top edge
534
                @param  ff  z value of front edge
535
                @param  r   x value of right edge
536
                @param  b   y value of bottom edge
537
                @param  bb  z value of back edge
538
                @note @copydetails Ogre::Box
539
            */
540
            Box( uint32 l, uint32 t, uint32 ff, uint32 r, uint32 b, uint32 bb ):
541
0
                left(l),
542
0
                top(t),   
543
0
                right(r),
544
0
                bottom(b),
545
0
                front(ff),
546
0
                back(bb)
547
0
            {
548
0
                assert(right >= left && bottom >= top && back >= front);
549
0
            }
550
551
            /// @overload
552
            explicit Box(const Vector3i& size)
553
0
                : left(0), top(0), right(size[0]), bottom(size[1]), front(0), back(size[2])
554
0
            {
555
0
            }
556
557
            /// Return true if the other box is a part of this one
558
            bool contains(const Box &def) const
559
0
            {
560
0
                return (def.left >= left && def.top >= top && def.front >= front &&
561
0
                    def.right <= right && def.bottom <= bottom && def.back <= back);
562
0
            }
563
            
564
            /// Get the width of this box
565
0
            uint32 getWidth() const { return right-left; }
566
            /// Get the height of this box
567
0
            uint32 getHeight() const { return bottom-top; }
568
            /// Get the depth of this box
569
0
            uint32 getDepth() const { return back-front; }
570
571
            /// origin (top, left, front) of the box
572
0
            Vector3i getOrigin() const { return Vector3i(left, top, front); }
573
            /// size (width, height, depth) of the box
574
0
            Vector3i getSize() const { return Vector3i(getWidth(), getHeight(), getDepth()); }
575
        };
576
577
    
578
    
579
    /** Locate command-line options of the unary form '-blah' and of the
580
        binary form '-blah foo', passing back the index of the next non-option.
581
    @param numargs, argv The standard parameters passed to the main method
582
    @param unaryOptList Map of unary options (i.e. those that do not require a parameter).
583
        Should be pre-populated with, for example '-e' in the key and false in the 
584
        value. Options which are found will be set to true on return.
585
    @param binOptList Map of binary options (i.e. those that require a parameter
586
        e.g. '-e afile.txt').
587
        Should be pre-populated with, for example '-e' and the default setting. 
588
        Options which are found will have the value updated.
589
    */
590
    int _OgreExport findCommandLineOpts(int numargs, char** argv, UnaryOptionList& unaryOptList, 
591
        BinaryOptionList& binOptList);
592
593
    /// Generic result of clipping
594
    enum ClipResult
595
    {
596
        /// Nothing was clipped
597
        CLIPPED_NONE = 0,
598
        /// Partially clipped
599
        CLIPPED_SOME = 1, 
600
        /// Everything was clipped away
601
        CLIPPED_ALL = 2
602
    };
603
604
    /// Render window creation parameters.
605
    struct RenderWindowDescription
606
    {
607
        String              name;
608
        unsigned int        width;
609
        unsigned int        height;
610
        bool                useFullScreen;
611
        NameValuePairList   miscParams;
612
    };
613
614
    /// Render window creation parameters container.
615
    typedef std::vector<RenderWindowDescription> RenderWindowDescriptionList;
616
617
    /// Render window container.
618
    typedef std::vector<RenderWindow*> RenderWindowList;
619
620
    /** @} */
621
    /** @} */
622
}
623
624
#include "OgreHeaderSuffix.h"
625
626
#endif