Fixed low quality
This commit is contained in:
parent
70ef730e86
commit
b0b7391939
@ -230,6 +230,10 @@ namespace ZL
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Game::drawScene() {
|
void Game::drawScene() {
|
||||||
|
//For low quality:
|
||||||
|
glViewport(0, 0, Environment::width, Environment::height);
|
||||||
|
//For high quality:
|
||||||
|
//glViewport(0, 0, Environment::projectionWidth, Environment::projectionHeight);
|
||||||
if (!loadingCompleted) {
|
if (!loadingCompleted) {
|
||||||
drawLoading();
|
drawLoading();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#include "Space.h"
|
#include "Space.h"
|
||||||
#include "AnimatedModel.h"
|
#include "AnimatedModel.h"
|
||||||
#include "BoneAnimatedModel.h"
|
#include "BoneAnimatedModel.h"
|
||||||
#include "planet/PlanetData.h"
|
#include "planet/PlanetData.h"
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "render/Renderer.h"
|
#include "render/Renderer.h"
|
||||||
#include "Environment.h"
|
#include "Environment.h"
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#include "UiManager.h"
|
#include "UiManager.h"
|
||||||
#include "utils/Utils.h"
|
#include "utils/Utils.h"
|
||||||
#include "render/TextRenderer.h"
|
#include "render/TextRenderer.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "render/Renderer.h"
|
#include "render/Renderer.h"
|
||||||
#include "render/TextureManager.h"
|
#include "render/TextureManager.h"
|
||||||
|
|||||||
14
src/main.cpp
14
src/main.cpp
@ -1,4 +1,4 @@
|
|||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Environment.h"
|
#include "Environment.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
@ -26,10 +26,6 @@ ZL::Game game;
|
|||||||
|
|
||||||
#ifdef EMSCRIPTEN
|
#ifdef EMSCRIPTEN
|
||||||
void MainLoop() {
|
void MainLoop() {
|
||||||
// SDL_GL_MakeCurrent тут не нужен каждый раз
|
|
||||||
/*glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
||||||
SDL_GL_SwapWindow(ZL::Environment::window);*/
|
|
||||||
g_game->update();
|
g_game->update();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -55,8 +51,8 @@ EM_BOOL onWebGLContextRestored(int /*eventType*/, const void* /*reserved*/, void
|
|||||||
|
|
||||||
static void applyResize(int logicalW, int logicalH) {
|
static void applyResize(int logicalW, int logicalH) {
|
||||||
// Получаем коэффициент плотности пикселей (например, 2.625 на Pixel или 3.0 на Samsung)
|
// Получаем коэффициент плотности пикселей (например, 2.625 на Pixel или 3.0 на Samsung)
|
||||||
//double dpr = emscripten_get_device_pixel_ratio();
|
double dpr = emscripten_get_device_pixel_ratio();
|
||||||
double dpr = 1; // low quality
|
//double dpr = 1; // low quality
|
||||||
|
|
||||||
// Вычисляем реальные физические пиксели
|
// Вычисляем реальные физические пиксели
|
||||||
int physicalW = static_cast<int>(logicalW * dpr);
|
int physicalW = static_cast<int>(logicalW * dpr);
|
||||||
@ -83,6 +79,10 @@ static void applyResize(int logicalW, int logicalH) {
|
|||||||
e.window.data1 = physicalW;
|
e.window.data1 = physicalW;
|
||||||
e.window.data2 = physicalH;
|
e.window.data2 = physicalH;
|
||||||
SDL_PushEvent(&e);
|
SDL_PushEvent(&e);
|
||||||
|
|
||||||
|
std::cout << "Resized, new size: " << logicalW << "x" << logicalH
|
||||||
|
<< " (physical: " << physicalW << "x" << physicalH
|
||||||
|
<< ", DPR: " << dpr << ")" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
EM_BOOL onWindowResized(int /*eventType*/, const EmscriptenUiEvent* e, void* /*userData*/) {
|
EM_BOOL onWindowResized(int /*eventType*/, const EmscriptenUiEvent* e, void* /*userData*/) {
|
||||||
|
|||||||
@ -41,7 +41,7 @@ namespace ZL {
|
|||||||
return serverBoxes_;
|
return serverBoxes_;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<bool> getServerBoxDestroyedFlags() {
|
std::vector<bool> getServerBoxDestroyedFlags() override {
|
||||||
return serverBoxesDestroyed_;
|
return serverBoxesDestroyed_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user