Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre_src_v1-9-0/OgreMain/include/OgreStaticFaceGroup.h @ 148

Last change on this file since 148 was 148, checked in by patricwi, 6 years ago

Added new dependencies for ogre1.9 and cegui0.8

File size: 5.3 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2013 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28#ifndef __StaticFaceGroup_H__
29#define __StaticFaceGroup_H__
30
31#include "OgrePrerequisites.h"
32
33#include "OgrePlane.h"
34#include "OgrePatchSurface.h"
35
36namespace Ogre {
37
38        /** \addtogroup Core
39        *  @{
40        */
41        /** \addtogroup Scene
42        *  @{
43        */
44        /** A type of face group, i.e. face list of procedural etc */
45    enum FaceGroupType {
46        FGT_FACE_LIST,
47        FGT_PATCH,
48        FGT_UNKNOWN
49    };
50
51    /** Collects a group of static i.e. immovable faces together which have common
52        properties like the material they use, the plane they lie on.
53        @remarks
54            Whilst for discrete geometry (i.e. movable objects) groups of faces are
55            held in the SubMesh class, for immovable objects like scenery there
56            needs to ba little more flexibility in the grouping since the group is
57            likely to be a small part of a huge set of geometry. In addition, because
58            the faces are unmoving certain optimisations can be performed, e.g.
59            precalculating a world-coordinate bounding box and normal.
60        @par
61            Exactly how this class is used depends on the format of the large
62            static geometry used in the level. An example would be the use of this
63            class in the BspNode class for indoor levels.
64            For flexibility and efficiency, it is not assumed that this class holds
65            details of the vertices itself, or in fact that it holds the vertex indices
66            itself. Everything is manipulated via pointers so if you want this
67            class to point into a block of geometry data it can.
68    */
69    struct StaticFaceGroup {
70        // Type of face group.
71        FaceGroupType fType;
72
73        /// Is this a sky surface?
74        bool isSky;
75
76        /** Index into a buffer containing vertex definitions. Because we're
77            dealing with subsets of large levels this is likely to be part-way
78            through a huge vertex buffer. */
79        int vertexStart;
80
81        /** The range of vertices in the buffer this facegroup references.
82            This is really for copying purposes only, so that we know which
83            subset of vertices to copy from our large-level buffer into the rendering buffer.
84        */
85        int numVertices;
86
87        /** Index into a buffer containing vertex indices. This buffer
88            may be individual to this group or shared for memory allocation
89            efficiency.The vertex indexes are relative the the mVertexStart pointer,
90            not to the start of the large-level buffer, allowing simple reindexing
91            when copying data into rendering buffers.
92            This is only applicable to FGT_FACE_LIST face group types.
93        */
94        int elementStart;
95
96        /** The number of vertex indices.
97            This is only applicable to FGT_FACE_LIST face group types.
98        */
99        int numElements;
100
101        /** Handle to material used by this group.
102            Note the use of the material handle rather than the material
103            name - this is for efficiency since there will be many of these.
104        */
105        ResourceHandle materialHandle;
106
107        Plane plane;
108
109        /// Patch surface (only applicable when fType = FGT_PATCH)
110        PatchSurface* patchSurf;
111
112
113        _OgreExport friend std::ostream& operator<<(std::ostream& o, const StaticFaceGroup& s)
114        {
115            o << "StaticFaceGroup(";
116            if (s.fType == FGT_FACE_LIST)
117            {
118                o << "faceList, numVertices=" << s.numVertices << ", vertexStart=" << s.vertexStart;
119                o << ", numElements=" << s.numElements << ", elementStart=" << s.elementStart;
120                o << ", normal=" << s.plane.normal;
121            }
122            else if (s.fType == FGT_PATCH)
123            {
124                o << "bezierPatch, numVertices=" << s.numVertices << ", vertexStart=" << s.vertexStart;
125                // TODO
126            }
127
128            o << ", materialHandle=" << s.materialHandle;
129            o << ")";
130
131            return o;
132        }
133
134
135    };
136        /** @} */
137        /** @} */
138
139} // namespace
140
141#endif
Note: See TracBrowser for help on using the repository browser.