Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/PlugIns/OctreeSceneManager/include/OgreTerrainPage.h @ 3

Last change on this file since 3 was 3, checked in by anonymous, 17 years ago

=update

File size: 3.5 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-2006 Torus Knot Software Ltd
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23
24You may alternatively use this source under the terms of a specific version of
25the OGRE Unrestricted License provided you have obtained such a license from
26Torus Knot Software Ltd.
27-----------------------------------------------------------------------------
28*/
29#ifndef __TerrainPage_H__
30#define __TerrainPage_H__
31
32#include "OgreTerrainPrerequisites.h"
33#include "OgreRenderQueue.h"
34
35namespace Ogre {
36
37    /** Groups a number of TerrainRenderables (tiles) into a page, which is
38        the unit of loading / unloading.
39    @remarks
40        Note that this class, whilst holding onto TerrainRenderable instances,
41        does not actually process or initialise them itself - this is
42        intentional so the TerrainPageSource which is providing the tiles
43        is able to load and prepare each renderable incrementally if required,
44        thus avoiding any 'single hit' load methods for the page.
45    @par
46        All this class does do is pre-create a 2D vector of 'slots' in which
47        to place the TerrainRenderable pointers, which it does on
48        construction. Note that this structure is public to allow completely
49        free access to users of this class.
50    */
51    class _OgreOctreePluginExport TerrainPage
52    {
53    public:
54        typedef std::vector < TerrainRenderable * > TerrainRow;
55        typedef std::vector < TerrainRow > Terrain2D;
56       
57        /// 2-dimensional vector of tiles, pre-allocated to the correct size
58        Terrain2D tiles;
59        /// The number of tiles across a page
60        unsigned short tilesPerPage;
61        /// The scene node to which all the tiles for this page are attached
62        SceneNode* pageSceneNode;
63
64        /** The main constructor.
65        @param numTiles The number of terrain tiles (TerrainRenderable)
66            across (and down) a page
67        */
68        TerrainPage(unsigned short numTiles);
69
70        /** Destructor, will organise the deletion of pages
71        */
72        virtual ~TerrainPage();
73        /** After TerrainRenderables have been populated, this method
74            adds the neighbour links.
75        @remarks
76            Should be called before adding the page to the scene manager.
77        */
78        void linkNeighbours(void);
79
80        /** Returns the TerrainRenderable that contains the given pt.
81        If no tile exists at the point, it returns 0;
82        */
83        TerrainRenderable * getTerrainTile( const Vector3 & pt );
84
85                /** Sets the render queue group which the tiles should be rendered in. */
86                void setRenderQueue(uint8 qid);
87
88
89    };
90
91
92}
93
94#endif
Note: See TracBrowser for help on using the repository browser.