~ubuntu-branches/debian/sid/ember/sid

« back to all changes in this revision

Viewing changes to src/components/ogre/terrain/TerrainPageSurface.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2009-07-23 07:46:40 UTC
  • Revision ID: james.westby@ubuntu.com-20090723074640-wh0ukzis0kda36qv
Tags: upstream-0.5.6
ImportĀ upstreamĀ versionĀ 0.5.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// C++ Interface: TerrainPageSurface
 
3
//
 
4
// Description: 
 
5
//
 
6
//
 
7
// Author: Erik Hjortsberg <erik.hjortsberg@gmail.com>, (C) 2007
 
8
//
 
9
// This program is free software; you can redistribute it and/or modify
 
10
// it under the terms of the GNU General Public License as published by
 
11
// the Free Software Foundation; either version 2 of the License, or
 
12
// (at your option) any later version.
 
13
// 
 
14
// This program is distributed in the hope that it will be useful,
 
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
// GNU General Public License for more details.
 
18
// 
 
19
// You should have received a copy of the GNU General Public License
 
20
// along with this program; if not, write to the Free Software
 
21
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.//
 
22
//
 
23
#ifndef EMBEROGRETERRAINPAGESURFACE_H
 
24
#define EMBEROGRETERRAINPAGESURFACE_H
 
25
 
 
26
#include <list>
 
27
#include "../EmberOgrePrerequisites.h"
 
28
#include "../Types.h"
 
29
#include "TerrainPage.h"
 
30
 
 
31
namespace Mercator
 
32
{
 
33
class Shader;
 
34
class Surface;
 
35
class Segment;
 
36
}
 
37
 
 
38
namespace EmberOgre {
 
39
namespace Terrain {
 
40
 
 
41
class TerrainPageSurfaceLayer;
 
42
class TerrainPage;
 
43
class TerrainPageSurfaceCompiler;
 
44
class TerrainPageShadow;
 
45
class TerrainLayerDefinition;
 
46
 
 
47
/**
 
48
        @author Erik Hjortsberg <erik.hjortsberg@gmail.com>
 
49
*/
 
50
class TerrainPageSurface{
 
51
public:
 
52
        typedef std::map<int, TerrainPageSurfaceLayer*> TerrainPageSurfaceLayerStore;
 
53
    TerrainPageSurface(TerrainPage& terrainPage);
 
54
 
 
55
    virtual ~TerrainPageSurface();
 
56
    
 
57
    unsigned int getPixelWidth() const;
 
58
    
 
59
        /**
 
60
         *    The position of the page in Worldforge space
 
61
         * @return 
 
62
         */
 
63
        const TerrainPosition& getWFPosition() const;
 
64
        
 
65
        SegmentVector& getValidSegments();
 
66
        
 
67
        /**
 
68
         *    The number of Mercator::Segments for each axis. I.e. the root of the total number of segments.
 
69
         * @return 
 
70
         */
 
71
        int getNumberOfSegmentsPerAxis() const; 
 
72
        
 
73
        TerrainPageSurfaceLayer* createSurfaceLayer(const TerrainLayerDefinition& definition, int surfaceIndex, Mercator::Shader* shader);
 
74
        
 
75
        Ogre::MaterialPtr getMaterial();
 
76
        
 
77
        /**
 
78
         * @brief Recompiles the material.
 
79
         * @param reselectTechnique If true, we'll also see if we need to reselect the technique to use.
 
80
         */
 
81
        void recompileMaterial(bool reselectTechnique);
 
82
        
 
83
        void setShadow(TerrainPageShadow* shadow);
 
84
        
 
85
        const TerrainPageSurfaceLayerStore& getLayers() const;
 
86
        
 
87
        TerrainPageSurfaceLayer* updateLayer(int layerIndex, bool repopulate);
 
88
        
 
89
protected:
 
90
 
 
91
        void updateSceneManagersAfterMaterialsChange();
 
92
 
 
93
        Ogre::MaterialPtr mMaterial;
 
94
        TerrainPage& mTerrainPage;
 
95
        TerrainPageSurfaceLayerStore mLayers;
 
96
        std::auto_ptr<TerrainPageSurfaceCompiler> mSurfaceCompiler;
 
97
        TerrainPageShadow* mShadow;
 
98
};
 
99
 
 
100
}
 
101
}
 
102
#endif