source: GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainPage.h @ 1812

Revision 1812, 3.4 KB checked in by gumbau, 18 years ago (diff)
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-2005 The OGRE Team
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-----------------------------------------------------------------------------
24*/
25#ifndef __TerrainPage_H__
26#define __TerrainPage_H__
27
28#include "OgreTerrainPrerequisites.h"
29#include "OgreRenderQueue.h"
30
31namespace Ogre {
32
33    /** Groups a number of TerrainRenderables (tiles) into a page, which is
34        the unit of loading / unloading.
35    @remarks
36        Note that this class, whilst holding onto TerrainRenderable instances,
37        does not actually process or initialise them itself - this is
38        intentional so the TerrainPageSource which is providing the tiles
39        is able to load and prepare each renderable incrementally if required,
40        thus avoiding any 'single hit' load methods for the page.
41    @par
42        All this class does do is pre-create a 2D vector of 'slots' in which
43        to place the TerrainRenderable pointers, which it does on
44        construction. Note that this structure is public to allow completely
45        free access to users of this class.
46    */
47    class _OgreTerrainExport TerrainPage
48    {
49    public:
50        typedef std::vector < TerrainRenderable * > TerrainRow;
51        typedef std::vector < TerrainRow > Terrain2D;
52       
53        /// 2-dimensional vector of tiles, pre-allocated to the correct size
54        Terrain2D tiles;
55        /// The number of tiles across a page
56        unsigned short tilesPerPage;
57        /// The scene node to which all the tiles for this page are attached
58        SceneNode* pageSceneNode;
59
60        /** The main constructor.
61        @param numTiles The number of terrain tiles (TerrainRenderable)
62            across (and down) a page
63        */
64        TerrainPage(unsigned short numTiles);
65
66        /** Destructor, will organise the deletion of pages
67        */
68        virtual ~TerrainPage();
69        /** After TerrainRenderables have been populated, this method
70            adds the neighbour links.
71        @remarks
72            Should be called before adding the page to the scene manager.
73        */
74        void linkNeighbours(void);
75
76        /** Returns the TerrainRenderable that contains the given pt.
77        If no tile exists at the point, it returns 0;
78        */
79        TerrainRenderable * getTerrainTile( const Vector3 & pt );
80
81                /** Sets the render queue group which the tiles should be rendered in. */
82                void setRenderQueue(uint8 qid);
83
84
85    };
86
87
88}
89
90#endif
Note: See TracBrowser for help on using the repository browser.