4
4
(Object-oriented Graphics Rendering Engine)
5
5
For the latest info, see http://www.ogre3d.org/
7
Copyright (c) 2000-2006 Torus Knot Software Ltd
8
Also see acknowledgements in Readme.html
10
This program is free software; you can redistribute it and/or modify it under
11
the terms of the GNU Lesser General Public License as published by the Free Software
12
Foundation; either version 2 of the License, or (at your option) any later
15
This program is distributed in the hope that it will be useful, but WITHOUT
16
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
19
You should have received a copy of the GNU Lesser General Public License along with
20
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21
Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22
http://www.gnu.org/copyleft/lesser.txt.
24
You may alternatively use this source under the terms of a specific version of
25
the OGRE Unrestricted License provided you have obtained such a license from
26
Torus Knot Software Ltd.
7
Copyright (c) 2000-2009 Torus Knot Software Ltd
9
Permission is hereby granted, free of charge, to any person obtaining a copy
10
of this software and associated documentation files (the "Software"), to deal
11
in the Software without restriction, including without limitation the rights
12
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
copies of the Software, and to permit persons to whom the Software is
14
furnished to do so, subject to the following conditions:
16
The above copyright notice and this permission notice shall be included in
17
all copies or substantial portions of the Software.
19
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
26
-----------------------------------------------------------------------------
28
27
TerrainZoneRenderable.cpp - based on OgreTerrainZoneRenderable.cpp from Ogre3d
486
485
mDeltaBuffers[level - 1]->lock(HardwareBuffer::HBL_NORMAL));
489
for ( j = 0; j < mOptions->tileSize - step; j += step )
488
for ( j = 0; j < (int) mOptions->tileSize - step; j += step )
491
for ( i = 0; i < mOptions->tileSize - step; i += step )
490
for ( i = 0; i < (int) mOptions->tileSize - step; i += step )
493
492
/* Form planes relating to the lower detail tris to be produced
494
493
For tri lists and even tri strip rows, they are this shape:
523
522
// include the bottommost row of vertices if this is the last row
524
int zubound = (j == (mOptions->tileSize - step)? step : step - 1);
523
int zubound = (j == ((int) mOptions->tileSize - step)? step : step - 1);
525
524
for ( int z = 0; z <= zubound; z++ )
527
526
// include the rightmost col of vertices if this is the last col
528
int xubound = (i == (mOptions->tileSize - step)? step : step - 1);
527
int xubound = (i == ((int) mOptions->tileSize - step)? step : step - 1);
529
528
for ( int x = 0; x <= xubound; x++ )
531
int fulldetailx = i + x;
532
int fulldetailz = j + z;
530
unsigned int fulldetailx = i + x;
531
unsigned int fulldetailz = j + z;
533
532
if ( fulldetailx % step == 0 &&
534
533
fulldetailz % step == 0 )
731
730
float x_pt = x_pct * ( float ) ( mOptions->tileSize - 1 );
732
731
float z_pt = z_pct * ( float ) ( mOptions->tileSize - 1 );
734
int x_index = ( int ) x_pt;
735
int z_index = ( int ) z_pt;
733
unsigned int x_index = ( int ) x_pt;
734
unsigned int z_index = ( int ) z_pt;
737
736
// If we got to the far right / bottom edge, move one back
738
737
if (x_index == mOptions->tileSize - 1)
1002
1001
IndexData* TerrainZoneRenderable::generateTriStripIndexes(unsigned int stitchFlags)
1004
1003
// The step used for the current level
1005
int step = 1 << mRenderLevel;
1004
unsigned int step = 1 << mRenderLevel;
1006
1005
// The step used for the lower level
1007
int lowstep = 1 << (mRenderLevel + 1);
1006
unsigned int lowstep = 1 << (mRenderLevel + 1);
1009
1008
int numIndexes = 0;
1222
1221
HardwareBuffer::HBL_DISCARD));
1224
1223
// Do the core vertices, minus stitches
1225
for ( int j = north; j < mOptions->tileSize - 1 - south; j += step )
1224
for ( unsigned int j = north; j < mOptions->tileSize - 1 - south; j += step )
1227
for ( int i = west; i < mOptions->tileSize - 1 - east; i += step )
1226
for ( unsigned int i = west; i < mOptions->tileSize - 1 - east; i += step )
1230
1229
*pIdx++ = _index( i, j + step ); numIndexes++; // original order: 2