This commit is contained in:
Vladislav Khorev 2026-05-01 20:01:06 +03:00
parent 16d250a51d
commit 519d780b3c
9 changed files with 25 additions and 126 deletions

View File

@ -1,20 +1,20 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
project(space-game001 LANGUAGES C CXX) project(witcher001 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Build option (Windows-only): when ON, the game launches in fullscreen. # Build option (Windows-only): when ON, the game launches in fullscreen.
# When OFF (default), it launches in a 1280x720 window like before. # When OFF (default), it launches in a 1280x720 window like before.
option(FULLSCREEN "Launch the game in fullscreen mode" ON) option(FULLSCREEN "Launch the game in fullscreen mode" OFF)
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/ThirdParty.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/ThirdParty.cmake)
# =========================================== # ===========================================
# Основной проект space-game001 # Основной проект witcher001
# =========================================== # ===========================================
add_executable(space-game001 add_executable(witcher001
../src/main.cpp ../src/main.cpp
../src/Game.cpp ../src/Game.cpp
../src/Game.h ../src/Game.h
@ -85,21 +85,21 @@ add_executable(space-game001
) )
# Установка проекта по умолчанию для Visual Studio # Установка проекта по умолчанию для Visual Studio
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT space-game001) set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT witcher001)
# include-пути проекта # include-пути проекта
target_include_directories(space-game001 PRIVATE target_include_directories(witcher001 PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_SOURCE_DIR}/../src"
) )
set_target_properties(space-game001 PROPERTIES set_target_properties(witcher001 PROPERTIES
OUTPUT_NAME "space-game001" OUTPUT_NAME "witcher001"
) )
# Определения препроцессора: # Определения препроцессора:
# PNG_ENABLED включает код PNG в TextureManager # PNG_ENABLED включает код PNG в TextureManager
# SDL_MAIN_HANDLED отключает переопределение main -> SDL_main # SDL_MAIN_HANDLED отключает переопределение main -> SDL_main
target_compile_definitions(space-game001 PRIVATE target_compile_definitions(witcher001 PRIVATE
WIN32_LEAN_AND_MEAN WIN32_LEAN_AND_MEAN
PNG_ENABLED PNG_ENABLED
SDL_MAIN_HANDLED SDL_MAIN_HANDLED
@ -108,14 +108,14 @@ target_compile_definitions(space-game001 PRIVATE
) )
if(FULLSCREEN) if(FULLSCREEN)
target_compile_definitions(space-game001 PRIVATE FULLSCREEN) target_compile_definitions(witcher001 PRIVATE FULLSCREEN)
endif() endif()
# Линкуем с SDL2main, если он вообще установлен # Линкуем с SDL2main, если он вообще установлен
target_link_libraries(space-game001 PRIVATE SDL2main_external_lib) target_link_libraries(witcher001 PRIVATE SDL2main_external_lib)
# Линкуем сторонние библиотеки # Линкуем сторонние библиотеки
target_link_libraries(space-game001 PRIVATE target_link_libraries(witcher001 PRIVATE
SDL2_external_lib SDL2_external_lib
libpng_external_lib libpng_external_lib
zlib_external_lib zlib_external_lib
@ -130,7 +130,7 @@ target_link_libraries(space-game001 PRIVATE
# Линкуем OpenGL (Windows) # Линкуем OpenGL (Windows)
if(WIN32) if(WIN32)
target_link_libraries(space-game001 PRIVATE opengl32) target_link_libraries(witcher001 PRIVATE opengl32)
endif() endif()
# =========================================== # ===========================================
@ -140,19 +140,19 @@ if (WIN32)
# SDL2: в Debug - SDL2d.dll, в Release - SDL2.dll # SDL2: в Debug - SDL2d.dll, в Release - SDL2.dll
set(SDL2_DLL_SRC "$<IF:$<CONFIG:Debug>,${SDL2_INSTALL_DIR}/bin/SDL2d.dll,${SDL2_INSTALL_DIR}/bin/SDL2.dll>") set(SDL2_DLL_SRC "$<IF:$<CONFIG:Debug>,${SDL2_INSTALL_DIR}/bin/SDL2d.dll,${SDL2_INSTALL_DIR}/bin/SDL2.dll>")
set(SDL2_DLL_DST "$<IF:$<CONFIG:Debug>,$<TARGET_FILE_DIR:space-game001>/SDL2d.dll,$<TARGET_FILE_DIR:space-game001>/SDL2.dll>") set(SDL2_DLL_DST "$<IF:$<CONFIG:Debug>,$<TARGET_FILE_DIR:witcher001>/SDL2d.dll,$<TARGET_FILE_DIR:witcher001>/SDL2.dll>")
set(LIBZIP_DLL_SRC "$<IF:$<CONFIG:Debug>,${LIBZIP_BASE_DIR}-Debug/bin/zip.dll,${LIBZIP_BASE_DIR}-Release/bin/zip.dll>") set(LIBZIP_DLL_SRC "$<IF:$<CONFIG:Debug>,${LIBZIP_BASE_DIR}-Debug/bin/zip.dll,${LIBZIP_BASE_DIR}-Release/bin/zip.dll>")
set(ZLIB_DLL_SRC "$<IF:$<CONFIG:Debug>,${ZLIB_INSTALL_DIR}/bin/zd.dll,${ZLIB_INSTALL_DIR}/bin/z.dll>") set(ZLIB_DLL_SRC "$<IF:$<CONFIG:Debug>,${ZLIB_INSTALL_DIR}/bin/zd.dll,${ZLIB_INSTALL_DIR}/bin/z.dll>")
set(ZLIB_DLL_DST "$<IF:$<CONFIG:Debug>,$<TARGET_FILE_DIR:space-game001>/zd.dll,$<TARGET_FILE_DIR:space-game001>/z.dll>") set(ZLIB_DLL_DST "$<IF:$<CONFIG:Debug>,$<TARGET_FILE_DIR:witcher001>/zd.dll,$<TARGET_FILE_DIR:witcher001>/z.dll>")
set(SDL2TTF_DLL_SRC "$<IF:$<CONFIG:Debug>,${SDL2TTF_BASE_DIR}-Debug/bin/SDL2_ttfd.dll,${SDL2TTF_BASE_DIR}-Release/bin/SDL2_ttf.dll>") set(SDL2TTF_DLL_SRC "$<IF:$<CONFIG:Debug>,${SDL2TTF_BASE_DIR}-Debug/bin/SDL2_ttfd.dll,${SDL2TTF_BASE_DIR}-Release/bin/SDL2_ttf.dll>")
set(SDL2MIXER_DLL_SRC "$<IF:$<CONFIG:Debug>,${SDL2MIXER_BASE_DIR}-Debug/bin/SDL2_mixerd.dll,${SDL2MIXER_BASE_DIR}-Release/bin/SDL2_mixer.dll>") set(SDL2MIXER_DLL_SRC "$<IF:$<CONFIG:Debug>,${SDL2MIXER_BASE_DIR}-Debug/bin/SDL2_mixerd.dll,${SDL2MIXER_BASE_DIR}-Release/bin/SDL2_mixer.dll>")
add_custom_command(TARGET space-game001 POST_BUILD add_custom_command(TARGET witcher001 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "Copying DLLs to output folder..." COMMAND ${CMAKE_COMMAND} -E echo "Copying DLLs to output folder..."
# Копируем SDL2 (целевое имя всегда SDL2.dll) # Копируем SDL2 (целевое имя всегда SDL2.dll)
@ -163,7 +163,7 @@ if (WIN32)
# Копируем LIBZIP (целевое имя всегда zip.dll) # Копируем LIBZIP (целевое имя всегда zip.dll)
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${LIBZIP_DLL_SRC}" "${LIBZIP_DLL_SRC}"
"$<TARGET_FILE_DIR:space-game001>/zip.dll" "$<TARGET_FILE_DIR:witcher001>/zip.dll"
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${ZLIB_DLL_SRC}" "${ZLIB_DLL_SRC}"
@ -171,11 +171,11 @@ if (WIN32)
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${SDL2TTF_DLL_SRC}" "${SDL2TTF_DLL_SRC}"
"$<TARGET_FILE_DIR:space-game001>" "$<TARGET_FILE_DIR:witcher001>"
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/../thirdparty/SDL_mixer-release-2.8.0/install-$<CONFIG>/bin/SDL2_mixer$<$<CONFIG:Debug>:d>.dll" "${CMAKE_CURRENT_SOURCE_DIR}/../thirdparty/SDL_mixer-release-2.8.0/install-$<CONFIG>/bin/SDL2_mixer$<$<CONFIG:Debug>:d>.dll"
"$<TARGET_FILE_DIR:space-game001>/SDL2_mixer$<$<CONFIG:Debug>:d>.dll" "$<TARGET_FILE_DIR:witcher001>/SDL2_mixer$<$<CONFIG:Debug>:d>.dll"
) )
endif() endif()
@ -191,12 +191,12 @@ set(RUNTIME_RESOURCE_DIRS
# Копируем ресурсы и шейдеры в папку exe и в корень build/ # Копируем ресурсы и шейдеры в папку exe и в корень build/
foreach(resdir IN LISTS RUNTIME_RESOURCE_DIRS) foreach(resdir IN LISTS RUNTIME_RESOURCE_DIRS)
add_custom_command(TARGET space-game001 POST_BUILD add_custom_command(TARGET witcher001 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "Copying ${resdir} to runtime folders..." COMMAND ${CMAKE_COMMAND} -E echo "Copying ${resdir} to runtime folders..."
# 1) туда, где лежит exe (build/Debug, build/Release и т.п.) # 1) туда, где лежит exe (build/Debug, build/Release и т.п.)
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_SOURCE_DIR}/../${resdir}" "${CMAKE_SOURCE_DIR}/../${resdir}"
"$<TARGET_FILE_DIR:space-game001>/${resdir}" "$<TARGET_FILE_DIR:witcher001>/${resdir}"
# 2) в корень build, если захочешь запускать из этой папки # 2) в корень build, если захочешь запускать из этой папки
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_SOURCE_DIR}/../${resdir}" "${CMAKE_SOURCE_DIR}/../${resdir}"

View File

@ -127,15 +127,7 @@ void Character::setTexture(std::shared_ptr<ZL::Texture> texture)
void Character::setTexture(const std::string& meshName, std::shared_ptr<Texture> tex) { void Character::setTexture(const std::string& meshName, std::shared_ptr<Texture> tex) {
meshTextures[meshName] = std::move(tex); meshTextures[meshName] = std::move(tex);
} }
/*
void Character::setTexture(std::shared_ptr<Texture> tex) {
for (auto& animEntry : animations) {
for (const auto& name : animEntry.second.model.meshNamesOrdered) {
meshTextures[name] = tex;
}
}
}
*/
AnimationState Character::resolveActiveState() const { AnimationState Character::resolveActiveState() const {
if (animations.count(currentState)) return currentState; if (animations.count(currentState)) return currentState;
@ -174,14 +166,6 @@ void Character::update(int64_t deltaMs) {
deltaMs = static_cast<int64_t>(static_cast<float>(deltaMs) * speedMultiplier); deltaMs = static_cast<int64_t>(static_cast<float>(deltaMs) * speedMultiplier);
} }
//weaponInitialRotation = Eigen::AngleAxisf(x/180.0, Eigen::Vector3f::UnitZ()).toRotationMatrix();
//weaponInitialRotation = Eigen::AngleAxisf(-M_PI*0.5, Eigen::Vector3f::UnitZ()).toRotationMatrix();
//weaponInitialPosition = Eigen::Vector3f(0, 0.09, 0.016);
/*if (deltaMs > 200)
{
deltaMs = 200;
}*/
Eigen::Vector3f activeTarget; Eigen::Vector3f activeTarget;
Eigen::Vector3f lookTarget; Eigen::Vector3f lookTarget;
@ -373,14 +357,8 @@ void Character::update(int64_t deltaMs) {
resetAnim = false; resetAnim = false;
anim.currentFrame = 0; anim.currentFrame = 0;
} }
//19
int prevFrame = anim.currentFrame; int prevFrame = anim.currentFrame;
anim.currentFrame += static_cast<float>(deltaMs) / 24.f; anim.currentFrame += static_cast<float>(deltaMs) / 24.f;
/*
if (npcId == "ghost_01x")
{
std::cout << "Current animation frame: " << anim.currentFrame << " / " << anim.totalFrames << " -- " << anim.lastFrame << std::endl;
}*/
if (static_cast<int>(anim.currentFrame) >= 20 && currentState == AnimationState::STAND_TO_ACTION) if (static_cast<int>(anim.currentFrame) >= 20 && currentState == AnimationState::STAND_TO_ACTION)
{ {
@ -436,25 +414,21 @@ void Character::update(int64_t deltaMs) {
if (currentState == AnimationState::STAND_TO_ACTION) if (currentState == AnimationState::STAND_TO_ACTION)
{ {
currentState = AnimationState::ACTION_IDLE; currentState = AnimationState::ACTION_IDLE;
//resetAnim = true;
} }
if (currentState == AnimationState::ACTION_TO_STAND) if (currentState == AnimationState::ACTION_TO_STAND)
{ {
currentState = AnimationState::STAND; currentState = AnimationState::STAND;
//resetAnim = true;
} }
if (currentState == AnimationState::ACTION_ATTACK) if (currentState == AnimationState::ACTION_ATTACK)
{ {
currentState = AnimationState::ACTION_IDLE; currentState = AnimationState::ACTION_IDLE;
//resetAnim = true;
attack = 0; attack = 0;
} }
if (currentState == AnimationState::ACTION_TO_DEATH) if (currentState == AnimationState::ACTION_TO_DEATH)
{ {
currentState = AnimationState::DEATH_IDLE; currentState = AnimationState::DEATH_IDLE;
//resetAnim = true;
} }
} }

View File

@ -107,9 +107,6 @@ namespace ZL {
void updatePinchZoom(); void updatePinchZoom();
void endPinch(); void endPinch();
int countNonUiPointers() const; int countNonUiPointers() const;
void handleDown(int64_t fingerId, int mx, int my);
void handleUp(int64_t fingerId, int mx, int my);
void handleMotion(int64_t fingerId, int mx, int my);
void setupQuestJournalUi(); void setupQuestJournalUi();
void toggleQuestJournal(); void toggleQuestJournal();

View File

@ -205,22 +205,12 @@ void DialogueOverlay::drawDialogue(Renderer& renderer, const PresentationModel&
nameRenderer->drawText(model.speaker, nameX, nameY, 1.0f, false, { 1.0f, 0.88f, 0.45f, 1.0f }); nameRenderer->drawText(model.speaker, nameX, nameY, 1.0f, false, { 1.0f, 0.88f, 0.45f, 1.0f });
} }
/*<<<<<<< HEAD
//const std::string wrappedBody = wrapText(model.visibleText, 90);
const std::string wrappedBody = wrapText(model.visibleText, 56);
bodyRenderer->drawText(wrappedBody, bodyX, bodyY, 1.0f, false, { 1.0f, 1.0f, 1.0f, 1.0f });
=======*/
// const std::string wrappedBody = wrapText(model.visibleText, 90);
// bodyRenderer->drawText(wrappedBody, bodyX, bodyY, 1.0f, false, { 1.0f, 1.0f, 1.0f, 1.0f });
// const std::string wrappedBody = wrapText(model.visibleText, 56);
// bodyRenderer->drawText(wrappedBody, bodyX, bodyY, 1.0f, false, { 1.0f, 1.0f, 1.0f, 1.0f });
const float bodyTextScale = 1.0f; const float bodyTextScale = 1.0f;
const float bodyMaxWidthPx = textboxRect.w - 48.0f; const float bodyMaxWidthPx = textboxRect.w - 48.0f;
const std::string wrappedBody = wrapTextToWidth(model.visibleText, *bodyRenderer, bodyMaxWidthPx, bodyTextScale); const std::string wrappedBody = wrapTextToWidth(model.visibleText, *bodyRenderer, bodyMaxWidthPx, bodyTextScale);
bodyRenderer->drawText(wrappedBody, bodyX, bodyY, bodyTextScale, false, { 1.0f, 1.0f, 1.0f, 1.0f }); bodyRenderer->drawText(wrappedBody, bodyX, bodyY, bodyTextScale, false, { 1.0f, 1.0f, 1.0f, 1.0f });
//>>>>>>> 4de8f78ecad8b7e2139d593b95aaf9ef01b25ece
lastChoiceRects.clear(); lastChoiceRects.clear();
if (model.mode == PresentationMode::Choice) { if (model.mode == PresentationMode::Choice) {

View File

@ -7,14 +7,9 @@
#include "external/nlohmann/json.hpp" #include "external/nlohmann/json.hpp"
#include "TextModel.h" #include "TextModel.h"
#include "InteractiveObject.h" #include "InteractiveObject.h"
//#include "Character.h"
//#include "render/TextureManager.h"
namespace ZL { namespace ZL {
//struct Texture;
//struct VertexRenderStruct;
//class Renderer;
class Character; class Character;
struct GameObjectData { struct GameObjectData {

View File

@ -9,10 +9,9 @@ namespace ZL {
GLuint fbo = 0; GLuint fbo = 0;
GLuint textureID = 0; GLuint textureID = 0;
int width, height; int width, height;
bool useMipmaps; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD> bool useMipmaps;
public: public:
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> false
FrameBuffer(int w, int h, bool useMipmaps = false); FrameBuffer(int w, int h, bool useMipmaps = false);
~FrameBuffer(); ~FrameBuffer();
@ -22,7 +21,6 @@ namespace ZL {
void Bind(); void Bind();
void Unbind(); void Unbind();
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void GenerateMipmaps(); void GenerateMipmaps();
GLuint getTextureID() const { return textureID; } GLuint getTextureID() const { return textureID; }

View File

@ -14,8 +14,6 @@ namespace ZL {
GLuint shaderProgram; GLuint shaderProgram;
std::unordered_map<std::string, GLuint> uniformList; std::unordered_map<std::string, GLuint> uniformList;
//std::unordered_map<std::string, std::pair<bool, size_t>> UniformList;
std::map<std::string, GLuint> attribList; std::map<std::string, GLuint> attribList;

View File

@ -298,34 +298,6 @@ bool TextRenderer::loadGlyphs(const std::string& ttfPath, int pixelSize, const s
rowHeight = max(rowHeight, gb.height); rowHeight = max(rowHeight, gb.height);
} }
// // Проходим по стандартным ASCII символам
// for (unsigned char c = 32; c < 128; ++c) {
//
// FT_Load_Char(face, c, FT_LOAD_RENDER);
// TextureDataStruct glyphData;
// glyphData.width = face->glyph->bitmap.width;
// glyphData.height = face->glyph->bitmap.rows;
// glyphData.format = TextureDataStruct::R8;
// glyphData.mipmap = TextureDataStruct::NONE;
// // Копируем буфер FreeType в вектор данных
// size_t dataSize = glyphData.width * glyphData.height;
// glyphData.data.assign(face->glyph->bitmap.buffer, face->glyph->bitmap.buffer + dataSize);
// // Теперь создание текстуры — это одна строка!
// auto tex = std::make_shared<Texture>(glyphData);
//GlyphInfo g;
// g.texture = tex;
// g.size = Eigen::Vector2f((float)face->glyph->bitmap.width, (float)face->glyph->bitmap.rows);
// g.bearing = Eigen::Vector2f((float)face->glyph->bitmap_left, (float)face->glyph->bitmap_top);
// // Advance во FreeType измеряется в 1/64 пикселя
// g.advance = (unsigned int)face->glyph->advance.x;
// glyphs.emplace((char)c, g);
// }
// Создаём Texture из atlasData (R8) // Создаём Texture из atlasData (R8)
TextureDataStruct atlasTex; TextureDataStruct atlasTex;
atlasTex.width = atlasWidth; atlasTex.width = atlasWidth;
@ -466,12 +438,9 @@ void TextRenderer::drawText(const std::string& text, float x, float y, float sca
// Примечание: для текста лучше использовать GL_DYNAMIC_DRAW, // Примечание: для текста лучше использовать GL_DYNAMIC_DRAW,
// но RefreshVBO сейчас жестко зашит на GL_STATIC_DRAW. // но RefreshVBO сейчас жестко зашит на GL_STATIC_DRAW.
// Для UI это обычно не критично, если строк не тысячи. // Для UI это обычно не критично, если строк не тысячи.
// textMesh.AssignFrom(textData);
// 4. Рендеринг // 4. Рендеринг
r->shaderManager.PushShader(shaderName); r->shaderManager.PushShader(shaderName);
//r->PushMatrix();
//r->LoadIdentity();
// Матрица проекции — используем виртуальные проекционные размеры, // Матрица проекции — используем виртуальные проекционные размеры,
// чтобы координаты текста были независимы от физического разрешения экрана. // чтобы координаты текста были независимы от физического разрешения экрана.
@ -498,24 +467,7 @@ void TextRenderer::drawText(const std::string& text, float x, float y, float sca
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//for (size_t i = 0; i < text.length(); ++i) {
// auto it = glyphs.find(text[i]);
// if (it == glyphs.end()) continue;
// glBindTexture(GL_TEXTURE_2D, it->second.texture->getTexID());
// // Отрисовываем по 6 вершин за раз
// // Нам нужно вручную биндить VBO, так как DrawVertexRenderStruct рисует всё сразу
// glBindBuffer(GL_ARRAY_BUFFER, textMesh.positionVBO->getBuffer());
// r->VertexAttribPointer3fv("vPosition", 0, (const char*)(i * 6 * sizeof(Vector3f)));
// glBindBuffer(GL_ARRAY_BUFFER, textMesh.texCoordVBO->getBuffer());
// r->VertexAttribPointer2fv("vTexCoord", 0, (const char*)(i * 6 * sizeof(Vector2f)));
// glDrawArrays(GL_TRIANGLES, 0, 6);
//}
r->DrawVertexRenderStruct(cached.mesh); r->DrawVertexRenderStruct(cached.mesh);
//r->PopMatrix();
glDisable(GL_BLEND); glDisable(GL_BLEND);

View File

@ -12,7 +12,6 @@
namespace ZL { namespace ZL {
struct GlyphInfo { struct GlyphInfo {
// std::shared_ptr<Texture> texture; // Texture for glyph
Eigen::Vector2f uv; // u,v координата левого верхнего угла в атласе (0..1) Eigen::Vector2f uv; // u,v координата левого верхнего угла в атласе (0..1)
Eigen::Vector2f uvSize; // ширина/высота в UV (0..1) Eigen::Vector2f uvSize; // ширина/высота в UV (0..1)
@ -42,10 +41,6 @@ private:
std::unordered_map<uint32_t, GlyphInfo> glyphs; std::unordered_map<uint32_t, GlyphInfo> glyphs;
// OpenGL objects for a dynamic quad
//unsigned int vao = 0;
//unsigned int vbo = 0;
// единый атлас для всех глифов // единый атлас для всех глифов
std::shared_ptr<Texture> atlasTexture; std::shared_ptr<Texture> atlasTexture;
size_t atlasWidth = 0; size_t atlasWidth = 0;