From b3d43c301bf8ea541822f52f757ad40409299edf Mon Sep 17 00:00:00 2001 From: Vectozavr <60608292+vectozavr@users.noreply.github.com> Date: Fri, 19 May 2023 14:35:47 +0300 Subject: [PATCH] Small updates from the past (for consistency) --- ShooterConsts.h | 1 + Source.cpp | 2 +- engine/io/Screen.cpp | 26 ++++++++++++++++++++------ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ShooterConsts.h b/ShooterConsts.h index 35de1ad..7bd1985 100644 --- a/ShooterConsts.h +++ b/ShooterConsts.h @@ -39,6 +39,7 @@ namespace ShooterConsts { const std::string CUBE_OBJ = "obj/other/cube.obj"; const std::string MAP_OBJ = "obj/maps/map1.obj"; + const std::string MAR_RAILWAY_OBJ = "obj/maps/railway.obj"; const std::string BIG_MAP_OBJ = "obj/maps/map2.obj"; const std::string SIMPLE_MAP_OBJ = "obj/maps/map_simple.obj"; const std::string PLANE_MAP_OBJ = "obj/maps/plane.obj"; diff --git a/Source.cpp b/Source.cpp index 0a1f244..bb97154 100644 --- a/Source.cpp +++ b/Source.cpp @@ -12,7 +12,7 @@ int main() { // Optimal for standard monitors: //game.create(720, 480, ShooterConsts::PROJECT_NAME, true); - game.create(1280, 720, ShooterConsts::PROJECT_NAME, true); + game.create(1920, 1080, ShooterConsts::PROJECT_NAME, true); //game.create(1920, 1080, ShooterConsts::PROJECT_NAME, true, Consts::BACKGROUND_COLOR, sf::Style::Fullscreen); // Optimal for MacBook Pro 16 display: diff --git a/engine/io/Screen.cpp b/engine/io/Screen.cpp index 551065b..d457d32 100644 --- a/engine/io/Screen.cpp +++ b/engine/io/Screen.cpp @@ -97,7 +97,21 @@ void Screen::drawTriangle(const Triangle &triangle) { triangle.color()) }; - _window->draw(tris, 3, sf::Triangles); + sf::Vertex lines[4] = + { + sf::Vertex(sf::Vector2f(triangle[0].x(), triangle[0].y()), sf::Color(0, 0, 0, 255)), + sf::Vertex(sf::Vector2f(triangle[1].x(), triangle[1].y()), sf::Color(0, 0, 0, 255)), + sf::Vertex(sf::Vector2f(triangle[2].x(), triangle[2].y()), sf::Color(0, 0, 0, 255)), + sf::Vertex(sf::Vector2f(triangle[0].x(), triangle[0].y()), sf::Color(0, 0, 0, 255)) + }; + + // Uncomment this line to show boundaries of triangles + // Раскомментируйте эту строку для отображения границ треугольников + // | + // \/ + _window->draw(lines, 4, sf::LineStrip); + + //_window->draw(tris, 3, sf::Triangles); } void Screen::setTitle(const std::string &title) { @@ -167,11 +181,11 @@ void Screen::prepareToGlDrawMesh() { glDisable(GL_LIGHTING); // enable alpha channel: - //glEnable( GL_ALPHA_TEST ); - //glAlphaFunc(GL_NOTEQUAL, 0.0); -// - //glEnable(GL_BLEND); - //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable( GL_ALPHA_TEST ); + glAlphaFunc(GL_NOTEQUAL, 0.0); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Configure the viewport (the same size as the window) glViewport(0, 0, _window->getSize().x, _window->getSize().y);