Merge branch 'salmon' of github.com:mephi1984/ZeptoLabTest1 into salmon
@ -16,37 +16,9 @@ struct ActiveObject {
|
||||
ZL::VertexDataStruct activeObjectScreenMesh;
|
||||
ZL::VertexRenderStruct activeObjectScreenMeshMutable;
|
||||
|
||||
std::shared_ptr<ZL::Texture> inventoryIconTexturePtr;
|
||||
|
||||
ZL::Vector3f objectPos;
|
||||
bool highlighted = false;
|
||||
};
|
||||
|
||||
class ActiveObjectManager {
|
||||
public:
|
||||
std::unordered_map<std::string, ActiveObject> activeObjectsEntities;
|
||||
|
||||
// Добавить или обновить объект в контейнере
|
||||
void addActiveObject(const ActiveObject& object) {
|
||||
activeObjectsEntities[object.name] = object;
|
||||
}
|
||||
|
||||
// Найти объект по имени (возвращает указатель, nullptr — если не найден)
|
||||
ActiveObject* findByName(const std::string& name) {
|
||||
auto it = activeObjectsEntities.find(name);
|
||||
if (it != activeObjectsEntities.end()) {
|
||||
return &it->second;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Найти все объекты с нужным значением highlighted
|
||||
// (возвращает список указателей на найденные объекты)
|
||||
// ActiveObject.h
|
||||
|
||||
|
||||
|
||||
|
||||
void removeByName(const std::string& name) {
|
||||
activeObjectsEntities.erase(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -30,6 +30,11 @@ void GameObjectManager::initialize() {
|
||||
|
||||
initializeLoadingScreen();
|
||||
|
||||
if (!dialogTextures.empty()) { // Проверяем, есть ли диалоги
|
||||
dialogTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24(dialogTextures[dialogIndex]));
|
||||
isDialogActive = true;
|
||||
}
|
||||
|
||||
std::function<bool()> loadingFunction1 = [this]()
|
||||
{
|
||||
|
||||
@ -81,47 +86,97 @@ void GameObjectManager::initialize() {
|
||||
{
|
||||
|
||||
// Create active object
|
||||
ActiveObject cubeForFirstRoomT;
|
||||
cubeForFirstRoomT.name = "cube_T";
|
||||
cubeForFirstRoomT.activeObjectMesh = ZL::LoadFromTextFile("./cube001.txt");
|
||||
cubeForFirstRoomT.activeObjectMesh.RotateByMatrix(QuatToMatrix(QuatFromRotateAroundZ(M_PI * 0.5)));
|
||||
cubeForFirstRoomT.activeObjectMesh.Scale(10);
|
||||
cubeForFirstRoomT.activeObjectMeshMutable.AssignFrom(cubeForFirstRoomT.activeObjectMesh);
|
||||
cubeForFirstRoomT.activeObjectMeshMutable.RefreshVBO();
|
||||
cubeForFirstRoomT.objectPos = Vector3f{ -190, 90 , 280 };
|
||||
cubeForFirstRoomT.activeObjectTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./Material_Base_color_1001-_2_.bmp"));
|
||||
cubeForFirstRoomT.activeObjectScreenTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./aoscreen01.bmp"));
|
||||
cubeForFirstRoomT.activeObjectScreenMesh = CreateRect2D({ 0.f, 0.f }, { 64.f, 64.f }, 0.5);
|
||||
cubeForFirstRoomT.activeObjectScreenMeshMutable.AssignFrom(cubeForFirstRoomT.activeObjectScreenMesh);
|
||||
cubeForFirstRoomT.activeObjectScreenMeshMutable.RefreshVBO();
|
||||
cubeForFirstRoomT.inventoryIconTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp32("./textures/inventory_objects/cubic_T_icon.bmp32"));
|
||||
|
||||
ActiveObject ao1;
|
||||
ao1.name = "book";
|
||||
ao1.activeObjectMesh = ZL::LoadFromTextFile("./book001.txt"); // Add ZL:: namespace
|
||||
ao1.activeObjectMesh.Scale(4);
|
||||
ao1.activeObjectMeshMutable.AssignFrom(ao1.activeObjectMesh);
|
||||
ao1.activeObjectMeshMutable.RefreshVBO();
|
||||
ao1.objectPos = Vector3f{ 50, 0, -300 };
|
||||
ao1.activeObjectTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./book03.bmp"));
|
||||
ao1.activeObjectScreenTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./aoscreen01.bmp"));
|
||||
ao1.activeObjectScreenMesh = CreateRect2D({ 0.f, 0.f }, { 64.f, 64.f }, 0.5);
|
||||
ao1.activeObjectScreenMeshMutable.AssignFrom(ao1.activeObjectScreenMesh);
|
||||
ao1.activeObjectScreenMeshMutable.RefreshVBO();
|
||||
|
||||
/*
|
||||
ActiveObject ao2;
|
||||
ao2.name = "superchair001";
|
||||
ao2.activeObjectMesh = ZL::LoadFromTextFile("./superchair001.txt"); // Add ZL:: namespace
|
||||
ao2.activeObjectMesh.Scale(400);
|
||||
ao2.activeObjectMesh.SwapZandY();
|
||||
ao2.activeObjectMeshMutable.AssignFrom(ao2.activeObjectMesh);
|
||||
ao2.activeObjectMeshMutable.RefreshVBO();
|
||||
ao2.objectPos = Vector3f{ 0, 0, 0 };
|
||||
ao2.activeObjectTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./chair_01_Base_Color.bmp"));
|
||||
ActiveObject cubeForFirstRoomO;
|
||||
cubeForFirstRoomO.name = "cube_O";
|
||||
cubeForFirstRoomO.activeObjectMesh = ZL::LoadFromTextFile("./cube001.txt");
|
||||
cubeForFirstRoomO.activeObjectMesh.RotateByMatrix(QuatToMatrix(QuatFromRotateAroundZ(M_PI * 0.5)));
|
||||
cubeForFirstRoomO.activeObjectMesh.RotateByMatrix(QuatToMatrix(QuatFromRotateAroundX(M_PI * 1.5)));
|
||||
cubeForFirstRoomO.activeObjectMesh.Scale(10);
|
||||
cubeForFirstRoomO.activeObjectMeshMutable.AssignFrom(cubeForFirstRoomO.activeObjectMesh);
|
||||
cubeForFirstRoomO.activeObjectMeshMutable.RefreshVBO();
|
||||
cubeForFirstRoomO.objectPos = Vector3f{ 185, 90 , -365 };
|
||||
cubeForFirstRoomO.activeObjectTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./Material_Base_color_1001-_3.bmp"));
|
||||
cubeForFirstRoomO.activeObjectScreenTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./aoscreen01.bmp"));
|
||||
cubeForFirstRoomO.activeObjectScreenMesh = CreateRect2D({ 0.f, 0.f }, { 64.f, 64.f }, 0.5);
|
||||
cubeForFirstRoomO.activeObjectScreenMeshMutable.AssignFrom(cubeForFirstRoomO.activeObjectScreenMesh);
|
||||
cubeForFirstRoomO.activeObjectScreenMeshMutable.RefreshVBO();
|
||||
cubeForFirstRoomO.inventoryIconTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp32("./textures/inventory_objects/cubic_O_icon.bmp32"));
|
||||
|
||||
|
||||
ao2.activeObjectScreenTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./aoscreen01.bmp"));
|
||||
ao2.activeObjectScreenMesh = CreateRect2D({ 0.f, 0.f }, { 64.f, 64.f }, 0.5);
|
||||
ao2.activeObjectScreenMeshMutable.AssignFrom(ao2.activeObjectScreenMesh);
|
||||
ao2.activeObjectScreenMeshMutable.RefreshVBO();
|
||||
*/
|
||||
ActiveObject cubeForFirstRoomM;
|
||||
cubeForFirstRoomM.name = "cube_M";
|
||||
cubeForFirstRoomM.activeObjectMesh = ZL::LoadFromTextFile("./cube001.txt");
|
||||
cubeForFirstRoomO.activeObjectMesh.RotateByMatrix(QuatToMatrix(QuatFromRotateAroundZ(M_PI * 0.5)));
|
||||
cubeForFirstRoomO.activeObjectMesh.RotateByMatrix(QuatToMatrix(QuatFromRotateAroundX(M_PI)));
|
||||
|
||||
cubeForFirstRoomM.activeObjectMesh.Scale(10);
|
||||
cubeForFirstRoomM.activeObjectMeshMutable.AssignFrom(cubeForFirstRoomO.activeObjectMesh);
|
||||
cubeForFirstRoomM.activeObjectMeshMutable.RefreshVBO();
|
||||
cubeForFirstRoomM.objectPos = Vector3f{ 200, 95 , 230 };
|
||||
cubeForFirstRoomM.activeObjectTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./Material_Base_color_1001_4.bmp"));
|
||||
cubeForFirstRoomM.activeObjectScreenTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./aoscreen01.bmp"));
|
||||
cubeForFirstRoomM.activeObjectScreenMesh = CreateRect2D({ 0.f, 0.f }, { 64.f, 64.f }, 0.5);
|
||||
cubeForFirstRoomM.activeObjectScreenMeshMutable.AssignFrom(cubeForFirstRoomO.activeObjectScreenMesh);
|
||||
cubeForFirstRoomM.activeObjectScreenMeshMutable.RefreshVBO();
|
||||
cubeForFirstRoomM.inventoryIconTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp32("./textures/inventory_objects/cubic_M_icon.bmp32"));
|
||||
|
||||
ActiveObject lampe;
|
||||
lampe.name = "lampe";
|
||||
lampe.activeObjectMesh = ZL::LoadFromTextFile("./lighter.txt"); // Add ZL:: namespace
|
||||
lampe.activeObjectMesh.Scale(7);
|
||||
lampe.activeObjectMeshMutable.AssignFrom(lampe.activeObjectMesh);
|
||||
lampe.activeObjectMeshMutable.RefreshVBO();
|
||||
lampe.objectPos = Vector3f{ 85, 30, 43 };
|
||||
lampe.activeObjectTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./temno.bmp"));
|
||||
lampe.activeObjectScreenTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./aoscreen01.bmp"));
|
||||
lampe.activeObjectScreenMesh = CreateRect2D({ 0.f, 0.f }, { 64.f, 64.f }, 0.5);
|
||||
lampe.activeObjectScreenMeshMutable.AssignFrom(lampe.activeObjectScreenMesh);
|
||||
lampe.activeObjectScreenMeshMutable.RefreshVBO();
|
||||
lampe.inventoryIconTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp32("./textures/inventory_objects/cubic_T_icon.bmp32"));
|
||||
|
||||
|
||||
|
||||
ActiveObject carToy;
|
||||
carToy.name = "carToy";
|
||||
carToy.activeObjectMesh = ZL::LoadFromTextFile("./car.txt"); // Add ZL:: namespace
|
||||
carToy.activeObjectMesh.Scale(12);
|
||||
carToy.activeObjectMeshMutable.AssignFrom(carToy.activeObjectMesh);
|
||||
carToy.activeObjectMeshMutable.RefreshVBO();
|
||||
carToy.objectPos = Vector3f{ 300, 0, 315 };
|
||||
carToy.activeObjectTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./Material.001_Base_color_1001_5.bmp"));
|
||||
carToy.activeObjectScreenTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./aoscreen01.bmp"));
|
||||
carToy.activeObjectScreenMesh = CreateRect2D({ 0.f, 0.f }, { 64.f, 64.f }, 0.5);
|
||||
carToy.activeObjectScreenMeshMutable.AssignFrom(carToy.activeObjectScreenMesh);
|
||||
carToy.activeObjectScreenMeshMutable.RefreshVBO();
|
||||
carToy.inventoryIconTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp32("./textures/inventory_objects/battery.bmp32"));
|
||||
|
||||
|
||||
Room room_1;
|
||||
room_1.roomTexture = std::make_shared<Texture>(CreateTextureDataFromBmp24("./Material_Base_color_1001.bmp"));
|
||||
room_1.objects.push_back(ao1);
|
||||
room_1.sound_name = "Symphony No.6 (1st movement).ogg";
|
||||
room_1.objects.push_back(cubeForFirstRoomT);
|
||||
room_1.objects.push_back(cubeForFirstRoomO);
|
||||
room_1.objects.push_back(cubeForFirstRoomM);
|
||||
room_1.sound_name = "lullaby-music-vol20-186394--online-audio-convert.com.ogg";
|
||||
room_1.roomLogic = createRoom1Logic();
|
||||
room_1.textMesh = preloadedRoomMeshArr[0];
|
||||
room_1.textMeshMutable.AssignFrom(room_1.textMesh);
|
||||
room_1.collisionMgr.setRoomBoundary(800, 800);
|
||||
room_1.collisionMgr.setRoomBoundary(790, 790);
|
||||
room_1.collisionMgr.addCollider(std::make_shared<RectangleCollider>(Vector3f{ 80, 0, 200 }, Vector3f{ 400, 0, 400 }));
|
||||
room_1.collisionMgr.addCollider(std::make_shared<RectangleCollider>(Vector3f{ -220, 0, 165 }, Vector3f{ -143, 0, 230 }));
|
||||
room_1.collisionMgr.addCollider(std::make_shared<RectangleCollider>(Vector3f{ -400, 0, 125 }, Vector3f{ -121, 0, 400 }));
|
||||
@ -135,13 +190,17 @@ void GameObjectManager::initialize() {
|
||||
|
||||
Room room_2;
|
||||
room_2.roomTexture = std::make_shared<Texture>(CreateTextureDataFromBmp24("./seconroom.bmp"));
|
||||
room_2.sound_name = "Symphony No.6 (1st movement).ogg";
|
||||
room_2.objects.push_back(lampe);
|
||||
room_2.objects.push_back(carToy);
|
||||
room_2.sound_name = "unholy-choir-1-279337--online-audio-convert.com.ogg";
|
||||
room_2.roomLogic = createRoom2Logic();
|
||||
room_2.textMesh = preloadedRoomMeshArr[1];
|
||||
room_2.textMeshMutable.AssignFrom(room_2.textMesh);
|
||||
room_2.collisionMgr.setRoomBoundary(800, 800);
|
||||
room_2.collisionMgr.addCollider(std::make_shared<RectangleCollider>(Vector3f{ 80, 0, 200 }, Vector3f{ 400, 0, 400 }));
|
||||
|
||||
room_2.collisionMgr.setRoomBoundary(790, 790);
|
||||
room_2.collisionMgr.addCollider(std::make_shared<RectangleCollider>(Vector3f{ -227, 0, -166 }, Vector3f{ 398, 0, -154 }));
|
||||
room_2.collisionMgr.addCollider(std::make_shared<RectangleCollider>(Vector3f{ -328, 0, 182 }, Vector3f{ -216, 0, 332 }));
|
||||
room_2.collisionMgr.addCollider(std::make_shared<RectangleCollider>(Vector3f{ -227, 0, -400 }, Vector3f{ -208, 0, -165}));
|
||||
room_2.collisionMgr.addCollider(std::make_shared<RectangleCollider>(Vector3f{ 263, 0, 295 }, Vector3f{ 303, 0, 335 }));
|
||||
rooms.push_back(room_2);
|
||||
|
||||
activeObjects = rooms[current_room_index].objects;
|
||||
@ -166,13 +225,6 @@ void GameObjectManager::initialize() {
|
||||
|
||||
//roomTexturePtr = rooms[current_room_index].roomTexture;
|
||||
|
||||
AddItemToInventory("cube_T", std::make_shared<Texture>(CreateTextureDataFromBmp32("./textures/inventory_objects/cubic_T_icon.bmp32")), objects_in_inventory + 1);
|
||||
objects_in_inventory++;
|
||||
AddItemToInventory("cube_O", std::make_shared<Texture>(CreateTextureDataFromBmp32("./textures/inventory_objects/cubic_O_icon.bmp32")), objects_in_inventory + 1);
|
||||
objects_in_inventory++;
|
||||
AddItemToInventory("cube_M", std::make_shared<Texture>(CreateTextureDataFromBmp32("./textures/inventory_objects/cubic_M_icon.bmp32")), objects_in_inventory + 1);
|
||||
objects_in_inventory++;
|
||||
|
||||
|
||||
monsterTexturePtr1 = std::make_shared<Texture>(CreateTextureDataFromBmp32("./monster001.bmp32"));
|
||||
monsterTexturePtr2 = std::make_shared<Texture>(CreateTextureDataFromBmp32("./monster002.bmp32"));
|
||||
@ -221,7 +273,14 @@ void GameObjectManager::switch_room(int index){
|
||||
void GameObjectManager::handleEvent(const SDL_Event& event) {
|
||||
// debug room switching
|
||||
if (event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_RIGHT) {
|
||||
switch_room(1);
|
||||
if (isDialogActive) {
|
||||
dialogIndex++;
|
||||
if (dialogIndex < dialogTextures.size()) {
|
||||
dialogTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24(dialogTextures[dialogIndex]));
|
||||
} else {
|
||||
isDialogActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (event.type == SDL_MOUSEBUTTONDOWN) {
|
||||
const auto highlightedObjects = rooms[current_room_index].findByHighlighted(true);
|
||||
@ -259,6 +318,38 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
|
||||
selectedCubes.clear();
|
||||
}
|
||||
}
|
||||
else if (current_room_index==1) {
|
||||
if (InventoryItem* item = GetItemSelected(true)){
|
||||
std::cout << item->name << std::endl;
|
||||
if (item->name == "carToy") {
|
||||
std::cout << item->name << std::endl;
|
||||
// Проверить, наведена ли мышь на лампу
|
||||
const auto highlightedObjects = rooms[current_room_index].findByHighlighted(true);
|
||||
std::cout << highlightedObjects.size() << std::endl;
|
||||
for (auto* ao : highlightedObjects) {
|
||||
if (ao && ao->name == "lampe") {
|
||||
// Create a new lamp object with updated texture
|
||||
ActiveObject updatedLamp = *ao;
|
||||
// Change from dark to lit texture
|
||||
updatedLamp.activeObjectTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./base_Base_color_1001.bmp"));
|
||||
|
||||
// Replace the old lamp with updated one
|
||||
rooms[current_room_index].removeByPtr(ao);
|
||||
rooms[current_room_index].objects.push_back(updatedLamp);
|
||||
activeObjects = rooms[current_room_index].objects;
|
||||
|
||||
// Remove car from inventory
|
||||
gInventoryMap.erase(item->name);
|
||||
objects_in_inventory--;
|
||||
|
||||
// Play sound effect
|
||||
audioPlayerAsync.playSoundAsync("lamp_on.ogg");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
const auto highlightedObjects = rooms[current_room_index].findByHighlighted(true);
|
||||
@ -268,10 +359,14 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
|
||||
continue;
|
||||
}
|
||||
|
||||
AddItemToInventory(ao->name, ao->activeObjectTexturePtr, objects_in_inventory+1);
|
||||
if (ao->name != "lampe") {
|
||||
AddItemToInventory(ao->name, ao->inventoryIconTexturePtr, objects_in_inventory+1);
|
||||
objects_in_inventory++;
|
||||
|
||||
rooms[current_room_index].removeByPtr(ao);
|
||||
activeObjects = rooms[current_room_index].objects;
|
||||
}
|
||||
|
||||
|
||||
//aoMgr.removeByName(ao->name);
|
||||
}
|
||||
@ -522,7 +617,7 @@ void GameObjectManager::updateScene(size_t ms) {
|
||||
pow(Environment::characterPos.v[1] - obj.objectPos.v[1], 2) +
|
||||
pow(Environment::characterPos.v[2] - obj.objectPos.v[2], 2)
|
||||
);
|
||||
obj.highlighted = (dist < 50.f);
|
||||
obj.highlighted = (dist < 150.f);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
#include <vector>
|
||||
#include "ActiveObject.h"
|
||||
#include "Room.h"
|
||||
#include "RenderSystem.h"
|
||||
#include "Inventory.h"
|
||||
#ifdef __linux__
|
||||
#include <SDL2/SDL.h>
|
||||
@ -70,7 +71,6 @@ public:
|
||||
//ActiveObjectManager aoMgr;
|
||||
int objects_in_inventory;
|
||||
|
||||
|
||||
std::shared_ptr<ZL::Texture> loadingScreenTexturePtr;
|
||||
|
||||
ZL::VertexDataStruct loadingScreenMesh;
|
||||
@ -87,6 +87,14 @@ public:
|
||||
ZL::VertexDataStruct monsterScreenMesh;
|
||||
ZL::VertexRenderStruct monsterScreenMeshMutable;
|
||||
|
||||
std::vector<std::string> dialogTextures = { // Список диалогов
|
||||
"./start_dialog.bmp",
|
||||
"./next_dialog.bmp",
|
||||
};
|
||||
int dialogIndex = 0; // Текущий индекс диалога
|
||||
std::shared_ptr<Texture> dialogTexturePtr; // Активная текстура диалога
|
||||
bool isDialogActive = false; // Флаг активности диалога
|
||||
|
||||
private:
|
||||
//int animationCounter = 0;
|
||||
int lastMouseX = 0; // Добавляем переменные для хранения позиции мыши
|
||||
|
||||
BIN
Material.001_Base_color_1001_5.bmp
Normal file
|
After Width: | Height: | Size: 3.0 MiB |
BIN
Material_Base_color_1001-_2_.bmp
Normal file
|
After Width: | Height: | Size: 3.0 MiB |
BIN
Material_Base_color_1001-_3.bmp
Normal file
|
After Width: | Height: | Size: 3.0 MiB |
BIN
Material_Base_color_1001_4.bmp
Normal file
|
After Width: | Height: | Size: 3.0 MiB |
@ -19,6 +19,17 @@ namespace ZL
|
||||
gInventoryMap.clear();
|
||||
gom.switch_room(1);
|
||||
}
|
||||
} else if (gom.selectedCubes.size() >= 3 && gom.bearName.compare("TOM") != 0) {
|
||||
std::cout << "Else" << std::endl;
|
||||
elapsedTime += ms;
|
||||
if (elapsedTime >= 2000) {
|
||||
gom.bearName = "";
|
||||
for (const auto& cube : gom.selectedCubes) {
|
||||
gInventoryMap[cube.name] = cube;
|
||||
}
|
||||
gom.selectedCubes.clear();
|
||||
elapsedTime = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -165,13 +165,7 @@ void RenderSystem::drawWorld(GameObjectManager& gameObjects) {
|
||||
renderer.TranslateMatrix({ 0, Environment::cameraDefaultVerticalShift, 0 });
|
||||
|
||||
// Draw active objects
|
||||
for (const auto& ao : gameObjects.activeObjects) {
|
||||
renderer.PushMatrix();
|
||||
renderer.TranslateMatrix(ao.objectPos);
|
||||
glBindTexture(GL_TEXTURE_2D, ao.activeObjectTexturePtr->getTexID());
|
||||
renderer.DrawVertexRenderStruct(ao.activeObjectMeshMutable);
|
||||
renderer.PopMatrix();
|
||||
}
|
||||
drawObjects(gameObjects);
|
||||
|
||||
// Draw room
|
||||
glBindTexture(GL_TEXTURE_2D, gameObjects.rooms[gameObjects.current_room_index].roomTexture->getTexID());
|
||||
@ -216,6 +210,18 @@ void RenderSystem::drawUI(const GameObjectManager& gameObjects) {
|
||||
renderer.PushMatrix();
|
||||
renderer.LoadIdentity();
|
||||
|
||||
// Отрисовка диалогового окна, если оно активно
|
||||
if (gameObjects.isDialogActive && gameObjects.dialogTexturePtr) {
|
||||
renderer.PushMatrix();
|
||||
float xPos = Environment::width / 2.0f - 250; // Центрируем
|
||||
float yPos = Environment::height / 2.0f - 125; // Центрируем
|
||||
renderer.TranslateMatrix(Vector3f{xPos, yPos, 0.0f});
|
||||
renderer.ScaleMatrix(Vector3f{1.5f, 1.5f, 1.0f}); // Увеличиваем размер
|
||||
glBindTexture(GL_TEXTURE_2D, gameObjects.dialogTexturePtr->getTexID());
|
||||
renderer.DrawVertexRenderStruct(gameObjects.inventoryIconMeshMutable); // Используем 2D меш инвентаря
|
||||
renderer.PopMatrix();
|
||||
}
|
||||
|
||||
//for (const auto* ao : gameObjects.aoMgr.findByHighlighted(true)) {
|
||||
for (auto& ao : gameObjects.rooms[gameObjects.current_room_index].findByHighlighted(true)) {
|
||||
std::cout << ao->name << std::endl;
|
||||
@ -292,8 +298,6 @@ void RenderSystem::drawUI(const GameObjectManager& gameObjects) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
renderer.PopMatrix();
|
||||
renderer.PopProjectionMatrix();
|
||||
|
||||
@ -399,4 +403,14 @@ void RenderSystem::worldToScreenCoordinates(Vector3f objectPos,
|
||||
screenY = (int)((1.0f + ndcY) * 0.5f * screenHeight);
|
||||
}
|
||||
|
||||
void RenderSystem::drawObjects(GameObjectManager& gameObjects){
|
||||
for (const auto& ao : gameObjects.activeObjects) {
|
||||
renderer.PushMatrix();
|
||||
renderer.TranslateMatrix(ao.objectPos);
|
||||
glBindTexture(GL_TEXTURE_2D, ao.activeObjectTexturePtr->getTexID());
|
||||
renderer.DrawVertexRenderStruct(ao.activeObjectMeshMutable);
|
||||
renderer.PopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ZL
|
||||
|
||||
@ -19,6 +19,9 @@ public:
|
||||
int screenWidth, int screenHeight,
|
||||
int& screenX, int& screenY);
|
||||
|
||||
void drawObjects(GameObjectManager& gameObjects);
|
||||
void drawDialog(GameObjectManager& gameObjects);
|
||||
|
||||
private:
|
||||
void drawWorld(GameObjectManager& gameObjects);
|
||||
void drawUI(const GameObjectManager& gameObjects);
|
||||
|
||||
BIN
base_Base_color_1001.bmp
Normal file
|
After Width: | Height: | Size: 768 KiB |
93
cube001.txt
Normal file
@ -0,0 +1,93 @@
|
||||
===Vertices: 8
|
||||
Vertex 0: <Vector (1.0000, 1.0000, 1.0000)>
|
||||
Vertex 1: <Vector (1.0000, 1.0000, -1.0000)>
|
||||
Vertex 2: <Vector (1.0000, -1.0000, 1.0000)>
|
||||
Vertex 3: <Vector (1.0000, -1.0000, -1.0000)>
|
||||
Vertex 4: <Vector (-1.0000, 1.0000, 1.0000)>
|
||||
Vertex 5: <Vector (-1.0000, 1.0000, -1.0000)>
|
||||
Vertex 6: <Vector (-1.0000, -1.0000, 1.0000)>
|
||||
Vertex 7: <Vector (-1.0000, -1.0000, -1.0000)>
|
||||
===UV Coordinates:
|
||||
Face count: 12
|
||||
Face 0
|
||||
UV Count: 3
|
||||
UV <Vector (0.8750, 0.5000)>
|
||||
UV <Vector (0.6250, 0.7500)>
|
||||
UV <Vector (0.6250, 0.5000)>
|
||||
Face 1
|
||||
UV Count: 3
|
||||
UV <Vector (0.6250, 0.7500)>
|
||||
UV <Vector (0.3750, 1.0000)>
|
||||
UV <Vector (0.3750, 0.7500)>
|
||||
Face 2
|
||||
UV Count: 3
|
||||
UV <Vector (0.6250, 0.0000)>
|
||||
UV <Vector (0.3750, 0.2500)>
|
||||
UV <Vector (0.3750, 0.0000)>
|
||||
Face 3
|
||||
UV Count: 3
|
||||
UV <Vector (0.3750, 0.5000)>
|
||||
UV <Vector (0.1250, 0.7500)>
|
||||
UV <Vector (0.1250, 0.5000)>
|
||||
Face 4
|
||||
UV Count: 3
|
||||
UV <Vector (0.6250, 0.5000)>
|
||||
UV <Vector (0.3750, 0.7500)>
|
||||
UV <Vector (0.3750, 0.5000)>
|
||||
Face 5
|
||||
UV Count: 3
|
||||
UV <Vector (0.6250, 0.2500)>
|
||||
UV <Vector (0.3750, 0.5000)>
|
||||
UV <Vector (0.3750, 0.2500)>
|
||||
Face 6
|
||||
UV Count: 3
|
||||
UV <Vector (0.8750, 0.5000)>
|
||||
UV <Vector (0.8750, 0.7500)>
|
||||
UV <Vector (0.6250, 0.7500)>
|
||||
Face 7
|
||||
UV Count: 3
|
||||
UV <Vector (0.6250, 0.7500)>
|
||||
UV <Vector (0.6250, 1.0000)>
|
||||
UV <Vector (0.3750, 1.0000)>
|
||||
Face 8
|
||||
UV Count: 3
|
||||
UV <Vector (0.6250, 0.0000)>
|
||||
UV <Vector (0.6250, 0.2500)>
|
||||
UV <Vector (0.3750, 0.2500)>
|
||||
Face 9
|
||||
UV Count: 3
|
||||
UV <Vector (0.3750, 0.5000)>
|
||||
UV <Vector (0.3750, 0.7500)>
|
||||
UV <Vector (0.1250, 0.7500)>
|
||||
Face 10
|
||||
UV Count: 3
|
||||
UV <Vector (0.6250, 0.5000)>
|
||||
UV <Vector (0.6250, 0.7500)>
|
||||
UV <Vector (0.3750, 0.7500)>
|
||||
Face 11
|
||||
UV Count: 3
|
||||
UV <Vector (0.6250, 0.2500)>
|
||||
UV <Vector (0.6250, 0.5000)>
|
||||
UV <Vector (0.3750, 0.5000)>
|
||||
===Normals:
|
||||
Vertex 0: Normal <Vector (0.5774, 0.5773, 0.5773)>
|
||||
Vertex 1: Normal <Vector (0.5773, 0.5774, -0.5774)>
|
||||
Vertex 2: Normal <Vector (0.5773, -0.5774, 0.5774)>
|
||||
Vertex 3: Normal <Vector (0.5774, -0.5773, -0.5773)>
|
||||
Vertex 4: Normal <Vector (-0.5773, 0.5774, 0.5774)>
|
||||
Vertex 5: Normal <Vector (-0.5774, 0.5773, -0.5773)>
|
||||
Vertex 6: Normal <Vector (-0.5774, -0.5773, 0.5773)>
|
||||
Vertex 7: Normal <Vector (-0.5773, -0.5774, -0.5774)>
|
||||
===Triangles: 12
|
||||
Triangle: [4, 2, 0]
|
||||
Triangle: [2, 7, 3]
|
||||
Triangle: [6, 5, 7]
|
||||
Triangle: [1, 7, 5]
|
||||
Triangle: [0, 3, 1]
|
||||
Triangle: [4, 1, 5]
|
||||
Triangle: [4, 6, 2]
|
||||
Triangle: [2, 6, 7]
|
||||
Triangle: [6, 4, 5]
|
||||
Triangle: [1, 3, 7]
|
||||
Triangle: [0, 2, 3]
|
||||
Triangle: [4, 0, 1]
|
||||
BIN
cubic_icon2.bmp32
Normal file
|
After Width: | Height: | Size: 449 KiB |
261
lighter.txt
Normal file
@ -0,0 +1,261 @@
|
||||
===Vertices: 20
|
||||
Vertex 0: <Vector (-1.0000, -1.0000, 1.0000)>
|
||||
Vertex 1: <Vector (-1.0000, 1.0000, 1.0000)>
|
||||
Vertex 2: <Vector (1.0000, -1.0000, 1.0000)>
|
||||
Vertex 3: <Vector (1.0000, 1.0000, 1.0000)>
|
||||
Vertex 4: <Vector (0.0000, 1.0000, -1.3168)>
|
||||
Vertex 5: <Vector (0.0000, 1.0000, 3.2597)>
|
||||
Vertex 6: <Vector (0.0000, -1.0000, -1.3168)>
|
||||
Vertex 7: <Vector (0.0000, -1.0000, 3.2597)>
|
||||
Vertex 8: <Vector (2.9516, -1.0000, 1.0000)>
|
||||
Vertex 9: <Vector (2.9516, 1.0000, 1.0000)>
|
||||
Vertex 10: <Vector (-3.0111, -1.0000, 1.0000)>
|
||||
Vertex 11: <Vector (-3.0111, 1.0000, 1.0000)>
|
||||
Vertex 12: <Vector (-1.6367, 1.0000, -0.3668)>
|
||||
Vertex 13: <Vector (-1.6367, -1.0000, -0.3668)>
|
||||
Vertex 14: <Vector (1.6107, -1.0000, -0.3742)>
|
||||
Vertex 15: <Vector (1.6107, 1.0000, -0.3742)>
|
||||
Vertex 16: <Vector (-1.6367, 1.0000, -3.1173)>
|
||||
Vertex 17: <Vector (-1.6367, -1.0000, -3.1173)>
|
||||
Vertex 18: <Vector (1.6107, -1.0000, -3.1246)>
|
||||
Vertex 19: <Vector (1.6107, 1.0000, -3.1246)>
|
||||
===UV Coordinates:
|
||||
Face count: 36
|
||||
Face 0
|
||||
UV Count: 3
|
||||
UV <Vector (0.6779, 0.5670)>
|
||||
UV <Vector (0.8298, 0.5670)>
|
||||
UV <Vector (0.6779, 0.7197)>
|
||||
Face 1
|
||||
UV Count: 3
|
||||
UV <Vector (0.3743, 0.6470)>
|
||||
UV <Vector (0.2225, 0.6470)>
|
||||
UV <Vector (0.2225, 0.5670)>
|
||||
Face 2
|
||||
UV Count: 3
|
||||
UV <Vector (0.5261, 0.5670)>
|
||||
UV <Vector (0.5261, 0.7506)>
|
||||
UV <Vector (0.3743, 0.5670)>
|
||||
Face 3
|
||||
UV Count: 3
|
||||
UV <Vector (0.5261, 0.7506)>
|
||||
UV <Vector (0.6779, 0.5670)>
|
||||
UV <Vector (0.6779, 0.7506)>
|
||||
Face 4
|
||||
UV Count: 3
|
||||
UV <Vector (0.6779, 0.8715)>
|
||||
UV <Vector (0.8261, 0.7197)>
|
||||
UV <Vector (0.8261, 0.8715)>
|
||||
Face 5
|
||||
UV Count: 3
|
||||
UV <Vector (0.3418, 0.0686)>
|
||||
UV <Vector (0.3595, 0.2554)>
|
||||
UV <Vector (0.2155, 0.2073)>
|
||||
Face 6
|
||||
UV Count: 3
|
||||
UV <Vector (0.0707, 0.5670)>
|
||||
UV <Vector (0.2225, 0.5670)>
|
||||
UV <Vector (0.0707, 0.6480)>
|
||||
Face 7
|
||||
UV Count: 3
|
||||
UV <Vector (0.0707, 0.6480)>
|
||||
UV <Vector (0.2225, 0.8523)>
|
||||
UV <Vector (0.0707, 0.8523)>
|
||||
Face 8
|
||||
UV Count: 3
|
||||
UV <Vector (0.3743, 0.6470)>
|
||||
UV <Vector (0.3743, 0.8512)>
|
||||
UV <Vector (0.2225, 0.8512)>
|
||||
Face 9
|
||||
UV Count: 3
|
||||
UV <Vector (0.4833, 0.7506)>
|
||||
UV <Vector (0.5913, 0.7506)>
|
||||
UV <Vector (0.4833, 0.9024)>
|
||||
Face 10
|
||||
UV Count: 3
|
||||
UV <Vector (0.3743, 0.9024)>
|
||||
UV <Vector (0.3743, 0.7506)>
|
||||
UV <Vector (0.4833, 0.9024)>
|
||||
Face 11
|
||||
UV Count: 3
|
||||
UV <Vector (0.3704, 0.3690)>
|
||||
UV <Vector (0.3595, 0.2554)>
|
||||
UV <Vector (0.5000, 0.3023)>
|
||||
Face 12
|
||||
UV Count: 3
|
||||
UV <Vector (0.3043, 0.5670)>
|
||||
UV <Vector (0.2318, 0.3981)>
|
||||
UV <Vector (0.3704, 0.3690)>
|
||||
Face 13
|
||||
UV Count: 3
|
||||
UV <Vector (0.0707, 0.4884)>
|
||||
UV <Vector (0.1368, 0.2904)>
|
||||
UV <Vector (0.2318, 0.3981)>
|
||||
Face 14
|
||||
UV Count: 3
|
||||
UV <Vector (0.0707, 0.1589)>
|
||||
UV <Vector (0.2155, 0.2073)>
|
||||
UV <Vector (0.1368, 0.2904)>
|
||||
Face 15
|
||||
UV Count: 3
|
||||
UV <Vector (0.1368, 0.2904)>
|
||||
UV <Vector (0.2155, 0.2073)>
|
||||
UV <Vector (0.2318, 0.3981)>
|
||||
Face 16
|
||||
UV Count: 3
|
||||
UV <Vector (0.2155, 0.2073)>
|
||||
UV <Vector (0.3595, 0.2554)>
|
||||
UV <Vector (0.2318, 0.3981)>
|
||||
Face 17
|
||||
UV Count: 3
|
||||
UV <Vector (0.3595, 0.2554)>
|
||||
UV <Vector (0.3704, 0.3690)>
|
||||
UV <Vector (0.2318, 0.3981)>
|
||||
Face 18
|
||||
UV Count: 3
|
||||
UV <Vector (0.9293, 0.1589)>
|
||||
UV <Vector (0.8632, 0.2904)>
|
||||
UV <Vector (0.7845, 0.2073)>
|
||||
Face 19
|
||||
UV Count: 3
|
||||
UV <Vector (0.2225, 0.5670)>
|
||||
UV <Vector (0.3743, 0.5670)>
|
||||
UV <Vector (0.3743, 0.6470)>
|
||||
Face 20
|
||||
UV Count: 3
|
||||
UV <Vector (0.0707, 0.6480)>
|
||||
UV <Vector (0.2225, 0.5670)>
|
||||
UV <Vector (0.2225, 0.6480)>
|
||||
Face 21
|
||||
UV Count: 3
|
||||
UV <Vector (0.2225, 0.8523)>
|
||||
UV <Vector (0.0707, 0.6480)>
|
||||
UV <Vector (0.2225, 0.6480)>
|
||||
Face 22
|
||||
UV Count: 3
|
||||
UV <Vector (0.2225, 0.8512)>
|
||||
UV <Vector (0.2225, 0.6470)>
|
||||
UV <Vector (0.3743, 0.6470)>
|
||||
Face 23
|
||||
UV Count: 3
|
||||
UV <Vector (0.5913, 0.7506)>
|
||||
UV <Vector (0.5913, 0.9024)>
|
||||
UV <Vector (0.4833, 0.9024)>
|
||||
Face 24
|
||||
UV Count: 3
|
||||
UV <Vector (0.6779, 0.7197)>
|
||||
UV <Vector (0.8298, 0.5670)>
|
||||
UV <Vector (0.8298, 0.7197)>
|
||||
Face 25
|
||||
UV Count: 3
|
||||
UV <Vector (0.4833, 0.9024)>
|
||||
UV <Vector (0.3743, 0.7506)>
|
||||
UV <Vector (0.4833, 0.7506)>
|
||||
Face 26
|
||||
UV Count: 3
|
||||
UV <Vector (0.3743, 0.5670)>
|
||||
UV <Vector (0.5261, 0.7506)>
|
||||
UV <Vector (0.3743, 0.7506)>
|
||||
Face 27
|
||||
UV Count: 3
|
||||
UV <Vector (0.6779, 0.5670)>
|
||||
UV <Vector (0.5261, 0.7506)>
|
||||
UV <Vector (0.5261, 0.5670)>
|
||||
Face 28
|
||||
UV Count: 3
|
||||
UV <Vector (0.8261, 0.7197)>
|
||||
UV <Vector (0.6779, 0.8715)>
|
||||
UV <Vector (0.6779, 0.7197)>
|
||||
Face 29
|
||||
UV Count: 3
|
||||
UV <Vector (0.6582, 0.0686)>
|
||||
UV <Vector (0.7845, 0.2073)>
|
||||
UV <Vector (0.6405, 0.2554)>
|
||||
Face 30
|
||||
UV Count: 3
|
||||
UV <Vector (0.5000, 0.3023)>
|
||||
UV <Vector (0.6405, 0.2554)>
|
||||
UV <Vector (0.6296, 0.3690)>
|
||||
Face 31
|
||||
UV Count: 3
|
||||
UV <Vector (0.6957, 0.5670)>
|
||||
UV <Vector (0.6296, 0.3690)>
|
||||
UV <Vector (0.7682, 0.3981)>
|
||||
Face 32
|
||||
UV Count: 3
|
||||
UV <Vector (0.9293, 0.4884)>
|
||||
UV <Vector (0.7682, 0.3981)>
|
||||
UV <Vector (0.8632, 0.2904)>
|
||||
Face 33
|
||||
UV Count: 3
|
||||
UV <Vector (0.8632, 0.2904)>
|
||||
UV <Vector (0.7682, 0.3981)>
|
||||
UV <Vector (0.7845, 0.2073)>
|
||||
Face 34
|
||||
UV Count: 3
|
||||
UV <Vector (0.6296, 0.3690)>
|
||||
UV <Vector (0.6405, 0.2554)>
|
||||
UV <Vector (0.7682, 0.3981)>
|
||||
Face 35
|
||||
UV Count: 3
|
||||
UV <Vector (0.6405, 0.2554)>
|
||||
UV <Vector (0.7845, 0.2073)>
|
||||
UV <Vector (0.7682, 0.3981)>
|
||||
===Normals:
|
||||
Vertex 0: Normal <Vector (-0.2851, -0.8526, 0.4379)>
|
||||
Vertex 1: Normal <Vector (-0.2851, 0.8526, 0.4380)>
|
||||
Vertex 2: Normal <Vector (0.2851, -0.8526, 0.4379)>
|
||||
Vertex 3: Normal <Vector (0.2851, 0.8526, 0.4380)>
|
||||
Vertex 4: Normal <Vector (-0.0020, 0.9166, -0.3998)>
|
||||
Vertex 5: Normal <Vector (0.0000, 0.5482, 0.8364)>
|
||||
Vertex 6: Normal <Vector (-0.0020, -0.9166, -0.3998)>
|
||||
Vertex 7: Normal <Vector (0.0000, -0.5482, 0.8364)>
|
||||
Vertex 8: Normal <Vector (0.7713, -0.5472, 0.3250)>
|
||||
Vertex 9: Normal <Vector (0.7713, 0.5473, 0.3250)>
|
||||
Vertex 10: Normal <Vector (-0.7739, -0.5468, 0.3193)>
|
||||
Vertex 11: Normal <Vector (-0.7739, 0.5469, 0.3193)>
|
||||
Vertex 12: Normal <Vector (-0.5484, 0.8045, -0.2280)>
|
||||
Vertex 13: Normal <Vector (-0.5484, -0.8045, -0.2280)>
|
||||
Vertex 14: Normal <Vector (0.5525, -0.8026, -0.2249)>
|
||||
Vertex 15: Normal <Vector (0.5525, 0.8026, -0.2249)>
|
||||
Vertex 16: Normal <Vector (-0.3021, 0.5458, -0.7816)>
|
||||
Vertex 17: Normal <Vector (-0.3021, -0.5458, -0.7816)>
|
||||
Vertex 18: Normal <Vector (0.2983, -0.5455, -0.7832)>
|
||||
Vertex 19: Normal <Vector (0.2983, 0.5455, -0.7832)>
|
||||
===Triangles: 36
|
||||
Triangle: [0, 1, 10]
|
||||
Triangle: [12, 13, 10]
|
||||
Triangle: [5, 1, 7]
|
||||
Triangle: [3, 7, 2]
|
||||
Triangle: [3, 8, 9]
|
||||
Triangle: [5, 3, 1]
|
||||
Triangle: [9, 8, 15]
|
||||
Triangle: [15, 18, 19]
|
||||
Triangle: [12, 16, 17]
|
||||
Triangle: [6, 17, 4]
|
||||
Triangle: [6, 4, 18]
|
||||
Triangle: [15, 3, 9]
|
||||
Triangle: [19, 4, 15]
|
||||
Triangle: [16, 12, 4]
|
||||
Triangle: [11, 1, 12]
|
||||
Triangle: [12, 1, 4]
|
||||
Triangle: [1, 3, 4]
|
||||
Triangle: [3, 15, 4]
|
||||
Triangle: [10, 13, 0]
|
||||
Triangle: [10, 11, 12]
|
||||
Triangle: [15, 8, 14]
|
||||
Triangle: [18, 15, 14]
|
||||
Triangle: [17, 13, 12]
|
||||
Triangle: [17, 16, 4]
|
||||
Triangle: [10, 1, 11]
|
||||
Triangle: [18, 4, 19]
|
||||
Triangle: [7, 1, 0]
|
||||
Triangle: [7, 3, 5]
|
||||
Triangle: [8, 3, 2]
|
||||
Triangle: [7, 0, 2]
|
||||
Triangle: [8, 2, 14]
|
||||
Triangle: [18, 14, 6]
|
||||
Triangle: [17, 6, 13]
|
||||
Triangle: [13, 6, 0]
|
||||
Triangle: [14, 2, 6]
|
||||
Triangle: [2, 0, 6]
|
||||
BIN
next_dialog.bmp
Normal file
|
After Width: | Height: | Size: 4.7 MiB |
BIN
sounds/lullaby-music-vol20-186394--online-audio-convert.com.ogg
Normal file
BIN
sounds/unholy-choir-1-279337--online-audio-convert.com.ogg
Normal file
BIN
start_dialog.bmp
Normal file
|
After Width: | Height: | Size: 4.7 MiB |
BIN
textures/inventory_objects/battery.bmp32
Normal file
|
After Width: | Height: | Size: 344 KiB |