载入中...
搜索中...
未找到
SceneLink.h
浏览该文件的文档.
1#pragma once
2
3// Attaching things to scene nodes.
4//
5// A link keeps an external object -- a renderable, a physics body, a camera, an
6// audio source -- in step with the node it hangs off. The set of kinds used to
7// be a closed enum with a switch in TransformSystem, so scene had to include
8// graphics, physics and audio, and no other module could ever attach to the
9// tree without editing this file.
10//
11// Kinds are registered instead. The module that owns the target type supplies
12// the three operations, keeps the casts on its own side where the type is
13// complete, and scene never learns what a Renderable3D is.
14//
15// Dispatch is through a function-pointer table, not virtual calls: link sync
16// runs for every dirty node every frame.
17
18#include "common/Export.h"
19
20#include <cstddef>
21
22namespace eve::scene {
23
24struct SceneNode;
25
27struct LinkOps {
29 const char* kind = nullptr;
30
32 void (*pushWorld)(const SceneNode& node, void* target) = nullptr;
33
38 void (*pullWorld)(SceneNode& node, void* target) = nullptr;
39
44 bool (*alive)(const void* target) = nullptr;
45};
46
53
55EVENGINE_API int findLinkKind(const char* kind);
56
58EVENGINE_API const LinkOps* linkOps(int kindId);
59
61EVENGINE_API const char* linkKindName(int kindId);
62
68struct SceneLink {
69 int kind = -1;
70 void* target = nullptr;
71 int syncMode = 0;
72};
73
74} // namespace eve::scene
Tok kind
#define EVENGINE_API
宿主(eve / libmain)导出宏;插件从进程导入同一批符号。
Definition Export.h:16
NodeDesc node(std::string id, std::vector< NodeDesc > children, std::string name)
Definition NodeDesc.cpp:214
const LinkOps * linkOps(int kindId)
Definition SceneLink.cpp:47
const char * linkKindName(int kindId)
Definition SceneLink.cpp:53
int registerLinkKind(const LinkOps &ops)
Definition SceneLink.cpp:27
int findLinkKind(const char *kind)
Definition SceneLink.cpp:39
void(* pushWorld)(const SceneNode &node, void *target)
Definition SceneLink.h:32
void(* pullWorld)(SceneNode &node, void *target)
Definition SceneLink.h:38
bool(* alive)(const void *target)
Definition SceneLink.h:44
const char * kind
Definition SceneLink.h:29
Retained scene node (arena). Conceptual GameObject; isomorphic to eve::ui::UINode.
Definition SceneHost.h:39