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

« back to all changes in this revision

Viewing changes to src/components/ogre/SceneManagers/EmberPagingSceneManager/src/OgrePagingLandScapeTextureCoordMan.cpp

  • 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
 
OgrePagingLandScapeTextureCoordinatesManager.cpp  -  description
3
 
-------------------
4
 
begin                : Mon Jun 16 2003
5
 
copyright            : (C) 2003-2006 by Jose A Milan && Tuan Kuranes
6
 
email                : spoke2@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 published by  *
13
 
*   the Free Software Foundation; either version 2 of the License, or     *
14
 
*   (at your option) any later version.                                   *
15
 
*                                                                         *
16
 
***************************************************************************/
17
 
 
18
 
#include "OgrePagingLandScapePrecompiledHeaders.h"
19
 
 
20
 
#include "OgrePagingLandScapeSceneManager.h"
21
 
#include "OgrePagingLandScapeOptions.h"
22
 
#include "OgrePagingLandScapeTextureCoordMan.h"
23
 
 
24
 
namespace Ogre
25
 
{
26
 
        //-----------------------------------------------------------------------
27
 
        PagingLandScapeTextureCoordinatesManager::PagingLandScapeTextureCoordinatesManager(PagingLandScapeSceneManager * scnMgr) :      
28
 
                mPageSize (0),
29
 
        mTileSize (0),
30
 
                mOptions (scnMgr->getOptions())
31
 
        {
32
 
        }
33
 
        //-----------------------------------------------------------------------
34
 
        PagingLandScapeTextureCoordinatesManager::~PagingLandScapeTextureCoordinatesManager()
35
 
        {
36
 
                clear();
37
 
        }
38
 
        //-----------------------------------------------------------------------
39
 
        void PagingLandScapeTextureCoordinatesManager::clear()
40
 
        {
41
 
                // Unload the Tiles
42
 
                if (!mTexBuffs.empty())
43
 
                {
44
 
                        HardwareTextureBuffersCol::iterator iend = mTexBuffs.end();
45
 
                        for (HardwareTextureBuffersCol::iterator i = mTexBuffs.begin(); 
46
 
                                i != iend; 
47
 
                                ++i)
48
 
                        {
49
 
                                //         std::for_each(i->begin (), 
50
 
                                //                        i->end (),  
51
 
                                //                        delete_object());
52
 
 
53
 
                                i->clear();   
54
 
                        } 
55
 
                        mTexBuffs.clear();    
56
 
                }
57
 
        }
58
 
        //-----------------------------------------------------------------------
59
 
        void PagingLandScapeTextureCoordinatesManager::load()
60
 
        {
61
 
                const unsigned int pSize = mOptions->PageSize;
62
 
                const unsigned int tSize = mOptions->TileSize;
63
 
                if (mPageSize != pSize || 
64
 
                        mTileSize != tSize)
65
 
                {     
66
 
                        clear();
67
 
 
68
 
                        mPageSize = pSize;
69
 
                        mTileSize = tSize;
70
 
                        const unsigned int NumTiles = mOptions->NumTiles;
71
 
 
72
 
                        mTexBuffs.reserve (NumTiles);
73
 
                        mTexBuffs.resize (NumTiles);
74
 
                        for (unsigned int  i = 0; i < NumTiles; ++i)
75
 
                        {
76
 
                                mTexBuffs[i].reserve (NumTiles);
77
 
                                mTexBuffs[i].resize (NumTiles);
78
 
                        }
79
 
                }
80
 
        }
81
 
        //-----------------------------------------------------------------------
82
 
        HardwareVertexBufferSharedPtr PagingLandScapeTextureCoordinatesManager::getBuffer(
83
 
                const unsigned int tilex, 
84
 
                const unsigned int tilez)
85
 
        {
86
 
                assert (tilex < mOptions->NumTiles && 
87
 
                                tilez < mOptions->NumTiles);
88
 
 
89
 
                if (mTexBuffs [tilex][tilez].isNull ())
90
 
                {
91
 
                        const unsigned int tileSize = mOptions->TileSize;
92
 
 
93
 
                        const VertexElementType t = VET_FLOAT2;
94
 
                        //const VertexElementType t = VET_SHORT2;
95
 
                        const size_t vertexSize = VertexElement::getTypeSize (t);
96
 
                        HardwareVertexBufferSharedPtr vbuf = 
97
 
                                HardwareBufferManager::getSingleton ().createVertexBuffer(
98
 
                                                                                                                vertexSize, 
99
 
                                                                                                                tileSize * tileSize,
100
 
                                                                                                                HardwareBuffer::HBU_STATIC_WRITE_ONLY);
101
 
 
102
 
                        float* pTex = static_cast<float*> (vbuf->lock(HardwareBuffer::HBL_DISCARD));
103
 
                        //ushort* pSecond = static_cast<ushort*> (vbuf->lock(HardwareBuffer::HBL_DISCARD));
104
 
 
105
 
                        // Calculate the offset in the texture position
106
 
                        const unsigned int offSetX = tilex * (tileSize - 1);
107
 
                        const unsigned int offSetZ = tilez * (tileSize - 1);
108
 
                        const unsigned int endx = offSetX + tileSize;
109
 
                        const unsigned int endz = offSetZ + tileSize;
110
 
 
111
 
                        const Real Aux1 =  1.0 / (mOptions->PageSize - 1);
112
 
                        Real K_Tex2DataPos = offSetZ * Aux1;
113
 
                        for (unsigned int k = offSetZ; k < endz; k ++)
114
 
                        {
115
 
                                Real K_Tex1DataPos = offSetX * Aux1;
116
 
                                for (unsigned int i = offSetX; i < endx; i ++)
117
 
                                {
118
 
                                        // textures
119
 
                                        //assert (K_Tex1DataPos >= 0.0f && K_Tex1DataPos <= 1.0f);
120
 
                                        //assert (K_Tex2DataPos >= 0.0f && K_Tex2DataPos <= 1.0f);
121
 
                                        if (K_Tex1DataPos > 1.0f) K_Tex1DataPos = 1.0f;
122
 
                                        if (K_Tex2DataPos > 1.0f) K_Tex2DataPos = 1.0f;
123
 
                                        *pTex++ = K_Tex1DataPos;        
124
 
                                        *pTex++ = K_Tex2DataPos;
125
 
 
126
 
                                        //            *pTex++ = static_cast<ushort> (K_Tex1DataPos * 65535);
127
 
                                        //            *pTex++ = static_cast<ushort> (K_Tex2DataPos * 65535);
128
 
 
129
 
                                        K_Tex1DataPos += Aux1;
130
 
                                }
131
 
                                K_Tex2DataPos += Aux1;
132
 
                        }
133
 
                        vbuf->unlock();         
134
 
                        mTexBuffs [tilex][tilez] = vbuf;
135
 
                }
136
 
                return mTexBuffs [tilex][tilez];
137
 
        }
138
 
} //namespace