Major refactoring for game objects

This commit is contained in:
Vladislav Khorev committed 2026-05-12 21:19:29 +03:00
1 parent efb85f7328
commit 2cae9998a0
18 files changed
+547 -716

No files matched your search

+10 -25
View File
@@ -2,43 +2,28 @@
#include <string>
#include <memory>
#include <Eigen/Core>
#include "Item.h"
#include "render/Renderer.h"
#include "render/Renderer.h"
namespace ZL {
struct Texture;
struct VertexRenderStruct;
class Renderer;
struct InteractiveObject {
std::string id;
std::string name;
Eigen::Vector3f position;
float interactionRadius;
struct LoadedGameObject {
std::shared_ptr<Texture> texture;
VertexRenderStruct mesh;
Item dropItem;
std::string name;
};
struct InteractiveObject {
LoadedGameObject loadedObject; // name, texture, mesh
Eigen::Vector3f position;
float interactionRadius;
bool isActive = true;
bool isNpc = false;
std::string npcInteractCallback;
float walkSpeed = 1.5f;
float rotationSpeed = 8.0f;
float modelScale = 0.01f;
std::string animationIdlePath;
std::string animationWalkPath;
std::string texturePath;
std::string activateFunctionName;
InteractiveObject() : interactionRadius(2.0f) {}
bool isInRange(const Eigen::Vector3f& playerPos) const {
return (playerPos - position).norm() <= interactionRadius;
}
void draw(Renderer& renderer) const;
};
} // namespace ZL
} // namespace ZL