Nerfage pour version Debug/MSVC
This commit is contained in:
		| @@ -99,7 +99,6 @@ void World::CleanUpWorld(int& deleteframes, bool clear = false) { | ||||
| 		m_tbDeleted.pop_back(); | ||||
| 		deleteframes = FRAMES_DELETE_CHUNKS; | ||||
| 	} | ||||
| 	std::cout << "Chunk Write Buffer: " << m_tbDeleted.size() << std::endl; | ||||
| } | ||||
|  | ||||
| void World::GetScope(int& x, int& y) { | ||||
| @@ -124,7 +123,7 @@ bool World::GenerateChunk(int chx, int chy, Perlin& perlin) { | ||||
| 			for (int index = 0; index < m_tbDeleted.size(); ++index) { // V<>rifie l'existence d'un chunk dans le buffer de suppression avec sa position. | ||||
| 				int x, y; | ||||
|  | ||||
| 				if (&m_tbDeleted.at(index)) { | ||||
| 				if (m_tbDeleted.at(index)) { | ||||
| 					m_tbDeleted.at(index)->GetPosition(x, y); | ||||
| 					if (chx / CHUNK_SIZE_X + m_center[0] == x && | ||||
| 						chy / CHUNK_SIZE_Z + m_center[1] == y) { | ||||
| @@ -143,7 +142,7 @@ bool World::GenerateChunk(int chx, int chy, Perlin& perlin) { | ||||
| 				GetChunks().Set(chx / CHUNK_SIZE_X, chy / CHUNK_SIZE_Z, new Chunk(chx / CHUNK_SIZE_X + m_center[0], chy / CHUNK_SIZE_Z + m_center[1])); | ||||
| 				Chunk* chunk = GetChunks().Get(chx / CHUNK_SIZE_X, chy / CHUNK_SIZE_Z); | ||||
|  | ||||
| 				for (int x = 0; x < CHUNK_SIZE_X; ++x) | ||||
| 				for (int x = 0; x < CHUNK_SIZE_X; ++x) // Montagnes | ||||
| 					for (int z = 0; z < CHUNK_SIZE_Z; ++z) { | ||||
| 						float xnoiz, ynoiz; | ||||
| 						xnoiz = (double)(x + (chx / CHUNK_SIZE_X + m_center[0]) * CHUNK_SIZE_X) / (double)INT16_MAX; | ||||
| @@ -153,26 +152,44 @@ bool World::GenerateChunk(int chx, int chy, Perlin& perlin) { | ||||
| 							chunk->SetBlock(x, y, z, BTYPE_METAL, this); | ||||
| 					} | ||||
|  | ||||
| 				for (int x = 0; x < CHUNK_SIZE_X; ++x) | ||||
| 				for (int x = 0; x < CHUNK_SIZE_X; ++x) // Collines | ||||
| 					for (int z = 0; z < CHUNK_SIZE_Z; ++z) { | ||||
| 						float xnoiz, ynoiz; | ||||
| 						xnoiz = (double)(x + (chx / CHUNK_SIZE_X + m_center[0]) * CHUNK_SIZE_X) / (double)INT16_MAX; | ||||
| 						ynoiz = (double)(z + (chy / CHUNK_SIZE_Z + m_center[1]) * CHUNK_SIZE_Z) / (double)INT16_MAX; | ||||
| 						float height = perlin.Get(xnoiz, ynoiz) * 5.f + 16.f; | ||||
| 						float height = perlin.Get(xnoiz, ynoiz) * 5.f + 24.f; | ||||
| 						for (int y = 0; y <= (int)height % CHUNK_SIZE_Y; ++y) { | ||||
| 							if (chunk->GetBlock(x, y, z) == BTYPE_AIR) | ||||
| 								chunk->SetBlock(x, y, z, BTYPE_GRASS, this); | ||||
| 						} | ||||
| 					} | ||||
|  | ||||
| 				for (int x = 0; x < CHUNK_SIZE_X; ++x) | ||||
| 				for (int x = 0; x < CHUNK_SIZE_X; ++x) // "Lacs" | ||||
| 					for (int z = 0; z < CHUNK_SIZE_Z; ++z) { | ||||
| 						for (int y = 0; y < 15; ++y) { | ||||
| 						for (int y = 0; y < 12; ++y) { | ||||
| 							if (chunk->GetBlock(x, y, z) == BTYPE_AIR) | ||||
| 								chunk->SetBlock(x, y, z, BTYPE_ICE, this); | ||||
| 						} | ||||
| 					} | ||||
|  | ||||
| 				for (int x = 0; x < CHUNK_SIZE_X; ++x) // "Arbres" | ||||
| 					for (int z = 0; z < CHUNK_SIZE_Z; ++z) { | ||||
| 						float xnoiz, ynoiz; | ||||
| 						xnoiz = (double)(z * CHUNK_SIZE_Y + (chx / CHUNK_SIZE_X + m_center[0]) * CHUNK_SIZE_X) / (double)INT16_MAX; | ||||
| 						ynoiz = (double)(x * CHUNK_SIZE_Y + (chy / CHUNK_SIZE_Z + m_center[1]) * CHUNK_SIZE_Z) / (double)INT16_MAX; | ||||
| 						bool tree = (int)(abs(perlin.Get(xnoiz, ynoiz)) * 17933.f) % CHUNK_SIZE_Y > 126 ? true: false; | ||||
| 						 | ||||
| 						for (int y = 0; y < CHUNK_SIZE_Y - 10; ++y)  | ||||
| 							if (chunk->GetBlock(x, y, z) == BTYPE_AIR)  | ||||
| 								if (chunk->GetBlock(x, y - 1, z) == BTYPE_GRASS) | ||||
| 									if (tree) { | ||||
| 										for (int i = 0; i < (int)(abs(perlin.Get(xnoiz, ynoiz))) % 3 + 1; ++i) | ||||
| 											chunk->SetBlock(x, y + i, z, BTYPE_DIRT, this); | ||||
| 										break; | ||||
| 									} | ||||
| 									 | ||||
| 					} | ||||
|  | ||||
| 			} | ||||
| 			else { | ||||
| 				input.seekg(0, std::ios_base::end); | ||||
| @@ -274,31 +291,28 @@ void World::RenderWorld(int& rendercount, int& badhitcount, Player& player, Tran | ||||
|  | ||||
| 	static Vector3f renderManifest[VIEW_DISTANCE * 4]; | ||||
|  | ||||
| 	for (int dist = VIEW_DISTANCE; dist >= 0; dist -= CHUNK_SIZE_X) { | ||||
| 	//for (int dist = VIEW_DISTANCE; dist >= 0; dist -= CHUNK_SIZE_X) { | ||||
| 	for (int dist = 0; dist <= VIEW_DISTANCE; dist += CHUNK_SIZE_X) { | ||||
| 		// Configuration du radar. | ||||
| 		float sinus, cosinus; | ||||
| 		int echantillons; | ||||
|  | ||||
|  | ||||
| 		if (dist > VIEW_DISTANCE * .625f) {  | ||||
| 			sinus = .01745240643; // sin(1 degr<67>) | ||||
| 			cosinus = .99984769515; // cos(1 degr<67>) | ||||
| 			echantillons = 90; | ||||
| 		} | ||||
| 		else if (dist > VIEW_DISTANCE * .5f) { | ||||
| 		else if (dist > VIEW_DISTANCE * .325f) { | ||||
| 			sinus = .0261769483; | ||||
| 			cosinus = .99965732497; | ||||
| 			echantillons = 60; | ||||
| 		} | ||||
| 		else if (dist > VIEW_DISTANCE * .375f) { | ||||
| 		else { | ||||
| 			sinus = .0348994967; | ||||
| 			cosinus = .99939082701; | ||||
| 			echantillons = 45; | ||||
| 		} | ||||
| 		else {  | ||||
| 			sinus = .05233595624; | ||||
| 			cosinus = .99862953475; | ||||
| 			echantillons = 30; | ||||
| 		} | ||||
|  | ||||
| 		angle.x = direct.z + direct.x; | ||||
| 		angle.z = direct.z - direct.x; | ||||
| @@ -326,8 +340,7 @@ void World::RenderWorld(int& rendercount, int& badhitcount, Player& player, Tran | ||||
| 						++badhitcount; | ||||
| 					} | ||||
|  | ||||
| 				float ray = (pos - cursor).Length(); | ||||
| 				if (valide) renderManifest[rendercount++] = Vector3f(chx, (VIEW_DISTANCE - ray * 2 + 128) / (float)VIEW_DISTANCE, chy); | ||||
| 				if (valide) renderManifest[rendercount++] = Vector3f(chx, (VIEW_DISTANCE - (pos - cursor).Length() * 2.f + 128) / (float)VIEW_DISTANCE, chy); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| @@ -336,7 +349,7 @@ void World::RenderWorld(int& rendercount, int& badhitcount, Player& player, Tran | ||||
|  | ||||
| 		world.ApplyTranslation(chx, 0, chy); | ||||
| 		world.Use(); | ||||
| 		glBlendColor(0.f, 0.f, 0.f, renderManifest[index].y); | ||||
| 		glBlendColor(renderManifest[index].y, renderManifest[index].y, renderManifest[index].y, 1.f); | ||||
| 		ChunkAt(chx, 1, chy)->Render(); | ||||
| 		world.ApplyTranslation(-chx, 0, -chy); | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user