Files
EVEngine/src/modules/scene/SceneObject.h
T
西风逍遥游 4377e062dd feat: zeroerr parameter validation + Doxygen API documentation
Squashed onto current main. Adds src/engine/common/Assert.h (EV_PARAM_CHECK / EV_ASSERT backed by zeroerr), an EVENGINE_ENABLE_ASSERTS option (non-Debug builds strip ZEROERR_NO_ASSERT unless enabled), parameter checks at key entry points, Doxygen comments across headers, Doxyfile + make docs / CMake docs targets, and Windows setup + code conventions in AGENTS.md.
2026-08-19 09:01:12 +08:00

45 lines
1.2 KiB
C++

#pragma once
#include "common/ECS.h"
#include <squirrel.h>
#include <string>
#include <vector>
namespace eve::scene {
/**
* @brief Per-node ECS identity (created lazily when a node needs script bindings or
* engine components). A node's stable string id (hostName + nodeId) is mirrored
* here so ECS systems can address scene nodes and vice versa.
*
* Meta holds the binding back to the arena node; ScriptBindings roots the
* script eve.SceneEntity instances attached to that node (sq_addref). The
* scene module owns the whole lifecycle; do not create standalone.
*/
class SceneObject : public ecs::Entity {
public:
ENTITY(SceneObject, ecs::Entity)
void release() override { ecs::DestroyEntity(this); }
struct Meta {
SceneObject *entity = nullptr;
std::string hostName;
std::string nodeId;
};
struct ScriptBindings {
std::vector<HSQOBJECT> instances; // rooted script entity instances
};
COMPONENT(Meta, meta)
COMPONENT(ScriptBindings, scriptBindings)
static SceneObject *createObject(const std::string &hostName,
const std::string &nodeId);
};
} // namespace eve::scene