Cleanup dans optimization renderer.

This commit is contained in:
MarcEricMartel 2021-12-03 11:51:59 -05:00
parent ecddc82e7b
commit 3d94b3a564

View File

@ -272,7 +272,6 @@ void World::RenderWorld(int& rendercount, int& badhitcount, Player& player, Tran
direct.y = 0; direct.y = 0;
direct.Normalize(); direct.Normalize();
pos.y = 1; pos.y = 1;
//renderManifest.clear();
static Vector3i renderManifest[VIEW_DISTANCE * 4]; static Vector3i renderManifest[VIEW_DISTANCE * 4];
@ -302,38 +301,22 @@ void World::RenderWorld(int& rendercount, int& badhitcount, Player& player, Tran
cosinus = .99939082701; cosinus = .99939082701;
echantillons = 45; echantillons = 45;
} }
else /*if (dist > VIEW_DISTANCE * .75f)*/ { else {
angle.x = direct.z + direct.x; angle.x = direct.z + direct.x;
angle.z = direct.z - direct.x; angle.z = direct.z - direct.x;
sinus = .05233595624; sinus = .05233595624;
cosinus = .99862953475; cosinus = .99862953475;
echantillons = 30; echantillons = 30;
} }
//else if (dist > VIEW_DISTANCE * .875f) { // - CHUNK_SIZE_X * 28) {
// angle.x = direct.z;
// angle.z = -direct.x;
// sinus = .08715574274;
// cosinus = .996194698091;
// echantillons = 36;
// //echantillons = 0;
//}
//else {
// angle.x = direct.z;
// angle.z = -direct.x;
// sinus = .13052619222;
// cosinus = .99144486137;
// echantillons = 24;
//}
angle.y = 0; angle.y = 0;
angle.Normalize(); angle.Normalize();
for (int radar = 0; radar < echantillons; ++radar) { for (int radar = 0; radar < echantillons; ++radar) {
float x = angle.x; float x = angle.x;
float z = angle.z;
angle.x = x * cosinus - z * sinus; angle.x = angle.x * cosinus - angle.z * sinus;
angle.z = z * cosinus + x * sinus; angle.z = angle.z * cosinus + x * sinus;
angle.Normalize(); angle.Normalize();
cursor = pos - direct * CHUNK_SIZE_X * 2 + angle * dist; cursor = pos - direct * CHUNK_SIZE_X * 2 + angle * dist;
@ -359,7 +342,6 @@ void World::RenderWorld(int& rendercount, int& badhitcount, Player& player, Tran
ChunkAt(cursor)->Render(); ChunkAt(cursor)->Render();
world.ApplyTranslation(-(chx - m_center[0]) * CHUNK_SIZE_X, 0, -(chy - m_center[1]) * CHUNK_SIZE_Z); world.ApplyTranslation(-(chx - m_center[0]) * CHUNK_SIZE_X, 0, -(chy - m_center[1]) * CHUNK_SIZE_Z);
renderManifest[++rendercount] = Vector3i(chx, 0, chy); renderManifest[++rendercount] = Vector3i(chx, 0, chy);
//++rendercount;
} }
} }
} }