added inventory & active object

This commit is contained in:
Vlad committed 2026-04-09 15:33:55 +06:00
1 parent e1b491be73
commit b3fda88784
16 files changed
+793 -98

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
#include "InteractiveObject.h"
#include "render/Renderer.h"
#include "render/TextureManager.h"
#include <iostream>
#include <string>
namespace ZL {
extern const std::string textureUniformName;
}
namespace ZL {
void InteractiveObject::draw(Renderer& renderer) const {
if (!isActive || !texture) return;
std::cout << "[DRAW] InteractiveObject::draw() called" << std::endl;
std::cout << "[DRAW] Object: " << name << std::endl;
std::cout << "[DRAW] Position: (" << position.x() << ", " << position.y() << ", " << position.z() << ")" << std::endl;
// Check mesh bounds
if (!mesh.data.PositionData.empty()) {
std::cout << "[DRAW] First vertex: (" << mesh.data.PositionData[0].x() << ", "
<< mesh.data.PositionData[0].y() << ", " << mesh.data.PositionData[0].z() << ")" << std::endl;
}
// Apply position transformation
renderer.PushMatrix();
renderer.TranslateMatrix(position);
renderer.RenderUniform1i(textureUniformName, 0);
glBindTexture(GL_TEXTURE_2D, texture->getTexID());
renderer.DrawVertexRenderStruct(mesh);
renderer.PopMatrix();
}
} // namespace ZL