44 lines
1.6 KiB
C++
44 lines
1.6 KiB
C++
#pragma once
|
|
#include <string>
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <functional>
|
|
#include <cstdint>
|
|
#include <Eigen/Core>
|
|
#include "render/Renderer.h"
|
|
#include "InteractiveObjectState.h"
|
|
|
|
namespace ZL {
|
|
|
|
class Renderer;
|
|
|
|
struct LoadedGameObject {
|
|
std::string name; // identity key — stays at top level
|
|
LoadedGameObjectState creationInfo; // paths + transforms for save/recreate
|
|
std::shared_ptr<Texture> texture;
|
|
std::shared_ptr<Texture> textureDarklands;
|
|
VertexRenderStruct mesh;
|
|
};
|
|
|
|
struct InteractiveObject {
|
|
LoadedGameObject loadedObject; // rendering assets
|
|
InteractiveObjectState state; // all mutable + creation state
|
|
|
|
// 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 st,
|
|
Renderer& renderer,
|
|
const std::string& zipPath = "");
|
|
|
|
void moveTo(const Eigen::Vector3f& target, float durationSec, std::function<void()> onComplete = {});
|
|
void rotateTo(float targetRotY, float durationSec, std::function<void()> onComplete = {});
|
|
void scaleTo(float targetScale, float durationSec, std::function<void()> onComplete = {});
|
|
void fadeTo(float targetAlpha, float durationSec, std::function<void()> onComplete = {});
|
|
void update(int64_t deltaMs);
|
|
void draw(Renderer& renderer) const;
|
|
void drawDarklands(Renderer& renderer) const;
|
|
};
|
|
|
|
} // namespace ZL
|