1
0
forked from 0ad/0ad

Modified to use CBound class.

This was SVN commit r101.
This commit is contained in:
notpete 2003-11-25 20:09:57 +00:00
parent 49e484d32c
commit 874df3bb1c
2 changed files with 5 additions and 20 deletions

View File

@ -27,27 +27,13 @@ void CPatch::Initialize (STerrainVertex *first_vertex)
{
m_pVertices = first_vertex;
m_Bounds.m_BoxMin.X = m_pVertices[0].m_Position.X;
m_Bounds.m_BoxMin.Z = m_pVertices[0].m_Position.Z;
m_Bounds.m_BoxMax.X = m_Bounds.m_BoxMin.X + PATCH_SIZE*CELL_SIZE;
m_Bounds.m_BoxMax.Z = m_Bounds.m_BoxMin.Z + PATCH_SIZE*CELL_SIZE;
m_Bounds.SetEmpty();
m_Bounds.m_BoxMin.Y = m_Bounds.m_BoxMin.Y = m_pVertices[0].m_Position.Y;
int j;
for (j=0; j<PATCH_SIZE+1; j++)
for (int j=0; j<PATCH_SIZE+1; j++)
{
for (int i=0; i<PATCH_SIZE+1; i++)
{
int pos = j*MAP_SIZE + i;
if (m_pVertices[pos].m_Position.Y < m_Bounds.m_BoxMin.Y)
m_Bounds.m_BoxMin.Y = m_pVertices[pos].m_Position.Y;
if (m_pVertices[pos].m_Position.Y > m_Bounds.m_BoxMax.Y)
m_Bounds.m_BoxMax.Y = m_pVertices[pos].m_Position.Y;
m_Bounds+=m_pVertices[j*MAP_SIZE + i].m_Position;
}
}

View File

@ -12,8 +12,7 @@
#ifndef PATCH_H
#define PATCH_H
#include "Matrix3D.h"
#include "Camera.h"
#include "Bound.h"
#include "TerrGlobals.h"
#include "MiniPatch.h"
@ -29,7 +28,7 @@ class CPatch
// protected:
CMiniPatch m_MiniPatches[16][16];
SBoundingBox m_Bounds;
CBound m_Bounds;
unsigned int m_LastVisFrame;
STerrainVertex *m_pVertices;