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

« back to all changes in this revision

Viewing changes to src/components/ogre/SceneManagers/EmberPagingSceneManager/include/OgrePagingLandScapeData2D.h

  • Committer: Package Import Robot
  • Author(s): Olek Wojnar, Stephen M. Webb, Olek Wojnar
  • Date: 2016-08-06 18:39:19 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20160806183919-4g72j3flj7xe2stj
Tags: 0.7.2+dfsg-1
[ Stephen M. Webb ]
* debian/control: updated build-depends to newer minimum versions
  (closes: #704786)
* debian/control: updated Standards-Version to 3.9.4 (updated VCS-* fields)
* debian/patches/0001-ember.in-test-expr.patch: removed (fixed upstream)
* debian/patches/0002-add-update_lua_bindings.patch: removed (fixed upstream)
* debian/patches/0003-add-atlas-pkg.patch: removed (fixed upstream)
* debian/patches/0004-domain-bindings-lua-makefile.patch: refreshed
* debian/patches/0005-ember.in-prefix.patch: removed (fixed upstream)
* debian/patches/0006-spellcheck-similiar.patch: removed (fixed upstream)
* debian/patches/0007-revert-libwfut-version.patch: refreshed
* debian/patches/0008-replace-fastdeletegate-with-sigc++.patch: removed
 (fixed upstream)
* debian/patches/0009-spelling-bach.patch: removed (fixed upstream)
* debian/patches/0010-fix-ember-script-args.patch: removed (fixed upstream)
* debian/patches/0011-qualify-template-functions.patch: removed (fixed
  upstream)
* debian/patches/0012-fix-osdir-headers.patch: removed (fixed upstream)
* debian/patches/0013-remove-invalid-linker-flags.patch: removed (fixed
  upstream)
* debian/patches/0014-add-missing-ogrelodstrategy.patch: new
* debian/control: fixed Vcs-Browser URL
* debian/patches/0015-verbose-configure-errors.patch: new
* debian/patches/0016-boost-1.53.patch: new
* debian/control: bump boost build dependeny to 1.53

[ Olek Wojnar ]
* New upstream release (Closes: #799748)
* Add myself as new uploader
  - Remove Stephen Webb per his request
  - Thanks for all the contributions, Stephen!
* d/patches/0007-revert-libwfut-version.patch: removed (unnecessary)
* d/control
  - Remove pre-dependency on dpkg
  - Update standards to 3.9.8 (no changes)
  - Update Vcs lines for secure URIs
* Import patch from the wfmath package to replace MersenneTwister.h
  -- Avoids problems from ambiguous copyright of the original file
* Update dependencies for version 0.7.2
* Enable all hardening options
* Add three lintian overrides
  -- Ignore install into usr/bin (binary)
  -- Ignore .rc files needed for WIN32 build (source)
  -- Ignore false positive of spelling error (binary)
* d/copyright: Update contributors and dates
* d/rules
  -- Do not remove "sounddefinitions" directory
  -- Enable parallel build
  -- Do not install into games directories
  -- Remove dh_builddeb override since xz is now the default
* d/watch: update file extensions
* Remove three patches, add eight patches, update remaining patches
  -- 0004-domain-bindings-lua-makefile.patch (implemented upstream)
  -- 0014-add-missing-ogrelodstrategy.patch (implemented upstream)
  -- 0016-boost-1.53.patch (patch target file removed upstream)
  -- 0018-enable-subdir-objects.patch (Fix automake 1.14 warnings)
  -- 0019-update-boost-m4.patch (Fix invalid boost_major_version)
  -- 0020-remove-obsolete-includes.patch (Fix obsolete includes)
  -- 0021-GraphicalChangeAdapter-fix-for-newer-compilers.patch (Added)
  -- 0022-fix-typos.patch (Fix typos identified by lintian)
  -- 0023-add-keywords-to-desktop-file.patch (Add Keywords to .desktop file)
  -- 0024-fix-icon-location (Make icon location Icon Theme Spec-compliant)
  -- 0025-fix-duplicate-script-install.patch (Was causing build failures)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
        OgrePagingLandScapeData2D.h  -  description
3
 
  -------------------
4
 
  begin                : Wen Mar 5 2003
5
 
  copyright            : (C) 2002-2006 by Jose A Milan & Tuan Kuranes
6
 
  email                : spoke@supercable.es & tuan.kuranes@free.fr
7
 
***************************************************************************/
8
 
 
9
 
/***************************************************************************
10
 
*                                                                         *
11
 
*   This program is free software; you can redistribute it and/or modify  *
12
 
*   it under the terms of the GNU Lesser General Public License as        *
13
 
*   published by the Free Software Foundation; either version 2 of the    *
14
 
*   License, or (at your option) any later version.                       *
15
 
*                                                                         *
16
 
***************************************************************************/
17
 
 
18
 
#ifndef PAGINGLandScapeDATA2D_H
19
 
#define PAGINGLandScapeDATA2D_H
20
 
 
21
 
#include "OgrePagingLandScapePrerequisites.h"
22
 
 
23
 
#include "OgrePagingLandScapeData2DManager.h"
24
 
#include "OgrePagingLandScapeOptions.h"
25
 
 
26
 
#include <boost/shared_array.hpp>
27
 
 
28
 
namespace Ogre
29
 
{
30
 
/**
31
 
 * Encapsulating 2D Data reading.
32
 
 */
33
 
class PagingLandScapeData2D
34
 
{
35
 
public:
36
 
        PagingLandScapeData2D(PagingLandScapeData2DManager* pageMgr);
37
 
 
38
 
        virtual ~PagingLandScapeData2D();
39
 
 
40
 
        virtual PagingLandScapeData2D* newPage() = 0;
41
 
 
42
 
        virtual Ogre::String getName() const = 0;
43
 
        virtual bool load(unsigned int mX, unsigned int mZ);
44
 
 
45
 
        virtual void load();
46
 
 
47
 
        virtual void init();
48
 
        virtual void uninit();
49
 
 
50
 
        virtual void unload();
51
 
 
52
 
#ifndef _MAPSPLITTER
53
 
        /**
54
 
         *    deform Height Data of the terrain.
55
 
         * \param &deformationPoint 
56
 
         *       Where modification is, in world coordinates
57
 
         * \param &modificationHeight 
58
 
         *        What modification do to terrain
59
 
         * \param info 
60
 
         *        Give some info on tile to 
61
 
         *       help coordinate system change
62
 
         */
63
 
        bool deformHeight(const Vector3& deformationPoint, Ogre::Real& modificationHeight);
64
 
 
65
 
        /**
66
 
         *
67
 
         *   deform Height Data of the terrain.
68
 
         * \param &x 
69
 
         *       x Position on 2d height grid
70
 
         * \param &z 
71
 
         *       z Position on 2d height grid
72
 
         * \param &modificationHeight 
73
 
         *        What modification do to terrain
74
 
         */
75
 
        bool deformHeight(unsigned int x, unsigned int z, Ogre::Real& modificationHeight);
76
 
 
77
 
 
78
 
        bool setHeight(unsigned int x, unsigned int z, const Ogre::Real& h);
79
 
        bool setHeight(unsigned int x, unsigned int z, unsigned int Pos, const Ogre::Real& h);
80
 
        /**
81
 
         *
82
 
         *    get smallest rectangle containing all deformation
83
 
         *   done before an update. (where rectangle is reseted.)
84
 
         * 
85
 
         * \return Box struct describing rectangle
86
 
         *        
87
 
         */
88
 
        const Image::Box& getDeformationRectangle() const;
89
 
 
90
 
        /**
91
 
         *
92
 
         *    Adjust smallest rectangle to make it contain the point
93
 
         * \param &x 
94
 
         *       x Position on 2d height grid
95
 
         * \param &z 
96
 
         *       z Position on 2d height grid
97
 
         */
98
 
        void adjustDeformationRectangle(unsigned int x, unsigned int z);
99
 
 
100
 
        /**
101
 
         *
102
 
         *    Reset Deformation rectangle
103
 
         */
104
 
        void resetDeformationRectangle();
105
 
#endif // _MAPSPLITTER
106
 
 
107
 
        virtual Ogre::Vector3 getNormal(const Ogre::Real& mX, const Ogre::Real& mZ) const;
108
 
 
109
 
        virtual Ogre::ColourValue getBase(const Ogre::Real& mX, const Ogre::Real& mZ) const 
110
 
        {
111
 
                return ColourValue::White;
112
 
        }
113
 
 
114
 
        virtual Ogre::ColourValue getCoverage(const Ogre::Real& mX, const Ogre::Real& mZ) const 
115
 
        {
116
 
                return ColourValue::White;
117
 
        }
118
 
 
119
 
        virtual Ogre::Real getShadow(const Ogre::Real& mX, const Ogre::Real& mZ, bool positive) const 
120
 
        {
121
 
                return 0.0f;
122
 
        }
123
 
 
124
 
        const Ogre::Real& getShiftX() const
125
 
        {   
126
 
                return mShiftX;
127
 
        }
128
 
 
129
 
        const Ogre::Real& getShiftZ() const
130
 
        {   
131
 
                return mShiftZ;
132
 
        }
133
 
 
134
 
        inline Ogre::Real getHeightAbsolute(const Ogre::Real& x, const Ogre::Real& z) const
135
 
        {   
136
 
                const Vector3& invScale = mParent->getOptions()->invScale;
137
 
 
138
 
                // adjust x and z to be local to page
139
 
                int i_x = static_cast<int> (x * invScale.x - mShiftX);
140
 
                int i_z = static_cast<int> (z * invScale.z - mShiftZ);
141
 
 
142
 
                // due to Real imprecision on Reals, we have to use boundaries here
143
 
                // otherwise we'll hit asserts.
144
 
                int size = static_cast<int> (mSize-1);
145
 
                if (i_x > size)
146
 
                        i_x = size; 
147
 
                else if (i_x < 0)
148
 
                        i_x = 0;
149
 
 
150
 
                if (i_z > size)
151
 
                        i_z = size;
152
 
                else if (i_z < 0)
153
 
                        i_z = 0;
154
 
 
155
 
                const unsigned int u_x = static_cast<unsigned int> (i_x);
156
 
                const unsigned int u_z = static_cast<unsigned int> (i_z);
157
 
 
158
 
                const size_t arraypos = u_z * mSize + u_x; 
159
 
                assert (mHeightData && arraypos < mMaxArrayPos);
160
 
                return mHeightData[arraypos];
161
 
        }
162
 
 
163
 
        inline Ogre::Real getHeight(const Ogre::Real& x, const Ogre::Real& z) const 
164
 
        {
165
 
                assert (z < mSize && x < mSize);
166
 
                assert (mHeightData);                
167
 
                const unsigned int Pos = static_cast< unsigned int > (z * mSize + x);
168
 
                assert (mMaxArrayPos > Pos);
169
 
                return mHeightData[ Pos ];    
170
 
        }
171
 
 
172
 
        inline Ogre::Real getHeight(unsigned int x, unsigned int z) const 
173
 
        {
174
 
                assert (mHeightData);
175
 
                assert (z < mSize && x < mSize);
176
 
                const unsigned int Pos = static_cast <unsigned int> (z * mSize + x);
177
 
                assert (mMaxArrayPos > Pos);
178
 
                return mHeightData[ Pos ];  
179
 
        }
180
 
 
181
 
        inline Ogre::Real getHeight(int x, int z) const 
182
 
        {
183
 
                assert (mHeightData);
184
 
                assert (static_cast< unsigned int >(z) < mSize && static_cast< unsigned int >(x) < mSize);
185
 
                const unsigned int Pos = static_cast< unsigned int >(z * mSize + x);
186
 
                assert (mMaxArrayPos > Pos);
187
 
                return mHeightData[ Pos ]; 
188
 
        }
189
 
 
190
 
        inline Ogre::Real getHeight(unsigned int pos) const 
191
 
        {
192
 
                assert (mHeightData);
193
 
                assert (mMaxArrayPos > pos);
194
 
                return mHeightData[ pos ]; 
195
 
        }
196
 
 
197
 
        inline Ogre::Real getMaxHeight() const 
198
 
        {
199
 
                return mMaxheight;
200
 
        }
201
 
 
202
 
        // useful to know max height before data is loaded.
203
 
        virtual Ogre::Real getMaxAbsoluteHeight() const = 0;
204
 
 
205
 
        Ogre::Real* getHeightData() const
206
 
        {
207
 
                return mHeightData;
208
 
        }
209
 
 
210
 
        bool isLoaded() const { return mIsLoaded; };
211
 
 
212
 
        void computePowerof2PlusOneSize();
213
 
            
214
 
        virtual size_t getXDimension() const 
215
 
        {
216
 
                return mXDimension;
217
 
        }
218
 
 
219
 
        virtual size_t getZDimension() const 
220
 
        {
221
 
                return mZDimension;
222
 
        }
223
 
 
224
 
        virtual size_t getSize() const 
225
 
        {
226
 
                return mSize;
227
 
        };
228
 
 
229
 
        void getCoordinates(unsigned int& X, unsigned int& Z) const 
230
 
        {
231
 
                X = mPageX;
232
 
                Z = mPageZ;
233
 
        }
234
 
 
235
 
        inline bool isCoord(unsigned int x, unsigned int z) const { return (mPageX == x && mPageZ == z); };
236
 
 
237
 
 
238
 
protected:
239
 
        virtual void _save() = 0;
240
 
        virtual bool _load(unsigned int x, unsigned int z) = 0;
241
 
        virtual void _load() = 0;
242
 
        virtual void _unload() = 0;
243
 
        bool _checkSize(size_t s);
244
 
 
245
 
        //  computed Height Data  (scaled)
246
 
        Real* mHeightData;
247
 
 
248
 
        /**
249
 
         * @brief A shared array pointer which holds the height data.
250
 
         *
251
 
         * This instance determines the lifetime of the data. As the data is handled asynchronously it's important that the data isn't destroyed unless there are no more references to it.
252
 
         */
253
 
        boost::shared_array<Ogre::Real> mHeightDataPtr;
254
 
 
255
 
        //  maximum position in Array
256
 
        unsigned int mMaxArrayPos;
257
 
        //  data side maximum size
258
 
        size_t mSize;
259
 
        //  data source width
260
 
        size_t mXDimension;;
261
 
        //  data source height
262
 
        size_t mZDimension;
263
 
        //  image data  maximum size
264
 
        unsigned int mMax;
265
 
        // maximum page/data2d height. (scaled)
266
 
        Real mMaxheight;
267
 
        // if data loaded or not
268
 
        bool mIsLoaded;   
269
 
 
270
 
        // if data modified or not
271
 
        bool mIsModified;  
272
 
        // if data modified but not yet
273
 
        // readied by other objects (texture or renderable)
274
 
        // to get modification to rect only once per frame.
275
 
        bool mIsRectModified;
276
 
 
277
 
        // page number
278
 
        unsigned int mPageX; 
279
 
        // page number
280
 
        unsigned int mPageZ;
281
 
 
282
 
        // coordinate shift based on page number
283
 
        Real mShiftX;
284
 
        // coordinate shift based on page number
285
 
        Real mShiftZ;
286
 
        PagingLandScapeData2DManager* mParent;
287
 
 
288
 
private:
289
 
        Image::Box mRect;
290
 
};
291
 
 
292
 
}
293
 
 
294
 
#endif