#pragma once #include #include #include #include "render/Renderer.h" #include "InteractiveObjectState.h" namespace FRG { class Renderer; struct LoadedGameObject { std::string name; // identity key — stays at top level LoadedGameObjectState creationInfo; // paths + transforms for save/recreate std::shared_ptr texture; std::shared_ptr textureDarklands; VertexRenderStruct mesh; }; struct InteractiveObject { explicit InteractiveObject(InteractiveObjectState& boundState) : state(boundState) {} std::string id; LoadedGameObject loadedObject; // rendering assets // Factory: creates a fully-loaded InteractiveObject from a state descriptor. // Loads textures and mesh from state.objectInfo, computes mesh centering, // and sets state.position = jsonPosition + meshCenter. static InteractiveObject createFromState(InteractiveObjectState& state, Renderer& renderer, const std::string& zipPath = ""); void draw(Renderer& renderer) const; void drawDarklands(Renderer& renderer) const; const std::string& entityId() const { return id; } private: friend class GameObjectLoader; friend class Location; friend class LocationEditor; friend class ScriptEngine; friend class InternalGameServer; InteractiveObjectState& state; // non-owning binding to LocationGameState }; } // namespace FRG