Adapt for web

This commit is contained in:
Vladislav Khorev committed 2026-02-27 22:31:07 +03:00
1 parent 7418bbbe27
commit 9f82e7a2e6
14 files changed
+189 -40

No files matched your search

+1 -9
View File
@@ -616,13 +616,11 @@ namespace ZL
}
void Space::drawRemoteShips() {
// И�пользуем те же кон�танты имен дл� шейдеров, что и в drawShip
static const std::string defaultShaderName = "default";
static const std::string vPositionName = "vPosition";
static const std::string vTexCoordName = "vTexCoord";
static const std::string textureUniformName = "Texture";
// �ктивируем шейдер и тек�туру (предполагаем, что меш у в�ех одинаковый)
renderer.shaderManager.PushShader(defaultShaderName);
renderer.RenderUniform1i(textureUniformName, 0);
@@ -633,10 +631,6 @@ namespace ZL
static_cast<float>(Environment::width) / static_cast<float>(Environment::height),
Environment::CONST_Z_NEAR, Environment::CONST_Z_FAR);
// Биндим текÑ�туру кораблÑ� один раз длÑ� Ð?Ñ�ех правильных игроков
// ?????????: ?????? ???????? ?????????? ?????? ????? ? ??????????? ?? ClientState.shipType
// Е�ли �ервер при�лал коробки, примен�ем их однократно вме�то локальной генерации
if (!serverBoxesApplied && networkClient) {
auto sboxes = networkClient->getServerBoxes();
auto destroyedFlags = networkClient->getServerBoxDestroyedFlags();
@@ -664,7 +658,6 @@ namespace ZL
}
}
// Итерируем�� по актуальным данным из extrapolateRemotePlayers
for (auto const& [id, remotePlayer] : remotePlayerStates) {
const ClientState& playerState = remotePlayer;
@@ -674,7 +667,7 @@ namespace ZL
renderer.LoadIdentity();
renderer.TranslateMatrix({ 0,0, -1.0f * Environment::zoom });
renderer.TranslateMatrix({ 0, -6.f, 0 }); //Ship camera offset
//renderer.TranslateMatrix({ 0, -6.f, 0 }); //Ship camera offset
renderer.RotateMatrix(Environment::inverseShipMatrix);
renderer.TranslateMatrix(-Environment::shipState.position);
@@ -682,7 +675,6 @@ namespace ZL
Eigen::Vector3f relativePos = playerState.position;// -Environment::shipPosition;
renderer.TranslateMatrix(relativePos);
// 3. Поворот врага
renderer.RotateMatrix(playerState.rotation);
if (playerState.shipType == 1 && cargoTexture) {