16#include <glm/gtc/matrix_transform.hpp>
17#include <glm/gtc/quaternion.hpp>
25void pushRenderable3D(
const SceneNode &
n,
void *
target) {
26 auto *
r =
static_cast<Renderable3D *
>(
target);
29 auto *
t =
r->transform().operator->();
32 t->hasLinkedWorld =
true;
40 t->sx = glm::length(c0);
41 t->sy = glm::length(c1);
42 t->sz = glm::length(c2);
43 if (
t->sx > 1e-8f) c0 /=
t->sx;
44 if (
t->sy > 1e-8f) c1 /=
t->sy;
45 if (
t->sz > 1e-8f) c2 /=
t->sz;
47 glm::mat3 rot(c0, c1, c2);
51 r->meshRenderer()->visible =
n.visible;
54void pushRenderable2D(
const SceneNode &
n,
void *
target) {
55 auto *
r =
static_cast<Renderable2D *
>(
target);
56 auto t =
r->transform();
57 const glm::mat4 &
w =
n.world;
63 t->sx = glm::length(c0);
64 t->sy = glm::length(c1);
65 if (
t->sx > 1e-8f) c0 /=
t->sx;
67 t->rot = std::atan2(c0.y, c0.x);
69 r->sprite()->visible =
n.visible;
72void pushCamera3D(
const SceneNode &
n,
void *
target) {
73 auto *
c =
static_cast<Camera3D *
>(
target);
74 c->setEye(
n.world[3][0],
n.world[3][1],
n.world[3][2]);
79bool entityAlive(
const void *
target) {
80 return ecs::is_entity_visible(
static_cast<const ecs::Entity *
>(
static_cast<const T *
>(
target)));
86 {
"renderable2d", &pushRenderable2D,
nullptr, &entityAlive<Renderable2D>});
88 {
"renderable3d", &pushRenderable3D,
nullptr, &entityAlive<Renderable3D>});
90 {
"camera3d", &pushCamera3D,
nullptr, &entityAlive<Camera3D>});
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
int registerLinkKind(const LinkOps &ops)
Registers link kind.
void eulerYxzFromMatrix(const glm::mat< 4, 4, T, glm::defaultp > &m, T &yaw, T &pitch, T &roll)
Yaw/pitch/roll for the engine's transform order T * Ry * Rx * Rz * S.
Retained scene node (arena). Conceptual GameObject; isomorphic to eve::ui::UINode.