source: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTerrainPage.h @ 1273

Revision 1273, 3.4 KB checked in by szydlowski, 18 years ago (diff)

Added the KdTerrainSceneManager?, a subclass of the KdTreeSceneManager? capable of rendering terrain like the TerrainSceneManager? from Ogre.
All the *Kd*Terrain* classes are identical to their octree counterparts, save prefixing all classes and structures with Kd to avoid namespace clashes.
This was necessary, since the TerrainSceneManager? was hard coded in these classes, and all references had to be replaced with the KdTerrainSceneManager?.
Also added a comprehensive README for the demo application.

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 "OgreKdTerrainPrerequisites.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 _OgreKdTerrainExport KdTerrainPage
48    {
49    public:
50        typedef std::vector < KdTerrainRenderable * > KdTerrainRow;
51        typedef std::vector < KdTerrainRow > KdTerrain2D;
52       
53        /// 2-dimensional vector of tiles, pre-allocated to the correct size
54        KdTerrain2D 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        KdTerrainPage(unsigned short numTiles);
65
66        /** Destructor, will organise the deletion of pages
67        */
68        virtual ~KdTerrainPage();
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        KdTerrainRenderable * 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.