mirror of https://github.com/axmolengine/axmol.git
update
This commit is contained in:
parent
0eaf9b5acc
commit
60115b1ce1
|
@ -159,9 +159,9 @@ void Terrain::onDraw(const Mat4 &transform, uint32_t flags)
|
|||
|
||||
if(_isCameraViewChanged )
|
||||
{
|
||||
auto camPos = camera->getPosition3D();
|
||||
auto m = camera->getWorldToNodeTransform();
|
||||
//set lod
|
||||
setChunksLOD(camPos);
|
||||
setChunksLOD(Vec3(m.m[12], m.m[13], m.m[14]));
|
||||
}
|
||||
|
||||
if(_isCameraViewChanged )
|
||||
|
@ -263,8 +263,7 @@ void Terrain::setChunksLOD(Vec3 cameraPos)
|
|||
{
|
||||
AABB aabb = _chunkesArray[m][n]->_parent->_worldSpaceAABB;
|
||||
auto center = aabb.getCenter();
|
||||
center.y = 0;
|
||||
float dist = Vec3(center.x,0,center.z).distance(Vec3(cameraPos.x,0,cameraPos.z));
|
||||
float dist = Vec2(center.x, center.z).distance(Vec2(cameraPos.x, cameraPos.z));
|
||||
_chunkesArray[m][n]->_currentLod = 3;
|
||||
for(int i =0;i<3;i++)
|
||||
{
|
||||
|
@ -1226,7 +1225,7 @@ void Terrain::Chunk::calculateAABB()
|
|||
std::vector<Vec3>pos;
|
||||
for(int i =0;i<_originalVertices.size();i++)
|
||||
{
|
||||
pos.push_back(originalVertices[i]._position);
|
||||
pos.push_back(_originalVertices[i]._position);
|
||||
}
|
||||
_aabb.updateMinMax(&pos[0],pos.size());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue